From 26b5e033ffde3d161382fc9addbfa99738379641 Mon Sep 17 00:00:00 2001 From: maximius Date: Sat, 17 Oct 2009 15:35:07 -0700 Subject: *Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand) *Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk --- src/bindings/scripts/ScriptMgr.cpp | 113 +- src/bindings/scripts/ScriptMgr.h | 13 - src/bindings/scripts/base/escort_ai.cpp | 88 +- src/bindings/scripts/base/escort_ai.h | 29 - src/bindings/scripts/base/follower_ai.cpp | 69 +- src/bindings/scripts/base/follower_ai.h | 21 - src/bindings/scripts/base/guard_ai.cpp | 31 - src/bindings/scripts/base/guard_ai.h | 13 - src/bindings/scripts/base/simple_ai.cpp | 42 - src/bindings/scripts/base/simple_ai.h | 17 - src/bindings/scripts/include/precompiled.cpp | 1 - src/bindings/scripts/include/precompiled.h | 4 - src/bindings/scripts/include/sc_creature.cpp | 147 +- src/bindings/scripts/include/sc_creature.h | 63 - src/bindings/scripts/include/sc_gossip.h | 24 - src/bindings/scripts/include/sc_instance.h | 5 - .../scripts/scripts/custom/npc_acherus_taxi.cpp | 11 +- .../scripts/custom/npc_wyrmresttempel_taxi.cpp | 26 - src/bindings/scripts/scripts/custom/on_events.cpp | 22 - .../scripts/eastern_kingdoms/alterac_mountains.cpp | 4 - .../scripts/eastern_kingdoms/arathi_highlands.cpp | 18 - .../blackrock_depths/blackrock_depths.cpp | 156 +- .../blackrock_depths/boss_ambassador_flamelash.cpp | 14 - .../blackrock_depths/boss_anubshiah.cpp | 15 - .../boss_emperor_dagran_thaurissan.cpp | 16 - .../blackrock_depths/boss_general_angerforge.cpp | 18 - .../blackrock_depths/boss_gorosh_the_dervish.cpp | 12 - .../blackrock_depths/boss_grizzle.cpp | 14 - .../boss_high_interrogator_gerstahn.cpp | 14 - .../blackrock_depths/boss_magmus.cpp | 12 - .../blackrock_depths/boss_moira_bronzebeard.cpp | 13 - .../blackrock_depths/boss_tomb_of_seven.cpp | 34 - .../blackrock_depths/def_blackrock_depths.h | 7 - .../blackrock_depths/instance_blackrock_depths.cpp | 48 +- .../blackrock_spire/boss_drakkisath.cpp | 14 - .../eastern_kingdoms/blackrock_spire/boss_gyth.cpp | 24 - .../blackrock_spire/boss_halycon.cpp | 14 - .../blackrock_spire/boss_highlord_omokk.cpp | 17 - .../blackrock_spire/boss_mother_smolderweb.cpp | 13 - .../blackrock_spire/boss_overlord_wyrmthalak.cpp | 18 - .../blackrock_spire/boss_pyroguard_emberseer.cpp | 13 - .../blackrock_spire/boss_quartermaster_zigris.cpp | 12 - .../blackrock_spire/boss_rend_blackhand.cpp | 13 - .../boss_shadow_hunter_voshgajin.cpp | 14 - .../blackrock_spire/boss_the_beast.cpp | 13 - .../blackrock_spire/boss_warmaster_voone.cpp | 16 - .../blackwing_lair/boss_broodlord_lashlayer.cpp | 17 - .../blackwing_lair/boss_chromaggus.cpp | 42 +- .../blackwing_lair/boss_ebonroc.cpp | 14 - .../blackwing_lair/boss_firemaw.cpp | 14 - .../blackwing_lair/boss_flamegor.cpp | 15 - .../blackwing_lair/boss_nefarian.cpp | 30 - .../blackwing_lair/boss_razorgore.cpp | 21 - .../blackwing_lair/boss_vaelastrasz.cpp | 36 - .../blackwing_lair/boss_victor_nefarius.cpp | 47 - .../blackwing_lair/instance_blackwing_lair.cpp | 2 - .../scripts/eastern_kingdoms/blasted_lands.cpp | 25 - .../scripts/eastern_kingdoms/boss_kruul.cpp | 25 - .../scripts/eastern_kingdoms/burning_steppes.cpp | 17 - .../eastern_kingdoms/deadmines/deadmines.cpp | 29 - .../eastern_kingdoms/deadmines/def_deadmines.h | 3 - .../scripts/eastern_kingdoms/dun_morogh.cpp | 15 - .../scripts/scripts/eastern_kingdoms/duskwood.cpp | 15 - .../eastern_kingdoms/eastern_plaguelands.cpp | 33 - .../scripts/eastern_kingdoms/elwynn_forest.cpp | 15 - .../scripts/eastern_kingdoms/eversong_woods.cpp | 135 +- .../scripts/eastern_kingdoms/ghostlands.cpp | 40 - .../scripts/eastern_kingdoms/hinterlands.cpp | 57 +- .../scripts/scripts/eastern_kingdoms/ironforge.cpp | 11 - .../scripts/eastern_kingdoms/isle_of_queldanas.cpp | 25 - .../eastern_kingdoms/karazhan/boss_curator.cpp | 32 - .../karazhan/boss_maiden_of_virtue.cpp | 26 - .../eastern_kingdoms/karazhan/boss_midnight.cpp | 41 +- .../eastern_kingdoms/karazhan/boss_moroes.cpp | 164 +- .../eastern_kingdoms/karazhan/boss_netherspite.cpp | 54 +- .../eastern_kingdoms/karazhan/boss_nightbane.cpp | 66 - .../karazhan/boss_prince_malchezaar.cpp | 120 +- .../karazhan/boss_shade_of_aran.cpp | 97 +- .../karazhan/boss_terestian_illhoof.cpp | 82 +- .../eastern_kingdoms/karazhan/bosses_opera.cpp | 277 -- .../eastern_kingdoms/karazhan/def_karazhan.h | 7 - .../karazhan/instance_karazhan.cpp | 38 +- .../scripts/eastern_kingdoms/karazhan/karazhan.cpp | 100 +- .../scripts/eastern_kingdoms/loch_modan.cpp | 13 - .../magisters_terrace/boss_felblood_kaelthas.cpp | 119 +- .../magisters_terrace/boss_priestess_delrissa.cpp | 247 +- .../magisters_terrace/boss_selin_fireheart.cpp | 67 +- .../magisters_terrace/boss_vexallus.cpp | 41 - .../magisters_terrace/def_magisters_terrace.h | 7 - .../instance_magisters_terrace.cpp | 29 +- .../magisters_terrace/magisters_terrace.cpp | 32 +- .../molten_core/boss_baron_geddon.cpp | 17 - .../eastern_kingdoms/molten_core/boss_garr.cpp | 25 - .../eastern_kingdoms/molten_core/boss_gehennas.cpp | 14 - .../eastern_kingdoms/molten_core/boss_golemagg.cpp | 30 - .../eastern_kingdoms/molten_core/boss_lucifron.cpp | 13 - .../eastern_kingdoms/molten_core/boss_magmadar.cpp | 16 - .../molten_core/boss_majordomo_executus.cpp | 23 - .../eastern_kingdoms/molten_core/boss_ragnaros.cpp | 49 +- .../eastern_kingdoms/molten_core/boss_shazzrah.cpp | 18 - .../molten_core/boss_sulfuron_harbinger.cpp | 37 - .../eastern_kingdoms/molten_core/def_molten_core.h | 2 - .../molten_core/instance_molten_core.cpp | 43 - .../eastern_kingdoms/molten_core/molten_core.cpp | 14 - .../eastern_kingdoms/scarlet_enclave/chapter1.cpp | 149 +- .../eastern_kingdoms/scarlet_enclave/chapter2.cpp | 86 +- .../eastern_kingdoms/scarlet_enclave/chapter5.cpp | 233 +- .../scarlet_enclave/the_scarlet_enclave.cpp | 13 - .../scarlet_monastery/boss_arcanist_doan.cpp | 20 - .../boss_azshir_the_sleepless.cpp | 15 - .../scarlet_monastery/boss_bloodmage_thalnos.cpp | 18 - .../scarlet_monastery/boss_headless_horseman.cpp | 91 +- .../scarlet_monastery/boss_herod.cpp | 28 +- .../boss_high_inquisitor_fairbanks.cpp | 20 - .../scarlet_monastery/boss_houndmaster_loksey.cpp | 12 - .../scarlet_monastery/boss_interrogator_vishas.cpp | 19 - .../boss_mograine_and_whitemane.cpp | 69 - .../scarlet_monastery/boss_scorn.cpp | 14 - .../scarlet_monastery/def_scarlet_monastery.h | 4 - .../instance_scarlet_monastery.cpp | 22 +- .../scholomance/boss_darkmaster_gandling.cpp | 22 - .../scholomance/boss_death_knight_darkreaver.cpp | 8 - .../scholomance/boss_doctor_theolen_krastinov.cpp | 17 - .../scholomance/boss_illucia_barov.cpp | 17 - .../scholomance/boss_instructor_malicia.cpp | 20 - .../scholomance/boss_jandice_barov.cpp | 34 +- .../eastern_kingdoms/scholomance/boss_kormok.cpp | 17 - .../scholomance/boss_lord_alexei_barov.cpp | 16 - .../scholomance/boss_lorekeeper_polkelt.cpp | 16 - .../scholomance/boss_ras_frostwhisper.cpp | 18 - .../scholomance/boss_the_ravenian.cpp | 17 - .../eastern_kingdoms/scholomance/boss_vectus.cpp | 15 - .../eastern_kingdoms/scholomance/def_scholomance.h | 2 - .../scholomance/instance_scholomance.cpp | 18 +- .../scripts/eastern_kingdoms/searing_gorge.cpp | 30 - .../shadowfang_keep/def_shadowfang_keep.h | 2 - .../shadowfang_keep/instance_shadowfang_keep.cpp | 33 +- .../shadowfang_keep/shadowfang_keep.cpp | 21 - .../scripts/eastern_kingdoms/silvermoon_city.cpp | 15 - .../scripts/eastern_kingdoms/silverpine_forest.cpp | 34 - .../scripts/eastern_kingdoms/stormwind_city.cpp | 48 - .../eastern_kingdoms/stranglethorn_vale.cpp | 17 - .../stratholme/boss_baron_rivendare.cpp | 32 +- .../stratholme/boss_baroness_anastari.cpp | 16 - .../stratholme/boss_cannon_master_willey.cpp | 16 - .../stratholme/boss_dathrohan_balnazzar.cpp | 32 - .../stratholme/boss_magistrate_barthilas.cpp | 20 - .../stratholme/boss_maleki_the_pallid.cpp | 15 - .../stratholme/boss_nerubenkan.cpp | 17 - .../stratholme/boss_order_of_silver_hand.cpp | 19 - .../stratholme/boss_postmaster_malown.cpp | 17 - .../stratholme/boss_ramstein_the_gorger.cpp | 18 +- .../stratholme/boss_timmy_the_cruel.cpp | 12 - .../eastern_kingdoms/stratholme/def_stratholme.h | 5 - .../stratholme/instance_stratholme.cpp | 56 +- .../eastern_kingdoms/stratholme/stratholme.cpp | 49 +- .../sunken_temple/def_sunken_temple.h | 3 - .../sunken_temple/instance_sunken_temple.cpp | 17 - .../sunken_temple/sunken_temple.cpp | 9 - .../sunwell_plateau/boss_brutallus.cpp | 41 - .../sunwell_plateau/boss_eredar_twins.cpp | 91 +- .../sunwell_plateau/boss_felmyst.cpp | 60 +- .../sunwell_plateau/boss_kalecgos.cpp | 101 +- .../sunwell_plateau/boss_kiljaeden.cpp | 201 +- .../eastern_kingdoms/sunwell_plateau/boss_muru.cpp | 108 +- .../sunwell_plateau/def_sunwell_plateau.h | 5 - .../sunwell_plateau/instance_sunwell_plateau.cpp | 36 +- .../sunwell_plateau/sunwell_plateau.cpp | 9 - .../scripts/eastern_kingdoms/tirisfal_glades.cpp | 36 - .../eastern_kingdoms/uldaman/boss_archaedas.cpp | 88 - .../eastern_kingdoms/uldaman/boss_ironaya.cpp | 19 - .../eastern_kingdoms/uldaman/instance_uldaman.cpp | 57 +- .../scripts/eastern_kingdoms/uldaman/uldaman.cpp | 27 - .../scripts/scripts/eastern_kingdoms/undercity.cpp | 42 +- .../eastern_kingdoms/western_plaguelands.cpp | 29 - .../scripts/scripts/eastern_kingdoms/westfall.cpp | 41 - .../scripts/scripts/eastern_kingdoms/wetlands.cpp | 33 +- .../eastern_kingdoms/zulaman/boss_akilzon.cpp | 67 +- .../eastern_kingdoms/zulaman/boss_halazzi.cpp | 55 - .../eastern_kingdoms/zulaman/boss_hexlord.cpp | 165 +- .../eastern_kingdoms/zulaman/boss_janalai.cpp | 122 +- .../eastern_kingdoms/zulaman/boss_nalorakk.cpp | 64 +- .../eastern_kingdoms/zulaman/boss_zuljin.cpp | 89 +- .../scripts/eastern_kingdoms/zulaman/def_zulaman.h | 3 - .../eastern_kingdoms/zulaman/instance_zulaman.cpp | 39 +- .../scripts/eastern_kingdoms/zulaman/zulaman.cpp | 28 +- .../eastern_kingdoms/zulgurub/boss_arlokk.cpp | 51 - .../eastern_kingdoms/zulgurub/boss_gahzranka.cpp | 13 - .../eastern_kingdoms/zulgurub/boss_grilek.cpp | 16 - .../eastern_kingdoms/zulgurub/boss_hakkar.cpp | 34 - .../eastern_kingdoms/zulgurub/boss_hazzarah.cpp | 17 +- .../eastern_kingdoms/zulgurub/boss_jeklik.cpp | 49 - .../eastern_kingdoms/zulgurub/boss_jindo.cpp | 45 - .../eastern_kingdoms/zulgurub/boss_mandokir.cpp | 50 +- .../eastern_kingdoms/zulgurub/boss_marli.cpp | 43 - .../eastern_kingdoms/zulgurub/boss_renataki.cpp | 28 - .../eastern_kingdoms/zulgurub/boss_thekal.cpp | 90 - .../eastern_kingdoms/zulgurub/boss_venoxis.cpp | 29 +- .../eastern_kingdoms/zulgurub/boss_wushoolay.cpp | 13 - .../eastern_kingdoms/zulgurub/def_zulgurub.h | 5 - .../zulgurub/instance_zulgurub.cpp | 21 - .../scripts/scripts/examples/example_creature.cpp | 35 - .../scripts/scripts/examples/example_escort.cpp | 28 - .../scripts/examples/example_gossip_codebox.cpp | 15 - .../scripts/scripts/examples/example_misc.cpp | 10 - .../scripts/scripts/kalimdor/ashenvale.cpp | 42 - src/bindings/scripts/scripts/kalimdor/azshara.cpp | 70 - .../scripts/scripts/kalimdor/azuremyst_isle.cpp | 117 +- .../blackfathom_depths/def_blackfathom_deeps.h | 4 - .../instance_blackfathom_deeps.cpp | 22 - .../scripts/scripts/kalimdor/bloodmyst_isle.cpp | 20 - .../scripts/scripts/kalimdor/boss_azuregos.cpp | 20 - .../culling_of_stratholme/boss_epoch.cpp | 14 - .../culling_of_stratholme/boss_mal_ganis.cpp | 16 - .../culling_of_stratholme/boss_meathook.cpp | 27 +- .../culling_of_stratholme/boss_salramm.cpp | 20 - .../def_culling_of_stratholme.h | 1 - .../instance_culling_of_stratholme.cpp | 3 - .../caverns_of_time/dark_portal/boss_aeonus.cpp | 21 - .../dark_portal/boss_chrono_lord_deja.cpp | 22 - .../caverns_of_time/dark_portal/boss_temporus.cpp | 23 - .../caverns_of_time/dark_portal/dark_portal.cpp | 81 +- .../caverns_of_time/dark_portal/def_dark_portal.h | 7 - .../dark_portal/instance_dark_portal.cpp | 62 +- .../caverns_of_time/hyjal/boss_anetheron.cpp | 42 +- .../caverns_of_time/hyjal/boss_archimonde.cpp | 99 +- .../caverns_of_time/hyjal/boss_azgalor.cpp | 43 - .../caverns_of_time/hyjal/boss_kazrogal.cpp | 24 +- .../hyjal/boss_rage_winterchill.cpp | 21 - .../kalimdor/caverns_of_time/hyjal/def_hyjal.h | 4 - .../kalimdor/caverns_of_time/hyjal/hyjal.cpp | 37 - .../kalimdor/caverns_of_time/hyjal/hyjalAI.cpp | 157 +- .../kalimdor/caverns_of_time/hyjal/hyjalAI.h | 37 - .../kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp | 205 +- .../kalimdor/caverns_of_time/hyjal/hyjal_trash.h | 10 +- .../caverns_of_time/hyjal/instance_hyjal.cpp | 47 +- .../old_hillsbrad/boss_captain_skarloc.cpp | 22 - .../old_hillsbrad/boss_epoch_hunter.cpp | 23 - .../old_hillsbrad/boss_leutenant_drake.cpp | 29 - .../old_hillsbrad/def_old_hillsbrad.h | 2 - .../old_hillsbrad/instance_old_hillsbrad.cpp | 31 +- .../old_hillsbrad/old_hillsbrad.cpp | 83 +- .../scripts/scripts/kalimdor/darkshore.cpp | 67 - src/bindings/scripts/scripts/kalimdor/desolace.cpp | 30 - .../scripts/scripts/kalimdor/dustwallow_marsh.cpp | 65 - src/bindings/scripts/scripts/kalimdor/felwood.cpp | 13 - src/bindings/scripts/scripts/kalimdor/feralas.cpp | 31 - .../kalimdor/maraudon/boss_celebras_the_cursed.cpp | 14 - .../scripts/kalimdor/maraudon/boss_landslide.cpp | 13 - .../scripts/kalimdor/maraudon/boss_noxxion.cpp | 16 - .../kalimdor/maraudon/boss_princess_theradras.cpp | 15 - .../scripts/scripts/kalimdor/moonglade.cpp | 59 +- src/bindings/scripts/scripts/kalimdor/mulgore.cpp | 43 - .../scripts/kalimdor/onyxias_lair/boss_onyxia.cpp | 55 +- .../scripts/scripts/kalimdor/orgrimmar.cpp | 42 - .../boss_amnennar_the_coldbringer.cpp | 19 - .../kalimdor/razorfen_downs/razorfen_downs.cpp | 14 - .../kalimdor/razorfen_kraul/def_razorfen_kraul.h | 4 +- .../razorfen_kraul/instance_razorfen_kraul.cpp | 18 +- .../kalimdor/razorfen_kraul/razorfen_kraul.cpp | 27 - .../kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp | 15 - .../kalimdor/ruins_of_ahnqiraj/boss_buru.cpp | 3 - .../kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp | 13 - .../kalimdor/ruins_of_ahnqiraj/boss_moam.cpp | 17 - .../kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp | 6 - .../kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp | 7 - .../instance_ruins_of_ahnqiraj.cpp | 2 - src/bindings/scripts/scripts/kalimdor/silithus.cpp | 118 +- .../scripts/kalimdor/stonetalon_mountains.cpp | 29 - src/bindings/scripts/scripts/kalimdor/tanaris.cpp | 101 - .../scripts/scripts/kalimdor/teldrassil.cpp | 19 - .../kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp | 57 +- .../kalimdor/temple_of_ahnqiraj/boss_cthun.cpp | 271 +- .../kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp | 21 - .../kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp | 21 - .../kalimdor/temple_of_ahnqiraj/boss_ouro.cpp | 24 - .../kalimdor/temple_of_ahnqiraj/boss_sartura.cpp | 45 - .../kalimdor/temple_of_ahnqiraj/boss_skeram.cpp | 41 - .../temple_of_ahnqiraj/boss_twinemperors.cpp | 85 +- .../kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp | 4 - .../temple_of_ahnqiraj/def_temple_of_ahnqiraj.h | 3 - .../instance_temple_of_ahnqiraj.cpp | 26 - .../temple_of_ahnqiraj/mob_anubisath_sentinel.cpp | 43 +- .../scripts/scripts/kalimdor/the_barrens.cpp | 104 +- .../scripts/scripts/kalimdor/thousand_needles.cpp | 68 +- .../scripts/scripts/kalimdor/thunder_bluff.cpp | 22 - .../scripts/scripts/kalimdor/ungoro_crater.cpp | 53 - .../kalimdor/wailing_caverns/def_wailing_caverns.h | 6 +- .../wailing_caverns/instance_wailing_caverns.cpp | 27 +- .../kalimdor/wailing_caverns/wailing_caverns.cpp | 29 +- .../scripts/scripts/kalimdor/winterspring.cpp | 29 - .../scripts/kalimdor/zulfarrak/zulfarrak.cpp | 48 - .../azjol_nerub/ahnkahet/boss_amanitar.cpp | 44 - .../azjol_nerub/ahnkahet/boss_elder_nadox.cpp | 51 +- .../azjol_nerub/ahnkahet/boss_herald_volazj.cpp | 28 +- .../ahnkahet/boss_jedoga_shadowseeker.cpp | 14 - .../azjol_nerub/ahnkahet/boss_prince_taldaram.cpp | 59 +- .../northrend/azjol_nerub/ahnkahet/def_ahnkahet.h | 5 - .../azjol_nerub/ahnkahet/instance_ahnkahet.cpp | 85 +- .../azjol_nerub/azjol_nerub/boss_anubarak.cpp | 15 - .../azjol_nerub/azjol_nerub/boss_hadronox.cpp | 20 - .../azjol_nerub/boss_krikthir_the_gatewatcher.cpp | 106 +- .../azjol_nerub/azjol_nerub/def_azjol_nerub.h | 3 - .../azjol_nerub/instance_azjol_nerub.cpp | 39 +- .../scripts/scripts/northrend/borean_tundra.cpp | 86 - .../scripts/scripts/northrend/dragonblight.cpp | 12 - .../northrend/draktharon_keep/boss_dred.cpp | 12 - .../northrend/draktharon_keep/boss_novos.cpp | 31 +- .../northrend/draktharon_keep/boss_tharon_ja.cpp | 14 - .../northrend/draktharon_keep/boss_trollgore.cpp | 12 - .../draktharon_keep/instance_drak_tharon_keep.cpp | 34 +- .../scripts/scripts/northrend/grizzly_hills.cpp | 17 - .../northrend/gundrak/boss_drakkari_colossus.cpp | 63 - .../scripts/scripts/northrend/gundrak/boss_eck.cpp | 19 - .../scripts/northrend/gundrak/boss_gal_darah.cpp | 28 - .../scripts/northrend/gundrak/boss_moorabi.cpp | 31 +- .../scripts/northrend/gundrak/boss_slad_ran.cpp | 49 +- .../scripts/northrend/gundrak/def_gundrak.h | 3 - .../scripts/northrend/gundrak/instance_gundrak.cpp | 47 +- .../scripts/scripts/northrend/howling_fjord.cpp | 29 - .../scripts/scripts/northrend/icecrown.cpp | 14 - .../northrend/naxxramas/boss_anubrekhan.cpp | 21 - .../scripts/northrend/naxxramas/boss_faerlina.cpp | 17 - .../northrend/naxxramas/boss_four_horsemen.cpp | 22 +- .../scripts/northrend/naxxramas/boss_gluth.cpp | 23 +- .../scripts/northrend/naxxramas/boss_gothik.cpp | 57 +- .../scripts/northrend/naxxramas/boss_grobbulus.cpp | 20 - .../scripts/northrend/naxxramas/boss_heigan.cpp | 21 - .../scripts/northrend/naxxramas/boss_kelthuzad.cpp | 35 +- .../scripts/northrend/naxxramas/boss_loatheb.cpp | 12 - .../scripts/northrend/naxxramas/boss_maexxna.cpp | 19 +- .../scripts/northrend/naxxramas/boss_noth.cpp | 26 +- .../scripts/northrend/naxxramas/boss_patchwerk.cpp | 27 +- .../scripts/northrend/naxxramas/boss_razuvious.cpp | 16 - .../scripts/northrend/naxxramas/boss_sapphiron.cpp | 60 +- .../scripts/northrend/naxxramas/boss_thaddius.cpp | 21 - .../scripts/northrend/naxxramas/def_naxxramas.h | 5 - .../northrend/naxxramas/instance_naxxramas.cpp | 36 +- .../nexus/eye_of_eternity/boss_malygos.cpp | 16 - .../nexus/eye_of_eternity/def_eye_of_eternity.h | 1 - .../eye_of_eternity/instance_eye_of_eternity.cpp | 3 - .../northrend/nexus/nexus/boss_anomalus.cpp | 46 +- .../northrend/nexus/nexus/boss_keristrasza.cpp | 48 +- .../northrend/nexus/nexus/boss_magus_telestra.cpp | 43 +- .../scripts/northrend/nexus/nexus/boss_ormorok.cpp | 39 - .../northrend/nexus/nexus/commander_kolurg.cpp | 9 - .../northrend/nexus/nexus/commander_stoutbeard.cpp | 9 - .../scripts/northrend/nexus/nexus/def_nexus.h | 4 - .../northrend/nexus/nexus/instance_nexus.cpp | 30 +- .../scripts/northrend/nexus/oculus/boss_drakos.cpp | 9 - .../scripts/northrend/nexus/oculus/boss_eregos.cpp | 18 - .../scripts/northrend/nexus/oculus/boss_urom.cpp | 9 - .../scripts/northrend/nexus/oculus/boss_varos.cpp | 9 - .../scripts/northrend/nexus/oculus/def_oculus.h | 1 - .../northrend/nexus/oculus/instance_oculus.cpp | 3 - .../northrend/obsidian_sanctum/boss_sartharion.cpp | 199 -- .../obsidian_sanctum/def_obsidian_sanctum.h | 4 - .../obsidian_sanctum/instance_obsidian_sanctum.cpp | 13 - .../scripts/scripts/northrend/sholazar_basin.cpp | 46 - .../scripts/scripts/northrend/storm_peaks.cpp | 29 - .../ulduar/halls_of_lightning/boss_bjarngrim.cpp | 73 +- .../ulduar/halls_of_lightning/boss_ionar.cpp | 80 +- .../ulduar/halls_of_lightning/boss_loken.cpp | 45 +- .../ulduar/halls_of_lightning/boss_volkhan.cpp | 99 +- .../halls_of_lightning/def_halls_of_lightning.h | 7 - .../instance_halls_of_lightning.cpp | 18 - .../ulduar/halls_of_stone/boss_krystallus.cpp | 24 - .../ulduar/halls_of_stone/boss_maiden_of_grief.cpp | 31 +- .../ulduar/halls_of_stone/boss_sjonnir.cpp | 52 +- .../ulduar/halls_of_stone/halls_of_stone.cpp | 55 +- .../halls_of_stone/instance_halls_of_stone.cpp | 38 +- .../northrend/ulduar/ulduar/boss_algalon.cpp | 1 - .../ulduar/ulduar/boss_assembly_of_iron.cpp | 81 +- .../northrend/ulduar/ulduar/boss_auriaya.cpp | 16 - .../ulduar/ulduar/boss_flame_leviathan.cpp | 59 - .../scripts/northrend/ulduar/ulduar/boss_freya.cpp | 17 - .../northrend/ulduar/ulduar/boss_general_vezax.cpp | 1 - .../scripts/northrend/ulduar/ulduar/boss_hodir.cpp | 17 - .../scripts/northrend/ulduar/ulduar/boss_ignis.cpp | 17 - .../northrend/ulduar/ulduar/boss_kologarn.cpp | 18 - .../northrend/ulduar/ulduar/boss_mimiron.cpp | 1 - .../northrend/ulduar/ulduar/boss_razorscale.cpp | 55 +- .../northrend/ulduar/ulduar/boss_thorim.cpp | 17 - .../scripts/northrend/ulduar/ulduar/boss_xt002.cpp | 18 - .../northrend/ulduar/ulduar/boss_yoggsaron.cpp | 1 - .../scripts/northrend/ulduar/ulduar/def_ulduar.h | 6 - .../northrend/ulduar/ulduar/instance_ulduar.cpp | 41 +- .../northrend/ulduar/ulduar/ulduar_teleporter.cpp | 10 - .../utgarde_keep/boss_ingvar_the_plunderer.cpp | 69 - .../utgarde_keep/utgarde_keep/boss_keleseth.cpp | 61 +- .../utgarde_keep/boss_skarvald_dalronn.cpp | 56 - .../utgarde_keep/utgarde_keep/def_utgarde_keep.h | 5 - .../utgarde_keep/instance_utgarde_keep.cpp | 52 +- .../utgarde_keep/utgarde_keep/utgarde_keep.cpp | 20 +- .../utgarde_pinnacle/boss_palehoof.cpp | 102 - .../utgarde_keep/utgarde_pinnacle/boss_skadi.cpp | 38 +- .../utgarde_keep/utgarde_pinnacle/boss_svala.cpp | 51 - .../utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp | 54 +- .../utgarde_keep/utgarde_pinnacle/def_pinnacle.h | 4 - .../utgarde_pinnacle/instance_pinnacle.cpp | 40 +- .../northrend/vault_of_archavon/boss_archavon.cpp | 33 +- .../northrend/vault_of_archavon/boss_emalon.cpp | 53 +- .../vault_of_archavon/def_vault_of_archavon.h | 1 - .../instance_vault_of_archavon.cpp | 26 +- .../northrend/violet_hold/boss_cyanigosa.cpp | 23 - .../scripts/northrend/violet_hold/boss_erekem.cpp | 37 - .../scripts/northrend/violet_hold/boss_ichoron.cpp | 19 - .../northrend/violet_hold/boss_lavanthor.cpp | 18 - .../scripts/northrend/violet_hold/boss_moragg.cpp | 16 - .../scripts/northrend/violet_hold/boss_xevozz.cpp | 16 - .../scripts/northrend/violet_hold/boss_zuramat.cpp | 18 - .../northrend/violet_hold/def_violet_hold.h | 3 - .../northrend/violet_hold/instance_violet_hold.cpp | 41 +- .../scripts/northrend/violet_hold/violet_hold.cpp | 15 - .../scripts/scripts/northrend/wintergrasp.cpp | 12 - src/bindings/scripts/scripts/northrend/zuldrak.cpp | 43 - .../auchenai_crypts/boss_exarch_maladaar.cpp | 65 - .../boss_shirrak_the_dead_watcher.cpp | 34 +- .../mana_tombs/boss_nexusprince_shaffar.cpp | 69 +- .../auchindoun/mana_tombs/boss_pandemonius.cpp | 22 - .../sethekk_halls/boss_darkweaver_syth.cpp | 94 - .../sethekk_halls/boss_tailonking_ikiss.cpp | 38 - .../auchindoun/sethekk_halls/def_sethekk_halls.h | 2 - .../sethekk_halls/instance_sethekk_halls.cpp | 11 - .../shadow_labyrinth/boss_ambassador_hellmaw.cpp | 30 - .../boss_blackheart_the_inciter.cpp | 27 +- .../shadow_labyrinth/boss_grandmaster_vorpil.cpp | 43 +- .../auchindoun/shadow_labyrinth/boss_murmur.cpp | 29 +- .../shadow_labyrinth/def_shadow_labyrinth.h | 2 - .../shadow_labyrinth/instance_shadow_labyrinth.cpp | 42 +- .../scripts/outland/black_temple/black_temple.cpp | 12 - .../outland/black_temple/boss_bloodboil.cpp | 52 +- .../scripts/outland/black_temple/boss_illidan.cpp | 275 +- .../outland/black_temple/boss_mother_shahraz.cpp | 46 +- .../black_temple/boss_reliquary_of_souls.cpp | 99 +- .../outland/black_temple/boss_shade_of_akama.cpp | 118 +- .../scripts/outland/black_temple/boss_supremus.cpp | 42 +- .../outland/black_temple/boss_teron_gorefiend.cpp | 80 +- .../outland/black_temple/boss_warlord_najentus.cpp | 31 +- .../outland/black_temple/def_black_temple.h | 3 - .../outland/black_temple/illidari_council.cpp | 153 +- .../outland/black_temple/instance_black_temple.cpp | 41 +- .../scripts/outland/blades_edge_mountains.cpp | 69 - .../scripts/outland/boss_doomlord_kazzak.cpp | 25 - .../scripts/scripts/outland/boss_doomwalker.cpp | 31 - .../serpent_shrine/boss_fathomlord_karathress.cpp | 119 +- .../serpent_shrine/boss_hydross_the_unstable.cpp | 52 +- .../serpent_shrine/boss_lady_vashj.cpp | 155 +- .../serpent_shrine/boss_leotheras_the_blind.cpp | 120 +- .../serpent_shrine/boss_lurker_below.cpp | 78 +- .../serpent_shrine/boss_morogrim_tidewalker.cpp | 55 +- .../serpent_shrine/def_serpent_shrine.h | 1 - .../serpent_shrine/instance_serpent_shrine.cpp | 44 +- .../steam_vault/boss_hydromancer_thespia.cpp | 33 - .../steam_vault/boss_mekgineer_steamrigger.cpp | 46 - .../steam_vault/boss_warlord_kalithresh.cpp | 36 - .../steam_vault/def_steam_vault.h | 3 - .../steam_vault/instance_steam_vault.cpp | 38 +- .../coilfang_resevoir/underbog/boss_hungarfen.cpp | 27 - .../underbog/boss_the_black_stalker.cpp | 22 +- .../scripts/outland/gruuls_lair/boss_gruul.cpp | 40 - .../outland/gruuls_lair/boss_high_king_maulgar.cpp | 139 +- .../scripts/outland/gruuls_lair/def_gruuls_lair.h | 3 - .../outland/gruuls_lair/instance_gruuls_lair.cpp | 30 +- .../blood_furnace/boss_broggok.cpp | 20 - .../blood_furnace/boss_kelidan_the_breaker.cpp | 65 +- .../blood_furnace/boss_the_maker.cpp | 28 - .../blood_furnace/def_blood_furnace.h | 2 - .../blood_furnace/instance_blood_furnace.cpp | 36 +- .../hellfire_ramparts/boss_omor_the_unscarred.cpp | 30 - .../hellfire_ramparts/boss_vazruden_the_herald.cpp | 53 - .../boss_watchkeeper_gargolmar.cpp | 25 - .../hellfire_ramparts/def_hellfire_ramparts.h | 4 - .../instance_hellfire_ramparts.cpp | 11 - .../magtheridons_lair/boss_magtheridon.cpp | 93 +- .../magtheridons_lair/def_magtheridons_lair.h | 2 - .../instance_magtheridons_lair.cpp | 35 +- .../shattered_halls/boss_nethekurse.cpp | 68 - .../shattered_halls/boss_warbringer_omrogg.cpp | 74 - .../boss_warchief_kargath_bladefist.cpp | 44 +- .../shattered_halls/def_shattered_halls.h | 3 - .../shattered_halls/instance_shattered_halls.cpp | 15 - .../scripts/scripts/outland/hellfire_peninsula.cpp | 79 - src/bindings/scripts/scripts/outland/nagrand.cpp | 138 - .../scripts/scripts/outland/netherstorm.cpp | 122 - .../scripts/scripts/outland/shadowmoon_valley.cpp | 293 +- .../scripts/scripts/outland/shattrath_city.cpp | 96 - .../outland/tempest_keep/arcatraz/arcatraz.cpp | 65 - .../arcatraz/boss_harbinger_skyriss.cpp | 53 - .../outland/tempest_keep/arcatraz/def_arcatraz.h | 2 - .../tempest_keep/arcatraz/instance_arcatraz.cpp | 33 +- .../botanica/boss_high_botanist_freywinn.cpp | 36 +- .../outland/tempest_keep/botanica/boss_laj.cpp | 23 - .../tempest_keep/botanica/boss_warp_splinter.cpp | 40 +- .../outland/tempest_keep/the_eye/boss_alar.cpp | 60 +- .../tempest_keep/the_eye/boss_astromancer.cpp | 75 +- .../outland/tempest_keep/the_eye/boss_kaelthas.cpp | 266 +- .../tempest_keep/the_eye/boss_void_reaver.cpp | 35 +- .../outland/tempest_keep/the_eye/def_the_eye.h | 2 - .../tempest_keep/the_eye/instance_the_eye.cpp | 25 +- .../outland/tempest_keep/the_eye/the_eye.cpp | 18 - .../the_mechanar/boss_gatewatcher_gyrokill.cpp | 4 - .../the_mechanar/boss_gatewatcher_ironhand.cpp | 20 - .../the_mechanar/boss_nethermancer_sepethrea.cpp | 41 - .../the_mechanar/boss_pathaleon_the_calculator.cpp | 42 +- .../tempest_keep/the_mechanar/def_mechanar.h | 1 - .../the_mechanar/instance_mechanar.cpp | 16 +- .../scripts/scripts/outland/terokkar_forest.cpp | 105 +- .../scripts/scripts/outland/zangarmarsh.cpp | 62 - .../scripts/scripts/world/areatrigger_scripts.cpp | 15 - .../scripts/scripts/world/boss_emeriss.cpp | 19 - src/bindings/scripts/scripts/world/boss_lethon.cpp | 2 - src/bindings/scripts/scripts/world/boss_taerar.cpp | 44 +- .../scripts/scripts/world/boss_ysondre.cpp | 37 +- src/bindings/scripts/scripts/world/go_scripts.cpp | 116 - src/bindings/scripts/scripts/world/guards.cpp | 215 -- .../scripts/scripts/world/item_scripts.cpp | 38 - .../scripts/scripts/world/mob_generic_creature.cpp | 41 - .../scripts/scripts/world/npc_innkeeper.cpp | 12 - .../scripts/scripts/world/npc_professions.cpp | 119 +- src/bindings/scripts/scripts/world/npc_taxi.cpp | 15 - .../scripts/scripts/world/npcs_special.cpp | 297 +- src/bindings/scripts/system/ScriptLoader.cpp | 23 - src/bindings/scripts/system/ScriptLoader.h | 3 - src/bindings/scripts/system/system.cpp | 47 - src/bindings/scripts/system/system.h | 24 - src/bindings/scripts/trinityscripts.rc | 9 - src/framework/Dynamic/FactoryHolder.h | 7 - src/framework/Dynamic/ObjectRegistry.h | 13 - src/framework/GameSystem/Grid.h | 22 - src/framework/GameSystem/GridLoader.h | 6 - src/framework/GameSystem/GridRefManager.h | 6 - src/framework/GameSystem/GridReference.h | 4 - src/framework/GameSystem/NGrid.h | 26 - src/framework/GameSystem/TypeContainer.h | 18 - src/framework/GameSystem/TypeContainerFunctions.h | 26 - src/framework/GameSystem/TypeContainerVisitor.h | 19 - src/framework/Network/SocketDefines.h | 7 - src/framework/Platform/CompilerDefs.h | 6 - src/framework/Platform/Define.h | 20 - src/framework/Policies/CreationPolicy.h | 9 - src/framework/Policies/ObjectLifeTime.cpp | 3 - src/framework/Policies/ObjectLifeTime.h | 8 - src/framework/Policies/Singleton.h | 9 - src/framework/Policies/SingletonImp.h | 10 - src/framework/Policies/ThreadingModel.h | 23 - src/framework/Utilities/ByteConverter.h | 10 - src/framework/Utilities/Callback.h | 35 - .../Utilities/CountedReference/Reference.h | 17 - .../Utilities/CountedReference/ReferenceHolder.h | 3 - .../Utilities/CountedReference/ReferenceImpl.h | 13 - src/framework/Utilities/EventProcessor.cpp | 13 - src/framework/Utilities/EventProcessor.h | 13 - src/framework/Utilities/LinkedList.h | 42 - .../Utilities/LinkedReference/RefManager.h | 7 - .../Utilities/LinkedReference/Reference.h | 15 - src/framework/Utilities/TypeList.h | 5 - src/framework/Utilities/UnorderedMap.h | 7 - src/game/AccountMgr.cpp | 51 - src/game/AccountMgr.h | 10 - src/game/AchievementMgr.cpp | 264 -- src/game/AchievementMgr.h | 38 - src/game/AnimalRandomMovementGenerator.h | 2 - src/game/ArenaTeam.cpp | 90 - src/game/ArenaTeam.h | 37 - src/game/ArenaTeamHandler.cpp | 85 - src/game/AuctionHouseBot.cpp | 172 - src/game/AuctionHouseBot.h | 34 - src/game/AuctionHouseHandler.cpp | 99 - src/game/AuctionHouseMgr.cpp | 114 - src/game/AuctionHouseMgr.h | 33 - src/game/Bag.cpp | 43 - src/game/Bag.h | 15 - src/game/BattleGround.cpp | 258 -- src/game/BattleGround.h | 88 - src/game/BattleGroundAA.cpp | 14 - src/game/BattleGroundAA.h | 6 - src/game/BattleGroundAB.cpp | 82 - src/game/BattleGroundAB.h | 37 - src/game/BattleGroundAV.cpp | 93 - src/game/BattleGroundAV.h | 111 - src/game/BattleGroundBE.cpp | 36 - src/game/BattleGroundBE.h | 9 - src/game/BattleGroundDS.cpp | 14 - src/game/BattleGroundDS.h | 6 - src/game/BattleGroundEY.cpp | 120 - src/game/BattleGroundEY.h | 43 - src/game/BattleGroundHandler.cpp | 106 - src/game/BattleGroundMgr.cpp | 201 -- src/game/BattleGroundMgr.h | 44 - src/game/BattleGroundNA.cpp | 30 - src/game/BattleGroundNA.h | 8 - src/game/BattleGroundRL.cpp | 30 - src/game/BattleGroundRL.h | 8 - src/game/BattleGroundRV.cpp | 14 - src/game/BattleGroundRV.h | 6 - src/game/BattleGroundSA.cpp | 15 - src/game/BattleGroundSA.h | 9 - src/game/BattleGroundWS.cpp | 80 - src/game/BattleGroundWS.h | 23 - src/game/Calendar.h | 3 - src/game/CalendarHandler.cpp | 40 - src/game/Cell.h | 25 - src/game/CellImpl.h | 36 - src/game/Channel.cpp | 155 +- src/game/Channel.h | 22 - src/game/ChannelHandler.cpp | 59 - src/game/ChannelMgr.cpp | 17 - src/game/ChannelMgr.h | 9 - src/game/CharacterHandler.cpp | 246 -- src/game/Chat.cpp | 312 +- src/game/Chat.h | 83 - src/game/ChatHandler.cpp | 120 - src/game/CombatAI.cpp | 40 - src/game/CombatAI.h | 14 - src/game/CombatHandler.cpp | 15 - src/game/ConfusedMovementGenerator.cpp | 27 +- src/game/ConfusedMovementGenerator.h | 7 - src/game/Corpse.cpp | 48 - src/game/Corpse.h | 18 - src/game/Creature.cpp | 419 +-- src/game/Creature.h | 128 - src/game/CreatureAI.cpp | 23 - src/game/CreatureAI.h | 51 +- src/game/CreatureAIFactory.h | 7 - src/game/CreatureAIImpl.h | 60 - src/game/CreatureAIRegistry.cpp | 3 - src/game/CreatureAIRegistry.h | 2 - src/game/CreatureAISelector.cpp | 15 - src/game/CreatureAISelector.h | 3 - src/game/CreatureEventAI.cpp | 171 - src/game/CreatureEventAI.h | 41 - src/game/CreatureEventAIMgr.cpp | 73 +- src/game/CreatureEventAIMgr.h | 7 - src/game/CreatureGroups.cpp | 48 +- src/game/CreatureGroups.h | 21 +- src/game/DBCEnums.h | 22 - src/game/DBCStores.cpp | 109 - src/game/DBCStores.h | 16 - src/game/DBCStructure.h | 183 -- src/game/DBCfmt.h | 3 - src/game/Debugcmds.cpp | 178 -- src/game/DestinationHolder.cpp | 1 - src/game/DestinationHolder.h | 9 - src/game/DestinationHolderImp.h | 24 - src/game/DuelHandler.cpp | 15 - src/game/DynamicObject.cpp | 24 - src/game/DynamicObject.h | 8 - src/game/FleeingMovementGenerator.cpp | 51 - src/game/FleeingMovementGenerator.h | 13 - src/game/FollowerRefManager.h | 5 - src/game/FollowerReference.cpp | 4 - src/game/FollowerReference.h | 4 - src/game/Formulas.h | 13 - src/game/GameEventMgr.cpp | 235 -- src/game/GameEventMgr.h | 15 - src/game/GameObject.cpp | 241 +- src/game/GameObject.h | 54 - src/game/GlobalEvents.cpp | 11 - src/game/GlobalEvents.h | 3 - src/game/GossipDef.cpp | 130 - src/game/GossipDef.h | 35 - src/game/GridDefines.h | 35 - src/game/GridNotifiers.cpp | 35 - src/game/GridNotifiers.h | 192 -- src/game/GridNotifiersImpl.h | 112 - src/game/GridStates.cpp | 5 - src/game/GridStates.h | 11 - src/game/Group.cpp | 238 -- src/game/Group.h | 55 - src/game/GroupHandler.cpp | 152 - src/game/GroupRefManager.h | 4 - src/game/GroupReference.cpp | 4 - src/game/GroupReference.h | 4 - src/game/GuardAI.cpp | 19 - src/game/GuardAI.h | 9 - src/game/Guild.cpp | 401 --- src/game/Guild.h | 59 - src/game/GuildHandler.cpp | 278 -- src/game/HomeMovementGenerator.cpp | 14 - src/game/HomeMovementGenerator.h | 10 - src/game/HostilRefManager.cpp | 20 - src/game/HostilRefManager.h | 14 - src/game/IdleMovementGenerator.cpp | 19 +- src/game/IdleMovementGenerator.h | 14 - src/game/InstanceData.cpp | 42 +- src/game/InstanceData.h | 35 - src/game/InstanceSaveMgr.cpp | 76 - src/game/InstanceSaveMgr.h | 25 - src/game/Item.cpp | 159 +- src/game/Item.h | 39 - src/game/ItemEnchantmentMgr.cpp | 30 - src/game/ItemEnchantmentMgr.h | 3 - src/game/ItemHandler.cpp | 214 -- src/game/ItemPrototype.h | 68 - src/game/LFGHandler.cpp | 88 - src/game/Language.h | 84 - src/game/Level0.cpp | 45 - src/game/Level1.cpp | 495 --- src/game/Level2.cpp | 796 +---- src/game/Level3.cpp | 1130 ------- src/game/LootHandler.cpp | 85 - src/game/LootMgr.cpp | 191 -- src/game/LootMgr.h | 64 - src/game/Mail.cpp | 150 - src/game/Mail.h | 23 - src/game/Map.cpp | 518 --- src/game/Map.h | 123 - src/game/MapInstanced.cpp | 35 - src/game/MapInstanced.h | 14 - src/game/MapManager.cpp | 50 - src/game/MapManager.h | 29 - src/game/MapRefManager.h | 6 - src/game/MapReference.h | 3 - src/game/MiscHandler.cpp | 302 +- src/game/MotionMaster.cpp | 67 - src/game/MotionMaster.h | 24 - src/game/MovementGenerator.cpp | 2 - src/game/MovementGenerator.h | 15 - src/game/MovementHandler.cpp | 108 +- src/game/NPCHandler.cpp | 169 - src/game/NPCHandler.h | 11 - src/game/Object.cpp | 338 +- src/game/Object.h | 116 - src/game/ObjectAccessor.cpp | 74 - src/game/ObjectAccessor.h | 51 - src/game/ObjectDefines.h | 13 - src/game/ObjectGridLoader.cpp | 47 - src/game/ObjectGridLoader.h | 20 - src/game/ObjectMgr.cpp | 1463 +-------- src/game/ObjectMgr.h | 169 +- src/game/Opcodes.cpp | 3 - src/game/Opcodes.h | 10 - src/game/OutdoorPvP.cpp | 84 - src/game/OutdoorPvP.h | 53 - src/game/OutdoorPvPEP.cpp | 73 - src/game/OutdoorPvPEP.h | 37 - src/game/OutdoorPvPHP.cpp | 28 - src/game/OutdoorPvPHP.h | 22 - src/game/OutdoorPvPImpl.h | 3 - src/game/OutdoorPvPMgr.cpp | 26 - src/game/OutdoorPvPMgr.h | 15 - src/game/OutdoorPvPNA.cpp | 55 - src/game/OutdoorPvPNA.h | 41 - src/game/OutdoorPvPSI.cpp | 13 - src/game/OutdoorPvPSI.h | 14 - src/game/OutdoorPvPTF.cpp | 34 - src/game/OutdoorPvPTF.h | 19 - src/game/OutdoorPvPZM.cpp | 35 - src/game/OutdoorPvPZM.h | 27 - src/game/PassiveAI.h | 16 - src/game/Path.h | 10 - src/game/Pet.cpp | 302 +- src/game/Pet.h | 45 - src/game/PetAI.cpp | 75 - src/game/PetAI.h | 12 - src/game/PetHandler.cpp | 122 - src/game/PetitionsHandler.cpp | 132 - src/game/Player.cpp | 3380 +------------------- src/game/Player.h | 402 +-- src/game/PlayerDump.cpp | 101 - src/game/PlayerDump.h | 19 - src/game/PointMovementGenerator.cpp | 14 - src/game/PointMovementGenerator.h | 10 - src/game/PoolHandler.cpp | 84 - src/game/PoolHandler.h | 11 - src/game/QueryHandler.cpp | 54 - src/game/QuestDef.cpp | 32 - src/game/QuestDef.h | 29 - src/game/QuestHandler.cpp | 100 - src/game/RandomMovementGenerator.cpp | 31 - src/game/RandomMovementGenerator.h | 5 - src/game/ReactorAI.cpp | 7 - src/game/ReactorAI.h | 7 - src/game/ReputationMgr.cpp | 102 +- src/game/ReputationMgr.h | 22 - src/game/ScriptCalls.cpp | 14 - src/game/ScriptCalls.h | 11 - src/game/SharedDefines.h | 131 - src/game/SkillDiscovery.cpp | 44 - src/game/SkillDiscovery.h | 4 - src/game/SkillExtraItems.cpp | 28 - src/game/SkillExtraItems.h | 3 - src/game/SkillHandler.cpp | 15 - src/game/SocialMgr.cpp | 48 - src/game/SocialMgr.h | 15 - src/game/Spell.cpp | 875 +---- src/game/Spell.h | 100 - src/game/SpellAuraDefines.h | 5 - src/game/SpellAuras.cpp | 753 +---- src/game/SpellAuras.h | 48 +- src/game/SpellEffects.cpp | 862 +---- src/game/SpellHandler.cpp | 111 +- src/game/SpellMgr.cpp | 500 +-- src/game/SpellMgr.h | 187 -- src/game/StatSystem.cpp | 175 - src/game/TargetedMovementGenerator.cpp | 33 - src/game/TargetedMovementGenerator.h | 11 - src/game/TaxiHandler.cpp | 56 - src/game/TemporarySummon.cpp | 52 - src/game/TemporarySummon.h | 10 - src/game/ThreatManager.cpp | 84 - src/game/ThreatManager.h | 64 - src/game/TicketHandler.cpp | 27 +- src/game/Totem.cpp | 23 +- src/game/Totem.h | 8 - src/game/TotemAI.cpp | 17 - src/game/TotemAI.h | 8 - src/game/TradeHandler.cpp | 83 - src/game/Transports.cpp | 96 - src/game/Transports.h | 17 - src/game/Traveller.h | 19 - src/game/Unit.cpp | 1801 +---------- src/game/Unit.h | 274 +- src/game/UnitAI.cpp | 40 - src/game/UnitAI.h | 19 - src/game/UnitEvents.h | 36 - src/game/UpdateData.cpp | 26 - src/game/UpdateData.h | 9 - src/game/UpdateFields.h | 10 - src/game/UpdateMask.h | 23 - src/game/Vehicle.cpp | 47 +- src/game/Vehicle.h | 13 - src/game/VoiceChatHandler.cpp | 4 - src/game/WaypointManager.cpp | 32 - src/game/WaypointManager.h | 10 - src/game/WaypointMovementGenerator.cpp | 93 - src/game/WaypointMovementGenerator.h | 18 - src/game/Weather.cpp | 37 - src/game/Weather.h | 7 - src/game/Wintergrasp.cpp | 153 - src/game/Wintergrasp.h | 50 - src/game/World.cpp | 423 +-- src/game/World.h | 76 +- src/game/WorldLog.cpp | 18 - src/game/WorldLog.h | 10 - src/game/WorldSession.cpp | 135 +- src/game/WorldSession.h | 119 - src/game/WorldSocket.cpp | 204 +- src/game/WorldSocket.h | 48 - src/game/WorldSocketMgr.cpp | 80 - src/game/WorldSocketMgr.h | 17 - src/game/ZoneScript.h | 12 +- src/game/pchdef.h | 1 - src/shared/Auth/AuthCrypt.cpp | 17 - src/shared/Auth/AuthCrypt.h | 7 - src/shared/Auth/BigNumber.cpp | 39 - src/shared/Auth/BigNumber.h | 15 - src/shared/Auth/Hmac.cpp | 8 - src/shared/Auth/Hmac.h | 5 - src/shared/Auth/SARC4.cpp | 6 - src/shared/Auth/SARC4.h | 3 - src/shared/Auth/Sha1.cpp | 9 - src/shared/Auth/Sha1.h | 9 - src/shared/ByteBuffer.h | 88 - src/shared/Common.cpp | 4 - src/shared/Common.h | 32 - src/shared/Config/Config.cpp | 14 - src/shared/Config/Config.h | 9 - src/shared/Config/ConfigEnv.h | 4 - src/shared/Config/dotconfpp/dotconfpp.cpp | 76 - src/shared/Config/dotconfpp/dotconfpp.h | 18 - src/shared/Config/dotconfpp/mempool.cpp | 15 - src/shared/Config/dotconfpp/mempool.h | 10 - src/shared/Database/DBCFileLoader.cpp | 42 - src/shared/Database/DBCFileLoader.h | 12 - src/shared/Database/DBCStore.h | 24 - src/shared/Database/Database.cpp | 42 - src/shared/Database/Database.h | 22 - src/shared/Database/DatabaseEnv.h | 6 - src/shared/Database/DatabaseImpl.h | 27 - src/shared/Database/DatabaseMysql.cpp | 70 - src/shared/Database/DatabaseMysql.h | 14 - src/shared/Database/Field.cpp | 10 - src/shared/Database/Field.h | 10 - src/shared/Database/MySQLDelayThread.h | 3 - src/shared/Database/QueryResult.h | 15 - src/shared/Database/QueryResultMysql.cpp | 15 - src/shared/Database/QueryResultMysql.h | 8 - src/shared/Database/SQLStorage.cpp | 8 - src/shared/Database/SQLStorage.h | 19 - src/shared/Database/SQLStorageImpl.h | 20 - src/shared/Database/SqlDelayThread.cpp | 6 - src/shared/Database/SqlDelayThread.h | 8 - src/shared/Database/SqlOperations.cpp | 26 - src/shared/Database/SqlOperations.h | 15 - src/shared/Errors.h | 7 - src/shared/LockedQueue.h | 18 - src/shared/Log.cpp | 166 - src/shared/Log.h | 28 +- src/shared/ProgressBar.cpp | 8 - src/shared/ProgressBar.h | 5 - src/shared/ServiceWin32.cpp | 41 - src/shared/ServiceWin32.h | 3 - src/shared/SystemConfig.h | 7 - src/shared/Threading.cpp | 53 +- src/shared/Threading.h | 19 - src/shared/Timer.h | 12 - src/shared/Util.cpp | 74 - src/shared/Util.h | 72 - src/shared/WheatyExceptionReport.cpp | 131 - src/shared/WheatyExceptionReport.h | 18 - src/shared/WorldPacket.h | 6 - src/shared/vmap/AABSPTree.h | 288 -- src/shared/vmap/BaseModel.cpp | 17 - src/shared/vmap/BaseModel.h | 24 - src/shared/vmap/CoordModelMapping.cpp | 25 - src/shared/vmap/CoordModelMapping.h | 27 - src/shared/vmap/DebugCmdLogger.cpp | 10 - src/shared/vmap/DebugCmdLogger.h | 14 - src/shared/vmap/IVMapManager.h | 18 - src/shared/vmap/ManagedModelContainer.cpp | 6 - src/shared/vmap/ManagedModelContainer.h | 7 - src/shared/vmap/ModelContainer.cpp | 66 - src/shared/vmap/ModelContainer.h | 29 - src/shared/vmap/NodeValueAccess.h | 7 - src/shared/vmap/ShortBox.h | 21 - src/shared/vmap/ShortVector.h | 15 - src/shared/vmap/SubModel.cpp | 41 - src/shared/vmap/SubModel.h | 19 - src/shared/vmap/TileAssembler.cpp | 87 - src/shared/vmap/TileAssembler.h | 13 - src/shared/vmap/TreeNode.cpp | 5 - src/shared/vmap/TreeNode.h | 34 - src/shared/vmap/VMapDefinitions.h | 4 - src/shared/vmap/VMapFactory.cpp | 12 - src/shared/vmap/VMapFactory.h | 7 - src/shared/vmap/VMapManager.cpp | 60 - src/shared/vmap/VMapManager.h | 29 - src/shared/vmap/VMapTools.h | 20 - src/tools/genrevision/genrevision.cpp | 58 - src/trinitycore/CliRunnable.cpp | 66 - src/trinitycore/CliRunnable.h | 3 - src/trinitycore/Main.cpp | 18 - src/trinitycore/Master.cpp | 87 +- src/trinitycore/Master.h | 8 - src/trinitycore/RASocket.cpp | 42 - src/trinitycore/RASocket.h | 12 - src/trinitycore/TrinityCore.rc | 9 - src/trinitycore/WorldRunnable.cpp | 18 - src/trinitycore/WorldRunnable.h | 3 - src/trinitycore/resource.h | 1 - src/trinityrealm/AuthCodes.h | 7 - src/trinityrealm/AuthSocket.cpp | 163 - src/trinityrealm/AuthSocket.h | 15 - src/trinityrealm/Main.cpp | 48 - src/trinityrealm/RealmList.cpp | 19 - src/trinityrealm/RealmList.h | 10 - src/trinityrealm/TrinityRealm.rc | 9 - 949 files changed, 731 insertions(+), 53534 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 0b48f5f7cef..7d38c82a278 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1,7 +1,6 @@ /* Copyright (C) 2006 - 2008 TrinityScript * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #include "precompiled.h" #include "Config/Config.h" #include "Database/DatabaseEnv.h" @@ -10,39 +9,30 @@ #include "ProgressBar.h" #include "../system/ScriptLoader.h" #include "../system/system.h" - #define _FULLVERSION "TrinityScript" - #ifndef _TRINITY_SCRIPT_CONFIG # define _TRINITY_SCRIPT_CONFIG "trinitycore.conf" #endif _TRINITY_SCRIPT_CONFIG - int num_sc_scripts; Script *m_scripts[MAX_SCRIPTS]; - Config TScriptConfig; - void FillSpellSummary(); void LoadOverridenSQLData(); void LoadOverridenDBCData(); - void LoadDatabase() { //Get db string from file std::string dbstring = TScriptConfig.GetStringDefault("WorldDatabaseInfo", ""); - if (dbstring.empty()) { error_log("TSCR: Missing world database info from configuration file. Load database aborted."); return; } - //Initialize connection to DB if (!dbstring.empty() && TScriptDB.Initialize(dbstring.c_str())) { outstring_log("TSCR: TrinityScript database initialized successfully."); outstring_log(""); - pSystemMgr.LoadVersion(); pSystemMgr.LoadScriptTexts(); pSystemMgr.LoadScriptTextsCustom(); @@ -53,29 +43,22 @@ void LoadDatabase() error_log("TSCR: Unable to connect to database at %s. Load database aborted.", dbstring.c_str()); return; } - TScriptDB.HaltDelayThread(); - } - struct TSpellSummary { uint8 Targets; // set of enum SelectTarget uint8 Effects; // set of enum SelectEffect }extern *SpellSummary; - TRINITY_DLL_EXPORT void ScriptsFree() { // Free Spell Summary delete []SpellSummary; - // Free resources before library unload - for(uint16 i =0;i> Loaded %i C++ Scripts.", num_sc_scripts); - outstring_log(">> Load Overriden SQL Data."); LoadOverridenSQLData(); outstring_log(">> Load Overriden DBC Data."); LoadOverridenDBCData(); } - //********************************* //*** Functions used globally *** - void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) { if (!pSource) @@ -130,23 +102,18 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) error_log("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry); return; } - if (iTextEntry >= 0) { error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - const StringTextData* pData = pSystemMgr.GetTextData(iTextEntry); - if (!pData) { error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); - if(pData->uiSoundId) { if(GetSoundEntriesStore()->LookupEntry(pData->uiSoundId)) @@ -156,7 +123,6 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) else error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); } - if(pData->uiEmote) { if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) @@ -164,7 +130,6 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) else error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); } - switch(pData->uiType) { case CHAT_TYPE_SAY: @@ -198,10 +163,8 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) break; } } - //********************************* //*** Functions used internally *** - void Script::RegisterSelf() { int id = GetScriptId(Name.c_str()); @@ -216,10 +179,8 @@ void Script::RegisterSelf() delete this; } } - //******************************** //*** Functions to be Exported *** - TRINITY_DLL_EXPORT void OnLogin(Player *pPlayer) { @@ -227,7 +188,6 @@ void OnLogin(Player *pPlayer) if (!tmpscript || !tmpscript->pOnLogin) return; tmpscript->pOnLogin(pPlayer); } - TRINITY_DLL_EXPORT void OnLogout(Player *pPlayer) { @@ -235,7 +195,6 @@ void OnLogout(Player *pPlayer) if (!tmpscript || !tmpscript->pOnLogout) return; tmpscript->pOnLogout(pPlayer); } - TRINITY_DLL_EXPORT void OnPVPKill(Player *killer, Player *killed) { @@ -243,7 +202,6 @@ void OnPVPKill(Player *killer, Player *killed) if (!tmpscript || !tmpscript->pOnPVPKill) return; tmpscript->pOnPVPKill(killer, killed); } - TRINITY_DLL_EXPORT bool OnSpellCast (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell) { @@ -251,7 +209,6 @@ bool OnSpellCast (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, u if (!tmpscript || !tmpscript->pOnSpellCast) return true; return tmpscript->pOnSpellCast(pUnitTarget,pItemTarget,pGoTarget,i,spell); } - TRINITY_DLL_EXPORT uint32 OnGetXP(Player *pPlayer, uint32 amount) { @@ -259,7 +216,6 @@ uint32 OnGetXP(Player *pPlayer, uint32 amount) if (!tmpscript || !tmpscript->pOnGetXP) return amount; return tmpscript->pOnGetXP(pPlayer,amount); } - TRINITY_DLL_EXPORT uint32 OnGetMoney(Player *pPlayer, int32 amount) { @@ -267,7 +223,6 @@ uint32 OnGetMoney(Player *pPlayer, int32 amount) if (!tmpscript || !tmpscript->pOnGetMoney) return amount; return tmpscript->pOnGetMoney(pPlayer,amount); } - TRINITY_DLL_EXPORT bool OnPlayerChat(Player *pPlayer, const char *text) { @@ -275,7 +230,6 @@ bool OnPlayerChat(Player *pPlayer, const char *text) if (!tmpscript || !tmpscript->pOnPlayerChat) return true; return tmpscript->pOnPlayerChat(pPlayer,text); } - TRINITY_DLL_EXPORT void OnServerStartup() { @@ -283,7 +237,6 @@ void OnServerStartup() if (!tmpscript || !tmpscript->pOnServerStartup) return; tmpscript->pOnServerStartup(); } - TRINITY_DLL_EXPORT void OnServerShutdown() { @@ -291,7 +244,6 @@ void OnServerShutdown() if (!tmpscript || !tmpscript->pOnServerShutdown) return; tmpscript->pOnServerShutdown(); } - TRINITY_DLL_EXPORT void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea) { @@ -299,7 +251,6 @@ void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea) if (!tmpscript || !tmpscript->pOnAreaChange) return; tmpscript->pOnAreaChange(pPlayer, pArea); } - TRINITY_DLL_EXPORT bool OnItemClick (Player *pPlayer, Item *pItem) { @@ -307,7 +258,6 @@ bool OnItemClick (Player *pPlayer, Item *pItem) if (!tmpscript || !tmpscript->pOnItemClick) return true; return tmpscript->pOnItemClick(pPlayer,pItem); } - TRINITY_DLL_EXPORT bool OnItemOpen (Player *pPlayer, Item *pItem) { @@ -315,7 +265,6 @@ bool OnItemOpen (Player *pPlayer, Item *pItem) if (!tmpscript || !tmpscript->pOnItemOpen) return true; return tmpscript->pOnItemOpen(pPlayer,pItem); } - TRINITY_DLL_EXPORT bool OnGoClick (Player *pPlayer, GameObject *pGameObject) { @@ -323,7 +272,6 @@ bool OnGoClick (Player *pPlayer, GameObject *pGameObject) if (!tmpscript || !tmpscript->pOnGoClick) return true; return tmpscript->pOnGoClick(pPlayer,pGameObject); } - TRINITY_DLL_EXPORT void OnCreatureKill (Player *pPlayer, Creature *pCreature) { @@ -331,259 +279,202 @@ void OnCreatureKill (Player *pPlayer, Creature *pCreature) if (!tmpscript || !tmpscript->pOnCreatureKill) return; tmpscript->pOnCreatureKill(pPlayer,pCreature); } - TRINITY_DLL_EXPORT char const* ScriptsVersion() { return "Default Trinity scripting library"; } - TRINITY_DLL_EXPORT bool GossipHello (Player * pPlayer, Creature* pCreature) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipHello) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGossipHello(pPlayer, pCreature); } - TRINITY_DLL_EXPORT bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelect) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGossipSelect(pPlayer, pCreature, uiSender, uiAction); } - TRINITY_DLL_EXPORT bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) { debug_log("TSCR: Gossip selection with code, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGossipSelectWithCode(pPlayer, pCreature, uiSender, uiAction, sCode); } - TRINITY_DLL_EXPORT bool GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction) { if(!pGO) return false; debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if(!tmpscript || !tmpscript->pGOSelect) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGOSelect(pPlayer, pGO, uiSender, uiAction); } - TRINITY_DLL_EXPORT bool GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction, const char* sCode) { if(!pGO) return false; debug_log("TSCR: Gossip selection, sender: %d, action: %d",uiSender, uiAction); - Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if(!tmpscript || !tmpscript->pGOSelectWithCode) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGOSelectWithCode(pPlayer, pGO, uiSender ,uiAction, sCode); } - TRINITY_DLL_EXPORT bool QuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestAccept) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pQuestAccept(pPlayer, pCreature, pQuest); } - TRINITY_DLL_EXPORT bool QuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestSelect) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pQuestSelect(pPlayer, pCreature, pQuest); } - TRINITY_DLL_EXPORT bool QuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestComplete) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pQuestComplete(pPlayer, pCreature, pQuest); } - TRINITY_DLL_EXPORT bool ChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pChooseReward) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pChooseReward(pPlayer, pCreature, pQuest, opt); } - TRINITY_DLL_EXPORT uint32 NPCDialogStatus(Player* pPlayer, Creature* pCreature) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pNPCDialogStatus(pPlayer, pCreature); } - TRINITY_DLL_EXPORT uint32 GODialogStatus(Player* pPlayer, GameObject* pGO) { Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGODialogStatus) return 100; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGODialogStatus(pPlayer, pGO); } - TRINITY_DLL_EXPORT bool ItemHello(Player* pPlayer, Item* pItem, Quest const* pQuest) { Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemHello) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pItemHello(pPlayer, pItem, pQuest); } - TRINITY_DLL_EXPORT bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest) { Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemQuestAccept) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pItemQuestAccept(pPlayer, pItem, pQuest); } - TRINITY_DLL_EXPORT bool GOHello(Player* pPlayer, GameObject* pGO) { Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOHello) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGOHello(pPlayer, pGO); } - TRINITY_DLL_EXPORT bool GOQuestAccept(Player* pPlayer, GameObject* pGO, Quest const* pQuest) { Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOQuestAccept) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGOQuestAccept(pPlayer, pGO, pQuest); } - TRINITY_DLL_EXPORT bool GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQuest, uint32 opt) { Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOChooseReward) return false; - pPlayer->PlayerTalkClass->ClearMenus(); return tmpscript->pGOChooseReward(pPlayer, pGO, pQuest, opt); } - TRINITY_DLL_EXPORT bool AreaTrigger(Player* pPlayer, AreaTriggerEntry * atEntry) { Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)]; if (!tmpscript || !tmpscript->pAreaTrigger) return false; - return tmpscript->pAreaTrigger(pPlayer, atEntry); } - TRINITY_DLL_EXPORT CreatureAI* GetAI(Creature* pCreature) { Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->GetAI) return NULL; - return tmpscript->GetAI(pCreature); } - TRINITY_DLL_EXPORT bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemUse) return false; - return tmpscript->pItemUse(pPlayer, pItem, targets); } - TRINITY_DLL_EXPORT bool ItemExpire(Player* pPlayer, ItemPrototype const * pItemProto) { Script *tmpscript = m_scripts[pItemProto->ScriptId]; if (!tmpscript || !tmpscript->pItemExpire) return true; - return tmpscript->pItemExpire(pPlayer, pItemProto); } - TRINITY_DLL_EXPORT bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget) { Script *tmpscript = m_scripts[crTarget->GetScriptId()]; - if (!tmpscript || !tmpscript->pEffectDummyCreature) return false; - return tmpscript->pEffectDummyCreature(caster, spellId, effIndex, crTarget); } - TRINITY_DLL_EXPORT bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget) { Script *tmpscript = m_scripts[gameObjTarget->GetGOInfo()->ScriptId]; - if (!tmpscript || !tmpscript->pEffectDummyGameObj) return false; - return tmpscript->pEffectDummyGameObj(caster, spellId, effIndex, gameObjTarget); } - TRINITY_DLL_EXPORT bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget) { Script *tmpscript = m_scripts[itemTarget->GetProto()->ScriptId]; - if (!tmpscript || !tmpscript->pEffectDummyItem) return false; - return tmpscript->pEffectDummyItem(caster, spellId, effIndex, itemTarget); } - TRINITY_DLL_EXPORT InstanceData* CreateInstanceData(Map *map) { if (!map->IsDungeon()) return NULL; - Script *tmpscript = m_scripts[((InstanceMap*)map)->GetScriptId()]; if (!tmpscript || !tmpscript->GetInstanceData) return NULL; - return tmpscript->GetInstanceData(map); } diff --git a/src/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h index 9456a0da661..7e9ac9b89f2 100644 --- a/src/bindings/scripts/ScriptMgr.h +++ b/src/bindings/scripts/ScriptMgr.h @@ -4,14 +4,11 @@ * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_SCRIPTMGR_H #define SC_SCRIPTMGR_H - #include "Common.h" #include "Platform/CompilerDefs.h" #include "DBCStructure.h" - class Player; class Creature; class CreatureAI; @@ -24,11 +21,9 @@ class Map; class Unit; class WorldObject; struct ItemPrototype; - #define MAX_SCRIPTS 5000 //72 bytes each (approx 351kb) #define VISIBLE_RANGE (166.0f) //MAX visible range (size of grid) #define DEFAULT_TEXT "" - struct Script { Script() : @@ -39,9 +34,7 @@ struct Script pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL), GetAI(NULL), GetInstanceData(NULL) {} - std::string Name; - //Methods to be scripted void (*pOnLogin )(Player*); void (*pOnLogout )(Player*); @@ -79,22 +72,17 @@ struct Script bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* ); bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* ); bool (*pEffectDummyItem )(Unit*, uint32, uint32, Item* ); - CreatureAI* (*GetAI)(Creature*); InstanceData* (*GetInstanceData)(Map*); - void RegisterSelf(); }; - //Generic scripting text function void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); - #if COMPILER == COMPILER_GNU #define FUNC_PTR(name,callconvention,returntype,parameters) typedef returntype(*name)parameters __attribute__ ((callconvention)); #else #define FUNC_PTR(name, callconvention, returntype, parameters) typedef returntype(callconvention *name)parameters; #endif - #ifdef WIN32 #define TRINITY_DLL_EXPORT extern "C" __declspec(dllexport) #elif defined( __GNUC__ ) @@ -102,6 +90,5 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); #else #define TRINITY_DLL_EXPORT extern "C" export #endif - #endif diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 4d6083ab470..5c256aceb65 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -1,23 +1,19 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - /* ScriptData SDName: Npc_EscortAI SD%Complete: 100 SDComment: SDCategory: Npc EndScriptData */ - #include "precompiled.h" #include "escort_ai.h" - enum ePoints { POINT_LAST_POINT = 0xFFFFFF, POINT_HOME = 0xFFFFFE }; - npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), m_uiPlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), @@ -34,40 +30,32 @@ npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), m_bCanReturnToStart(false), ScriptWP(false) {} - void npc_escortAI::AttackStart(Unit* pWho) { if (!pWho) return; - if (m_creature->Attack(pWho, true)) { if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) m_creature->GetMotionMaster()->MovementExpired(); - if (IsCombatMovement()) m_creature->GetMotionMaster()->MoveChase(pWho); } } - //see followerAI bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) { if (!pWho || !pWho->getVictim()) return false; - //experimental (unknown) flag not present if (!(m_creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13)) return false; - //not a player if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; - //never attack friendly if (m_creature->IsFriendlyTo(pWho)) return false; - //too far away and no free sight? if (m_creature->IsWithinDistInMap(pWho, GetMaxPlayerDistance()) && m_creature->IsWithinLOSInMap(pWho)) { @@ -84,20 +72,16 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) return true; } } - return false; } - void npc_escortAI::MoveInLineOfSight(Unit* pWho) { if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(m_creature)) { if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho)) return; - if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) return; - if (m_creature->IsHostileTo(pWho)) { float fAttackRadius = m_creature->GetAttackDistance(pWho); @@ -117,17 +101,15 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho) } } } - void npc_escortAI::JustDied(Unit* pKiller) { if (!HasEscortState(STATE_ESCORT_ESCORTING) || !m_uiPlayerGUID || !m_pQuestForEscort) return; - if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { if (Player* pMember = pRef->getSource()) { @@ -143,37 +125,29 @@ void npc_escortAI::JustDied(Unit* pKiller) } } } - void npc_escortAI::JustRespawned() { m_uiEscortState = STATE_ESCORT_NONE; - if (!IsCombatMovement()) SetCombatMovement(true); - //add a small delay before going to first waypoint, normal in near all cases m_uiWPWaitTimer = 2500; - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) me->RestoreFaction(); - Reset(); } - void npc_escortAI::ReturnToLastPoint() { float x, y, z, o; m_creature->GetHomePosition(x, y, z, o); m_creature->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); } - void npc_escortAI::EnterEvadeMode() { m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); m_creature->SetLootRecipient(NULL); - if (HasEscortState(STATE_ESCORT_ESCORTING)) { AddEscortState(STATE_ESCORT_RETURNING); @@ -182,20 +156,17 @@ void npc_escortAI::EnterEvadeMode() } else m_creature->GetMotionMaster()->MoveTargetedHome(); - Reset(); } - bool npc_escortAI::IsPlayerOrGroupInRange() { if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { Player* pMember = pRef->getSource(); - if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) { return true; @@ -211,7 +182,6 @@ bool npc_escortAI::IsPlayerOrGroupInRange() } return false; } - void npc_escortAI::UpdateAI(const uint32 uiDiff) { //Waypoint Updating @@ -225,20 +195,15 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) if (DespawnAtEnd) { debug_log("TSCR: EscortAI reached end of waypoints"); - if (m_bCanReturnToStart) { float fRetX, fRetY, fRetZ; m_creature->GetRespawnCoord(fRetX, fRetY, fRetZ); - m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); - m_uiWPWaitTimer = 0; - debug_log("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); return; } - if (m_bCanInstantRespawn) { m_creature->setDeathState(JUST_DIED); @@ -246,31 +211,25 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } else m_creature->ForcedDespawn(); - return; } else { debug_log("TSCR: EscortAI reached end of waypoints with Despawn off"); - return; } } - if (!HasEscortState(STATE_ESCORT_PAUSED)) { m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - WaypointStart(CurrentWP->id); - m_uiWPWaitTimer = 0; } } else m_uiWPWaitTimer -= uiDiff; } - //Check if player or any member of his group is within range if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !m_creature->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING)) { @@ -279,7 +238,6 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) if (DespawnAtFar && !IsPlayerOrGroupInRange()) { debug_log("TSCR: EscortAI failed because player/group was to far away or not found"); - if (m_bCanInstantRespawn) { m_creature->setDeathState(JUST_DIED); @@ -287,49 +245,39 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } else m_creature->ForcedDespawn(); - return; } - m_uiPlayerCheckTimer = 1000; } else m_uiPlayerCheckTimer -= uiDiff; } - UpdateEscortAI(uiDiff); } - void npc_escortAI::UpdateEscortAI(const uint32 uiDiff) { if (CanMelee && UpdateVictim()) DoMeleeAttackIfReady(); } - void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) { if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING)) return; - //Combat start position reached, continue waypoint movement if (uiPointId == POINT_LAST_POINT) { debug_log("TSCR: EscortAI has returned to original position before combat"); - if (m_bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); else if (!m_bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - RemoveEscortState(STATE_ESCORT_RETURNING); - if (!m_uiWPWaitTimer) m_uiWPWaitTimer = 1; } else if (uiPointId == POINT_HOME) { debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); - CurrentWP = WaypointList.begin(); m_uiWPWaitTimer = 1; } @@ -341,18 +289,13 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u", uiPointId, CurrentWP->id); return; } - debug_log("TSCR: EscortAI Waypoint %u reached", CurrentWP->id); - //Call WP function WaypointReached(CurrentWP->id); - m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1; - ++CurrentWP; } } - /* void npc_escortAI::OnPossess(bool apply) { @@ -371,13 +314,10 @@ void npc_escortAI::OnPossess(bool apply) } } */ - void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs) { Escort_Waypoint t(id, x, y, z, WaitTimeMs); - WaypointList.push_back(t); - // i think SD2 no longer uses this function ScriptWP = true; /*PointMovement wp; @@ -389,23 +329,18 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait wp.m_uiWaitTime = WaitTimeMs; PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/ } - void npc_escortAI::FillPointMovementListForCreature() { std::vector const &pPointsEntries = pSystemMgr.GetPointMoveList(m_creature->GetEntry()); - if (pPointsEntries.empty()) return; - std::vector::const_iterator itr; - for (itr = pPointsEntries.begin(); itr != pPointsEntries.end(); ++itr) { Escort_Waypoint pPoint(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); WaypointList.push_back(pPoint); } } - void npc_escortAI::SetRun(bool bRun) { if (bRun) @@ -424,7 +359,6 @@ void npc_escortAI::SetRun(bool bRun) } m_bIsRunning = bRun; } - //TODO: get rid of this many variables passed in function. void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath) { @@ -433,70 +367,52 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, error_log("TSCR ERROR: EscortAI attempt to Start while in combat."); return; } - if (HasEscortState(STATE_ESCORT_ESCORTING)) { error_log("TSCR: EscortAI attempt to Start while already escorting."); return; } - if(!ScriptWP) // sd2 never adds wp in script, but tc does { - if (!WaypointList.empty()) WaypointList.clear(); - FillPointMovementListForCreature(); - } - if (WaypointList.empty()) { error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint)."); return; } - //set variables m_bIsActiveAttacker = bIsActiveAttacker; m_bIsRunning = bRun; - m_uiPlayerGUID = uiPlayerGUID; m_pQuestForEscort = pQuest; - m_bCanInstantRespawn = bInstantRespawn; m_bCanReturnToStart = bCanLoopPath; - if (m_bCanReturnToStart && m_bCanInstantRespawn) debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { m_creature->GetMotionMaster()->MovementExpired(); m_creature->GetMotionMaster()->MoveIdle(); debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); } - //disable npcflags m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - debug_log("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); - CurrentWP = WaypointList.begin(); - //Set initial speed if (m_bIsRunning) m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); else m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - AddEscortState(STATE_ESCORT_ESCORTING); } - void npc_escortAI::SetEscortPaused(bool bPaused) { if (!HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (bPaused) AddEscortState(STATE_ESCORT_PAUSED); else diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index d0cb55b100a..89a0fc596e8 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -1,14 +1,10 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_ESCORTAI_H #define SC_ESCORTAI_H - #include "../system/system.h" - #define DEFAULT_MAX_PLAYER_DISTANCE 50 - struct Escort_Waypoint { Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) @@ -19,14 +15,12 @@ struct Escort_Waypoint z = _z; WaitTimeMs = _w; } - uint32 id; float x; float y; float z; uint32 WaitTimeMs; }; - enum eEscortState { STATE_ESCORT_NONE = 0x000, //nothing in progress @@ -34,76 +28,53 @@ enum eEscortState STATE_ESCORT_RETURNING = 0x002, //escort is returning after being in combat STATE_ESCORT_PAUSED = 0x004 //will not proceed with waypoints before state is removed }; - struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI { public: explicit npc_escortAI(Creature* pCreature); ~npc_escortAI() {} - // CreatureAI functions void AttackStart(Unit* who); - void MoveInLineOfSight(Unit* who); - void JustDied(Unit*); - void JustRespawned(); - void ReturnToLastPoint(); - void EnterEvadeMode(); - void UpdateAI(const uint32); //the "internal" update, calls UpdateEscortAI() virtual void UpdateEscortAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) - void MovementInform(uint32, uint32); - // EscortAI functions void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); - virtual void WaypointReached(uint32 uiPointId) = 0; virtual void WaypointStart(uint32 uiPointId) {} - void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); - void SetRun(bool bRun = true); void SetEscortPaused(bool uPaused); - bool HasEscortState(uint32 uiEscortState) { return (m_uiEscortState & uiEscortState); } - void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } float GetMaxPlayerDistance() { return MaxPlayerDistance; } - void SetCanMelee(bool usemelee) { CanMelee = usemelee; } void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } - protected: Player* GetPlayerForEscort() { return (Player*)Unit::GetUnit(*m_creature, m_uiPlayerGUID); } - private: bool AssistPlayerInCombat(Unit* pWho); bool IsPlayerOrGroupInRange(); void FillPointMovementListForCreature(); - void AddEscortState(uint32 uiEscortState) { m_uiEscortState |= uiEscortState; } void RemoveEscortState(uint32 uiEscortState) { m_uiEscortState &= ~uiEscortState; } - uint64 m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; uint32 m_uiEscortState; float MaxPlayerDistance; - const Quest* m_pQuestForEscort; //generally passed in Start() when regular escort script. - std::list WaypointList; std::list::iterator CurrentWP; - bool m_bIsActiveAttacker; //obsolete, determined by faction. bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK) bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used) diff --git a/src/bindings/scripts/base/follower_ai.cpp b/src/bindings/scripts/base/follower_ai.cpp index 8284af7aec0..67c03c396ce 100644 --- a/src/bindings/scripts/base/follower_ai.cpp +++ b/src/bindings/scripts/base/follower_ai.cpp @@ -1,50 +1,40 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - /* ScriptData SDName: FollowerAI SD%Complete: 50 SDComment: This AI is under development SDCategory: Npc EndScriptData */ - #include "precompiled.h" #include "follower_ai.h" - const float MAX_PLAYER_DISTANCE = 100.0f; - enum ePoints { POINT_COMBAT_START = 0xFFFFFF }; - FollowerAI::FollowerAI(Creature* pCreature) : ScriptedAI(pCreature), m_uiLeaderGUID(0), m_pQuestForFollow(NULL), m_uiUpdateFollowTimer(2500), m_uiFollowState(STATE_FOLLOW_NONE) {} - void FollowerAI::AttackStart(Unit* pWho) { if (!pWho) return; - if (m_creature->Attack(pWho, true)) { m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - if (m_creature->hasUnitState(UNIT_STAT_FOLLOW)) m_creature->clearUnitState(UNIT_STAT_FOLLOW); - if (IsCombatMovement()) m_creature->GetMotionMaster()->MoveChase(pWho); } } - //This part provides assistance to a player that are attacked by pWho, even if out of normal aggro range //It will cause m_creature to attack pWho that are attacking _any_ player (which has been confirmed may happen also on offi) //The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate. @@ -52,19 +42,15 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) { if (!pWho || !pWho->getVictim()) return false; - //experimental (unknown) flag not present if (!(m_creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13)) return false; - //not a player if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; - //never attack friendly if (m_creature->IsFriendlyTo(pWho)) return false; - //too far away and no free sight? if (m_creature->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && m_creature->IsWithinLOSInMap(pWho)) { @@ -81,20 +67,16 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) return true; } } - return false; } - void FollowerAI::MoveInLineOfSight(Unit* pWho) { if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(m_creature)) { if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho)) return; - if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) return; - if (m_creature->IsHostileTo(pWho)) { float fAttackRadius = m_creature->GetAttackDistance(pWho); @@ -114,18 +96,16 @@ void FollowerAI::MoveInLineOfSight(Unit* pWho) } } } - void FollowerAI::JustDied(Unit* pKiller) { if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_uiLeaderGUID || !m_pQuestForFollow) return; - //TODO: need a better check for quests with time limit. if (Player* pPlayer = GetLeaderForFollower()) { if (Group* pGroup = pPlayer->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { if (Player* pMember = pRef->getSource()) { @@ -141,31 +121,24 @@ void FollowerAI::JustDied(Unit* pKiller) } } } - void FollowerAI::JustRespawned() { m_uiFollowState = STATE_FOLLOW_NONE; - if (!IsCombatMovement()) SetCombatMovement(true); - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); - Reset(); } - void FollowerAI::EnterEvadeMode() { m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); m_creature->SetLootRecipient(NULL); - if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { debug_log("TSCR: FollowerAI left combat, returning to CombatStartPosition."); - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) { float fPosX, fPosY, fPosZ; @@ -178,10 +151,8 @@ void FollowerAI::EnterEvadeMode() if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) m_creature->GetMotionMaster()->MoveTargetedHome(); } - Reset(); } - void FollowerAI::UpdateAI(const uint32 uiDiff) { if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim()) @@ -194,26 +165,21 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) m_creature->ForcedDespawn(); return; } - bool bIsMaxRangeExceeded = true; - if (Player* pPlayer = GetLeaderForFollower()) { if (HasFollowState(STATE_FOLLOW_RETURNING)) { debug_log("TSCR: FollowerAI is returning to leader."); - RemoveFollowState(STATE_FOLLOW_RETURNING); m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); return; } - if (Group* pGroup = pPlayer->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { Player* pMember = pRef->getSource(); - if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) { bIsMaxRangeExceeded = false; @@ -227,36 +193,29 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) bIsMaxRangeExceeded = false; } } - if (bIsMaxRangeExceeded) { debug_log("TSCR: FollowerAI failed because player/group was to far away or not found"); m_creature->ForcedDespawn(); return; } - m_uiUpdateFollowTimer = 1000; } else m_uiUpdateFollowTimer -= uiDiff; } - UpdateFollowerAI(uiDiff); } - void FollowerAI::UpdateFollowerAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId) { if (uiMotionType != POINT_MOTION_TYPE || !HasFollowState(STATE_FOLLOW_INPROGRESS)) return; - if (uiPointId == POINT_COMBAT_START) { if (GetLeaderForFollower()) @@ -268,7 +227,6 @@ void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId) m_creature->ForcedDespawn(); } } - void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest) { if (m_creature->getVictim()) @@ -276,37 +234,27 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const debug_log("TSCR: FollowerAI attempt to StartFollow while in combat."); return; } - if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { error_log("TSCR: FollowerAI attempt to StartFollow while already following."); return; } - //set variables m_uiLeaderGUID = pLeader->GetGUID(); - if (uiFactionForFollower) m_creature->setFaction(uiFactionForFollower); - m_pQuestForFollow = pQuest; - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); debug_log("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); } - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - AddFollowState(STATE_FOLLOW_INPROGRESS); - m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - debug_log("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID); } - Player* FollowerAI::GetLeaderForFollower() { if (Player* pLeader = Unit::GetPlayer(m_uiLeaderGUID)) @@ -317,10 +265,9 @@ Player* FollowerAI::GetLeaderForFollower() { if (Group* pGroup = pLeader->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { Player* pMember = pRef->getSource(); - if (pMember && pMember->isAlive() && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) { debug_log("TSCR: FollowerAI GetLeader changed and returned new leader."); @@ -332,22 +279,18 @@ Player* FollowerAI::GetLeaderForFollower() } } } - debug_log("TSCR: FollowerAI GetLeader can not find suitable leader."); return NULL; } - void FollowerAI::SetFollowComplete(bool bWithEndEvent) { if (m_creature->hasUnitState(UNIT_STAT_FOLLOW)) { m_creature->clearUnitState(UNIT_STAT_FOLLOW); - m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); } - if (bWithEndEvent) AddFollowState(STATE_FOLLOW_POSTEVENT); else @@ -355,23 +298,18 @@ void FollowerAI::SetFollowComplete(bool bWithEndEvent) if (HasFollowState(STATE_FOLLOW_POSTEVENT)) RemoveFollowState(STATE_FOLLOW_POSTEVENT); } - AddFollowState(STATE_FOLLOW_COMPLETE); } - void FollowerAI::SetFollowPaused(bool bPaused) { if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || HasFollowState(STATE_FOLLOW_COMPLETE)) return; - if (bPaused) { AddFollowState(STATE_FOLLOW_PAUSED); - if (m_creature->hasUnitState(UNIT_STAT_FOLLOW)) { m_creature->clearUnitState(UNIT_STAT_FOLLOW); - m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); @@ -380,7 +318,6 @@ void FollowerAI::SetFollowPaused(bool bPaused) else { RemoveFollowState(STATE_FOLLOW_PAUSED); - if (Player* pLeader = GetLeaderForFollower()) m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } diff --git a/src/bindings/scripts/base/follower_ai.h b/src/bindings/scripts/base/follower_ai.h index 289efd4a6b0..2a7ab778629 100644 --- a/src/bindings/scripts/base/follower_ai.h +++ b/src/bindings/scripts/base/follower_ai.h @@ -1,12 +1,9 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_FOLLOWERAI_H #define SC_FOLLOWERAI_H - #include "../system/system.h" - enum eFollowState { STATE_FOLLOW_NONE = 0x000, @@ -17,51 +14,33 @@ enum eFollowState STATE_FOLLOW_PREEVENT = 0x010, //not implemented (allow pre event to run, before follow is initiated) STATE_FOLLOW_POSTEVENT = 0x020 //can be set at complete and allow post event to run }; - class TRINITY_DLL_DECL FollowerAI : public ScriptedAI { public: explicit FollowerAI(Creature* pCreature); ~FollowerAI() {} - //virtual void WaypointReached(uint32 uiPointId) = 0; - void MovementInform(uint32 uiMotionType, uint32 uiPointId); - void AttackStart(Unit*); - void MoveInLineOfSight(Unit*); - void EnterEvadeMode(); - void JustDied(Unit*); - void JustRespawned(); - void UpdateAI(const uint32); //the "internal" update, calls UpdateFollowerAI() virtual void UpdateFollowerAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) - void StartFollow(Player* pPlayer, uint32 uiFactionForFollower = 0, const Quest* pQuest = NULL); - void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow void SetFollowComplete(bool bWithEndEvent = false); - bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); } - protected: Player* GetLeaderForFollower(); - private: void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; } void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; } - bool AssistPlayerInCombat(Unit* pWho); - uint64 m_uiLeaderGUID; uint32 m_uiUpdateFollowTimer; uint32 m_uiFollowState; - const Quest* m_pQuestForFollow; //normally we have a quest }; - #endif diff --git a/src/bindings/scripts/base/guard_ai.cpp b/src/bindings/scripts/base/guard_ai.cpp index 1001d3a1170..badd763a78b 100644 --- a/src/bindings/scripts/base/guard_ai.cpp +++ b/src/bindings/scripts/base/guard_ai.cpp @@ -13,84 +13,67 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Guard_AI SD%Complete: 90 SDComment: SDCategory: Guards EndScriptData */ - #include "precompiled.h" #include "guard_ai.h" - // **** This script is for use within every single guard to save coding time **** - #define GENERIC_CREATURE_COOLDOWN 5000 - #define SAY_GUARD_SIL_AGGRO1 -1070001 #define SAY_GUARD_SIL_AGGRO2 -1070002 #define SAY_GUARD_SIL_AGGRO3 -1070003 - guardAI::guardAI(Creature* pCreature) : ScriptedAI(pCreature), GlobalCooldown(0), BuffTimer(0) {} - void guardAI::Reset() { GlobalCooldown = 0; BuffTimer = 0; //Rebuff as soon as we can } - void guardAI::EnterCombat(Unit *who) { if (m_creature->GetEntry() == 15184) DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1,SAY_GUARD_SIL_AGGRO2,SAY_GUARD_SIL_AGGRO3), m_creature, who); - if (SpellEntry const *spell = m_creature->reachWithSpellAttack(who)) DoCastSpell(who, spell); } - void guardAI::JustDied(Unit *Killer) { //Send Zone Under Attack message to the LocalDefense and WorldDefense Channels if (Player* pKiller = Killer->GetCharmerOrOwnerPlayerOrPlayerItself()) m_creature->SendZoneUnderAttackMessage(pKiller); } - void guardAI::UpdateAI(const uint32 diff) { //Always decrease our global cooldown first if (GlobalCooldown > diff) GlobalCooldown -= diff; else GlobalCooldown = 0; - //Buff timer (only buff when we are alive and not in combat if (m_creature->isAlive() && !m_creature->isInCombat()) if (BuffTimer < diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); - if (info && !GlobalCooldown) { //Cast the buff spell DoCastSpell(m_creature, info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - //Set our timer to 10 minutes before rebuff BuffTimer = 600000; } //Try agian in 30 seconds else BuffTimer = 30000; }else BuffTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - // Make sure our attack is ready and we arn't currently casting if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { @@ -99,27 +82,22 @@ void guardAI::UpdateAI(const uint32 diff) { bool Healing = false; SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, select a hostile spell if (info) Healing = true; else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); - //20% chance to replace our white hit with a spell if (info && rand() % 5 == 0 && !GlobalCooldown) { //Cast the spell if (Healing)DoCastSpell(m_creature, info); else DoCastSpell(m_creature->getVictim(), info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; } else m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); } } @@ -130,15 +108,12 @@ void guardAI::UpdateAI(const uint32 diff) { bool Healing = false; SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp ONLY 33% of the time if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0) info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) if (info) Healing = true; else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); - //Found a spell, check if we arn't on cooldown if (info && !GlobalCooldown) { @@ -148,14 +123,11 @@ void guardAI::UpdateAI(const uint32 diff) (*m_creature).GetMotionMaster()->Clear(false); (*m_creature).GetMotionMaster()->MoveIdle(); } - //Cast spell if (Healing) DoCastSpell(m_creature,info); else DoCastSpell(m_creature->getVictim(),info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - } //If no spells available and we arn't moving run to target else if ((*m_creature).GetMotionMaster()->GetCurrentMovementGeneratorType()!=TARGETED_MOTION_TYPE) { @@ -167,7 +139,6 @@ void guardAI::UpdateAI(const uint32 diff) } } } - void guardAI::DoReplyToTextEmote(uint32 em) { switch(em) @@ -180,13 +151,11 @@ void guardAI::DoReplyToTextEmote(uint32 em) case TEXTEMOTE_CHICKEN: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break; } } - void guardAI_orgrimmar::ReceiveEmote(Player* pPlayer, uint32 text_emote) { if (pPlayer->GetTeam()==HORDE) DoReplyToTextEmote(text_emote); } - void guardAI_stormwind::ReceiveEmote(Player* pPlayer, uint32 text_emote) { if (pPlayer->GetTeam() == ALLIANCE) diff --git a/src/bindings/scripts/base/guard_ai.h b/src/bindings/scripts/base/guard_ai.h index a7fff32e3ab..dd4e414d1ae 100644 --- a/src/bindings/scripts/base/guard_ai.h +++ b/src/bindings/scripts/base/guard_ai.h @@ -1,44 +1,31 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_GUARDAI_H #define SC_GUARDAI_H - #define GENERIC_CREATURE_COOLDOWN 5000 - struct TRINITY_DLL_DECL guardAI : public ScriptedAI { public: explicit guardAI(Creature* pCreature); ~guardAI() {} - uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs - void Reset(); - void EnterCombat(Unit *who); - void JustDied(Unit *Killer); - void UpdateAI(const uint32 diff); - //common used for guards in main cities void DoReplyToTextEmote(uint32 em); }; - struct TRINITY_DLL_DECL guardAI_orgrimmar : public guardAI { guardAI_orgrimmar(Creature *c) : guardAI(c) {} - void ReceiveEmote(Player *player, uint32 text_emote); }; - struct TRINITY_DLL_DECL guardAI_stormwind : public guardAI { guardAI_stormwind(Creature *c) : guardAI(c) {} - void ReceiveEmote(Player *player, uint32 text_emote); }; #endif diff --git a/src/bindings/scripts/base/simple_ai.cpp b/src/bindings/scripts/base/simple_ai.cpp index 60511d163b7..c607885f4d3 100644 --- a/src/bindings/scripts/base/simple_ai.cpp +++ b/src/bindings/scripts/base/simple_ai.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: SimpleAI SD%Complete: 100 SDComment: Base Class for SimpleAI creatures SDCategory: Creatures EndScriptData */ - #include "precompiled.h" #include "simple_ai.h" - SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c) { //Clear all data @@ -33,7 +30,6 @@ SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c) Aggro_Sound[0] = 0; Aggro_Sound[1] = 0; Aggro_Sound[2] = 0; - Death_TextId[0] = 0; Death_TextId[1] = 0; Death_TextId[2] = 0; @@ -42,7 +38,6 @@ SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c) Death_Sound[2] = 0; Death_Spell = 0; Death_Target_Type = 0; - Kill_TextId[0] = 0; Kill_TextId[1] = 0; Kill_TextId[2] = 0; @@ -51,16 +46,12 @@ SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c) Kill_Sound[2] = 0; Kill_Spell = 0; Kill_Target_Type = 0; - memset(Spell,0,sizeof(Spell)); - EnterEvadeMode(); } - void SimpleAI::Reset() { } - void SimpleAI::EnterCombat(Unit *who) { //Reset cast timers @@ -94,35 +85,26 @@ void SimpleAI::EnterCombat(Unit *who) if (Spell[9].First_Cast >= 0) Spell_Timer[9] = Spell[9].First_Cast; else Spell_Timer[9] = 1000; - uint8 random_text = urand(0,2); - //Random text if (Aggro_TextId[random_text]) DoScriptText(Aggro_TextId[random_text], m_creature, who); - //Random sound if (Aggro_Sound[random_text]) DoPlaySoundToSet(m_creature, Aggro_Sound[random_text]); } - void SimpleAI::KilledUnit(Unit *victim) { uint8 random_text = urand(0,2); - //Random yell if (Kill_TextId[random_text]) DoScriptText(Kill_TextId[random_text], m_creature, victim); - //Random sound if (Kill_Sound[random_text]) DoPlaySoundToSet(m_creature, Kill_Sound[random_text]); - if (!Kill_Spell) return; - Unit* target = NULL; - switch (Kill_Target_Type) { case CAST_SELF: @@ -144,33 +126,25 @@ void SimpleAI::KilledUnit(Unit *victim) target = victim; break; } - //Target is ok, cast a spell on it if (target) DoCast(target, Kill_Spell); } - void SimpleAI::DamageTaken(Unit *killer, uint32 &damage) { //Return if damage taken won't kill us if (m_creature->GetHealth() > damage) return; - uint8 random_text = urand(0,2); - //Random yell if (Death_TextId[random_text]) DoScriptText(Death_TextId[random_text], m_creature, killer); - //Random sound if (Death_Sound[random_text]) DoPlaySoundToSet(m_creature, Death_Sound[random_text]); - if (!Death_Spell) return; - Unit* target = NULL; - switch (Death_Target_Type) { case CAST_SELF: @@ -192,36 +166,30 @@ void SimpleAI::DamageTaken(Unit *killer, uint32 &damage) target = killer; break; } - //Target is ok, cast a spell on it if (target) DoCast(target, Death_Spell); } - void SimpleAI::UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Spells for (uint32 i = 0; i < 10; ++i) { //Spell not valid if (!Spell[i].Enabled || !Spell[i].Spell_Id) continue; - if (Spell_Timer[i] < diff) { //Check if this is a percentage based if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > -Spell[i].First_Cast) continue; - //Check Current spell if (!(Spell[i].InterruptPreviousCast && m_creature->IsNonMeleeSpellCasted(false))) { Unit* target = NULL; - switch (Spell[i].Cast_Target_Type) { case CAST_SELF: @@ -240,39 +208,29 @@ void SimpleAI::UpdateAI(const uint32 diff) target = SelectUnit(SELECT_TARGET_RANDOM,0); break; } - //Target is ok, cast a spell on it and then do our random yell if (target) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCast(target, Spell[i].Spell_Id); - //Yell and sound use the same number so that you can make //the Creature yell with the correct sound effect attached uint8 random_text = urand(0,2); - //Random yell if (Spell[i].TextId[random_text]) DoScriptText(Spell[i].TextId[random_text], m_creature, target); - //Random sound if (Spell[i].Text_Sound[random_text]) DoPlaySoundToSet(m_creature, Spell[i].Text_Sound[random_text]); } - } - //Spell will cast agian when the cooldown is up if (Spell[i].CooldownRandomAddition) Spell_Timer[i] = Spell[i].Cooldown + (rand() % Spell[i].CooldownRandomAddition); else Spell_Timer[i] = Spell[i].Cooldown; - }else Spell_Timer[i] -= diff; - } - DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/base/simple_ai.h b/src/bindings/scripts/base/simple_ai.h index 3a2e8a9341a..308f5a475ec 100644 --- a/src/bindings/scripts/base/simple_ai.h +++ b/src/bindings/scripts/base/simple_ai.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_SIMPLEAI_H #define SC_SIMPLEAI_H - enum CastTarget { CAST_SELF = 0, //Self cast @@ -13,41 +11,29 @@ enum CastTarget CAST_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) CAST_HOSTILE_RANDOM, //Just any random target on our threat list CAST_FRIENDLY_RANDOM, //NOT YET IMPLEMENTED - //Special cases CAST_KILLEDUNIT_VICTIM, //Only works within KilledUnit function CAST_JUSTDIED_KILLER, //Only works within JustDied function }; - struct TRINITY_DLL_DECL SimpleAI : public ScriptedAI { SimpleAI(Creature *c);// : ScriptedAI(c); - void Reset(); - void EnterCombat(Unit *who); - void KilledUnit(Unit *victim); - void DamageTaken(Unit *killer, uint32 &damage); - void UpdateAI(const uint32 diff); - public: - int32 Aggro_TextId[3]; uint32 Aggro_Sound[3]; - int32 Death_TextId[3]; uint32 Death_Sound[3]; uint32 Death_Spell; uint32 Death_Target_Type; - int32 Kill_TextId[3]; uint32 Kill_Sound[3]; uint32 Kill_Spell; uint32 Kill_Target_Type; - struct SimpleAI_Spell { uint32 Spell_Id; //Spell ID to cast @@ -57,15 +43,12 @@ public: uint32 Cast_Target_Type; //Target type (note that certain spells may ignore this) bool InterruptPreviousCast; //Interrupt a previous cast if this spell needs to be cast bool Enabled; //Spell enabled or disabled (default: false) - //3 texts to many? int32 TextId[3]; uint32 Text_Sound[3]; }Spell[10]; - protected: uint32 Spell_Timer[10]; }; - #endif diff --git a/src/bindings/scripts/include/precompiled.cpp b/src/bindings/scripts/include/precompiled.cpp index 75bfae9e1c4..49f792c8fd8 100644 --- a/src/bindings/scripts/include/precompiled.cpp +++ b/src/bindings/scripts/include/precompiled.cpp @@ -1,6 +1,5 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #include "precompiled.h" diff --git a/src/bindings/scripts/include/precompiled.h b/src/bindings/scripts/include/precompiled.h index 3f5bc7e7265..e5fc9a3eeb9 100644 --- a/src/bindings/scripts/include/precompiled.h +++ b/src/bindings/scripts/include/precompiled.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * 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 - #include "../ScriptMgr.h" #include "Cell.h" #include "CellImpl.h" @@ -20,7 +18,6 @@ #include "Chat.h" #include "DBCStructure.h" #include "DBCStores.h" - #ifdef WIN32 #include BOOL APIENTRY DllMain( HANDLE hModule, @@ -31,6 +28,5 @@ LPVOID lpReserved return true; } #endif - #endif diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 21c8842fb44..7df3b66d8d7 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -4,23 +4,20 @@ * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #include "precompiled.h" #include "Item.h" #include "Spell.h" #include "ObjectMgr.h" #include "TemporarySummon.h" - // Spell summary for ScriptedAI::SelectSpell struct TSpellSummary { uint8 Targets; // set of enum SelectTarget uint8 Effects; // set of enum SelectEffect } *SpellSummary; - void SummonList::DoZoneInCombat(uint32 entry) { - for(iterator i = begin(); i != end();) + for (iterator i = begin(); i != end(); ) { Creature *summon = Unit::GetCreature(*m_creature, *i); ++i; @@ -29,10 +26,9 @@ void SummonList::DoZoneInCombat(uint32 entry) summon->AI()->DoZoneInCombat(); } } - void SummonList::DoAction(uint32 entry, uint32 info) { - for(iterator i = begin(); i != end();) + for (iterator i = begin(); i != end(); ) { Creature *summon = Unit::GetCreature(*m_creature, *i); ++i; @@ -41,10 +37,9 @@ void SummonList::DoAction(uint32 entry, uint32 info) summon->AI()->DoAction(info); } } - void SummonList::DespawnEntry(uint32 entry) { - for(iterator i = begin(); i != end();) + for (iterator i = begin(); i != end(); ) { Creature *summon = Unit::GetCreature(*m_creature, *i); if(!summon) @@ -59,7 +54,6 @@ void SummonList::DespawnEntry(uint32 entry) ++i; } } - void SummonList::DespawnAll() { while(!empty()) @@ -80,7 +74,6 @@ void SummonList::DespawnAll() } } } - ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), m_creature(pCreature), IsFleeing(false), @@ -89,22 +82,18 @@ ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), { HeroicMode = m_creature->GetMap()->IsHeroic(); } - void ScriptedAI::AttackStartNoMove(Unit* pWho) { if (!pWho) return; - if(m_creature->Attack(pWho, false)) DoStartNoMovement(pWho); } - void ScriptedAI::UpdateAI(const uint32 uiDiff) { //Check if we have a current target if (!UpdateVictim()) return; - if (m_creature->isAttackReady()) { //If we are within range melee the target @@ -115,232 +104,180 @@ void ScriptedAI::UpdateAI(const uint32 uiDiff) } } } - void ScriptedAI::DoStartMovement(Unit* pVictim, float fDistance, float fAngle) { if (pVictim) m_creature->GetMotionMaster()->MoveChase(pVictim, fDistance, fAngle); } - void ScriptedAI::DoStartNoMovement(Unit* pVictim) { if (!pVictim) return; - m_creature->GetMotionMaster()->MoveIdle(); } - void ScriptedAI::DoStopAttack() { if (m_creature->getVictim()) m_creature->AttackStop(); } - void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered) { if (!pTarget || m_creature->IsNonMeleeSpellCasted(false)) return; - m_creature->StopMoving(); m_creature->CastSpell(pTarget, pSpellInfo, bTriggered); } - void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId) { if (!pSource) return; - if (!GetSoundEntriesStore()->LookupEntry(uiSoundId)) { error_log("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow()); return; } - pSource->PlayDirectSound(uiSoundId); } - Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime) { return m_creature->SummonCreature(uiId, m_creature->GetPositionX()+fX, m_creature->GetPositionY()+fY, m_creature->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime); } - Unit* ScriptedAI::SelectUnit(SelectAggroTarget target, uint32 uiPosition) { //ThreatList m_threatlist; std::list& threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator itr = threatlist.begin(); std::list::reverse_iterator ritr = threatlist.rbegin(); - if (uiPosition >= threatlist.size() || !threatlist.size()) return NULL; - switch (target) { case SELECT_TARGET_RANDOM: advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition ) )); return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); break; - case SELECT_TARGET_TOPAGGRO: advance (itr , uiPosition); return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); break; - case SELECT_TARGET_BOTTOMAGGRO: advance (ritr , uiPosition); return Unit::GetUnit((*m_creature),(*ritr)->getUnitGuid()); break; } - return NULL; } - SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) { //No target so we can't cast if (!pTarget) return false; - //Silenced so we can't cast if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) return false; - //Using the extended script system we first create a list of viable spells SpellEntry const* apSpell[CREATURE_MAX_SPELLS]; memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS); - uint32 uiSpellCount = 0; - SpellEntry const* pTempSpell; SpellRangeEntry const* pTempRange; - //Check if each spell is viable(set it to null if not) for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++) { pTempSpell = GetSpellStore()->LookupEntry(m_creature->m_spells[i]); - //This spell doesn't exist if (!pTempSpell) continue; - // Targets and Effects checked first as most used restrictions //Check the spell targets if specified if (selectTargets && !(SpellSummary[m_creature->m_spells[i]].Targets & (1 << (selectTargets-1)))) continue; - //Check the type of spell if we are looking for a specific spell type if (selectEffects && !(SpellSummary[m_creature->m_spells[i]].Effects & (1 << (selectEffects-1)))) continue; - //Check for school if specified if (uiSchool >= 0 && pTempSpell->SchoolMask & uiSchool) continue; - //Check for spell mechanic if specified if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic) continue; - //Make sure that the spell uses the requested amount of power if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin) continue; - if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax) continue; - //Continue if we don't have the mana to actually cast this spell if (pTempSpell->manaCost > m_creature->GetPower((Powers)pTempSpell->powerType)) continue; - //Get the Range pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex); - //Spell has invalid range store so we can't use it if (!pTempRange) continue; - //Check if the spell meets our range requirements if (fRangeMin && m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin) continue; if (fRangeMax && m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax) continue; - //Check if our target is in range if (m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange))) continue; - //All good so lets add it to the spell list apSpell[uiSpellCount] = pTempSpell; ++uiSpellCount; } - //We got our usable spells so now lets randomly pick one if (!uiSpellCount) return NULL; - return apSpell[rand()%uiSpellCount]; } - bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered) { //No target so we can't cast if (!pTarget || !pSpell) return false; - //Silenced so we can't cast if (!bTriggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) return false; - //Check for power if (!bTriggered && me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) return false; - SpellRangeEntry const* pTempRange = GetSpellRangeStore()->LookupEntry(pSpell->rangeIndex); - //Spell has invalid range store so we can't use it if (!pTempRange) return false; - //Unit is out of range of this spell if (me->IsInRange(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange), m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange))) return false; - return true; } - void FillSpellSummary() { SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()]; - SpellEntry const* pTempSpell; - - for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) { SpellSummary[i].Effects = 0; SpellSummary[i].Targets = 0; - pTempSpell = GetSpellStore()->LookupEntry(i); //This spell doesn't exist if (!pTempSpell) continue; - - for(uint32 j = 0; j < 3; ++j) + for (uint32 j = 0; j < 3; ++j) { //Spell targets self if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); - //Spell targets a single enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY ) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); - //Spell targets AoE at enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY ) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); - //Spell targets an enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY || @@ -349,19 +286,16 @@ void FillSpellSummary() pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY ) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); - //Spell targets a single friend(or self) if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); - //Spell targets aoe friends if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1); - //Spell targets any friend(or self) if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || @@ -370,28 +304,24 @@ void FillSpellSummary() pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1); - //Make sure that this spell includes a damage effect if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL || pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1); - //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal) if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL || (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j]== 8 )) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); - //Make sure that this spell applies an aura if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA ) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); } } } - void ScriptedAI::DoResetThreat() { if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty()) @@ -399,41 +329,33 @@ void ScriptedAI::DoResetThreat() error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (m_creature entry = %d)", m_creature->GetEntry()); return; } - std::list& threatlist = m_creature->getThreatManager().getThreatList(); - - for(std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); - if(pUnit && DoGetThreat(pUnit)) DoModifyThreatPercent(pUnit, -100); } } - float ScriptedAI::DoGetThreat(Unit* pUnit) { if(!pUnit) return 0.0f; return m_creature->getThreatManager().getThreat(pUnit); } - void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct) { if(!pUnit) return; m_creature->getThreatManager().modifyThreatPercent(pUnit, pct); } - void ScriptedAI::DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime) { m_creature->Relocate(fX, fY, fZ); m_creature->SendMonsterMove(fX, fY, fZ, uiTime); } - void ScriptedAI::DoTeleportTo(const float fPos[4]) { me->NearTeleportTo(fPos[0], fPos[1], fPos[2], fPos[3]); } - void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO) { if(!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER) @@ -442,33 +364,27 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", m_creature->GetGUID(), m_creature->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO); return; } - CAST_PLR(pUnit)->TeleportTo(pUnit->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT); } - void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO) { Map *map = m_creature->GetMap(); if (!map->IsDungeon()) return; - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->getSource()) if (i_pl->isAlive()) i_pl->TeleportTo(m_creature->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT); } - Unit* ScriptedAI::DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff) { Unit* pUnit = NULL; Trinity::MostHPMissingInRange u_check(m_creature, fRange, uiMinHPDiff); Trinity::UnitLastSearcher searcher(m_creature, pUnit, u_check); m_creature->VisitNearbyObject(fRange, searcher); - return pUnit; } - std::list ScriptedAI::DoFindFriendlyCC(float fRange) { std::list pList; @@ -477,7 +393,6 @@ std::list ScriptedAI::DoFindFriendlyCC(float fRange) m_creature->VisitNearbyObject(fRange, searcher); return pList; } - std::list ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellid) { std::list pList; @@ -486,51 +401,39 @@ std::list ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 m_creature->VisitNearbyObject(fRange, searcher); return pList; } - Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange) { Player* pPlayer = NULL; - CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::PlayerAtMinimumRangeAway check(m_creature, fMinimumRange); Trinity::PlayerSearcher searcher(m_creature, pPlayer, check); TypeContainerVisitor, GridTypeMapContainer> visitor(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap())); - return pPlayer; } - void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged) { if (bLoadDefault) { if (CreatureInfo const* pInfo = GetCreatureTemplateStore(m_creature->GetEntry())) m_creature->LoadEquipment(pInfo->equipmentId,true); - return; } - if (uiMainHand >= 0) m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand)); - if (uiOffHand >= 0) m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand)); - if (uiRanged >= 0) m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged)); } - void ScriptedAI::SetCombatMovement(bool bCombatMove) { m_bCombatMovement = bCombatMove; } - enum eNPCs { NPC_BROODLORD = 12017, @@ -538,7 +441,6 @@ enum eNPCs NPC_JAN_ALAI = 23578, NPC_SARTHARION = 28860 }; - // Hacklike storage used for misc creatures that are expected to evade of outside of a certain area. // It is assumed the information is found elswehere and can be handled by mangos. So far no luck finding such information/way to extract it. bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) @@ -550,14 +452,11 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) m_uiEvadeCheckCooldown -= uiDiff; return false; } - if (m_creature->IsInEvadeMode() || !m_creature->getVictim()) return false; - float fX = m_creature->GetPositionX(); float fY = m_creature->GetPositionY(); float fZ = m_creature->GetPositionZ(); - switch(m_creature->GetEntry()) { case NPC_BROODLORD: // broodlord (not move down stairs) @@ -580,39 +479,32 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", m_creature->GetEntry()); return false; } - EnterEvadeMode(); return true; } - void Scripted_NoMovementAI::AttackStart(Unit* pWho) { if (!pWho) return; - if (m_creature->Attack(pWho, true)) { DoStartNoMovement(pWho); } } - BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c) , bossId(id), summons(me), instance(c->GetInstanceData()) , boundary(instance ? instance->GetBossBoundary(id) : NULL) { } - void BossAI::_Reset() { if(!me->isAlive()) return; - events.Reset(); summons.DespawnAll(); if(instance) instance->SetBossState(bossId, NOT_STARTED); } - void BossAI::_JustDied() { events.Reset(); @@ -620,7 +512,6 @@ void BossAI::_JustDied() if(instance) instance->SetBossState(bossId, DONE); } - void BossAI::_EnterCombat() { me->setActive(true); @@ -628,23 +519,20 @@ void BossAI::_EnterCombat() if(instance) instance->SetBossState(bossId, IN_PROGRESS); } - void BossAI::TeleportCheaters() { float x, y, z; me->GetPosition(x, y, z); std::list &m_threatlist = me->getThreatManager().getThreatList(); - for(std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) + for (std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget())) (*itr)->getTarget()->NearTeleportTo(x, y, z, 0); } - bool BossAI::CheckBoundary(Unit *who) { if(!boundary || !who) return true; - - for(BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr) + for (BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr) { switch(itr->first) { @@ -682,48 +570,39 @@ bool BossAI::CheckBoundary(Unit *who) break; } } - return true; } - void BossAI::JustSummoned(Creature *summon) { summons.Summon(summon); if(me->isInCombat()) DoZoneInCombat(summon); } - void BossAI::SummonedCreatureDespawn(Creature *summon) { summons.Despawn(summon); } - #define GOBJECT(x) (const_cast(GetGameObjectInfo(x))) - void LoadOverridenSQLData() { GameObjectInfo *goInfo; - // Sunwell Plateau : Kalecgos : Spectral Rift if(goInfo = GOBJECT(187055)) if(goInfo->type == GAMEOBJECT_TYPE_GOOBER) goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN - // Naxxramas : Sapphiron Birth if(goInfo = GOBJECT(181356)) if(goInfo->type == GAMEOBJECT_TYPE_TRAP) goInfo->trap.radius = 50; } - void LoadOverridenDBCData() { SpellEntry *spellInfo; - for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) { spellInfo = GET_SPELL(i); if(!spellInfo) continue; - switch(i) { // Black Temple : Illidan : Parasitic Shadowfiend Passive @@ -749,23 +628,17 @@ void LoadOverridenDBCData() } } - Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange) { Creature* pCreature = NULL; - CellPair pair(Trinity::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*pSource, Entry, true, MaxSearchRange); Trinity::CreatureLastSearcher searcher(pSource, pCreature, creature_check); - TypeContainerVisitor, GridTypeMapContainer> creature_searcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, creature_searcher,*(pSource->GetMap())); - return pCreature; } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index 91073bf4032..a5b4953bb28 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -4,28 +4,21 @@ * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_CREATURE_H #define SC_CREATURE_H - #include "Creature.h" #include "CreatureAI.h" #include "CreatureAIImpl.h" #include "InstanceData.h" - #define SCRIPT_CAST_TYPE dynamic_cast //#define SCRIPT_CAST_TYPE static_cast - #define CAST_PLR(a) (SCRIPT_CAST_TYPE(a)) #define CAST_CRE(a) (SCRIPT_CAST_TYPE(a)) #define CAST_SUM(a) (SCRIPT_CAST_TYPE(a)) #define CAST_PET(a) (SCRIPT_CAST_TYPE(a)) #define CAST_AI(a,b) (SCRIPT_CAST_TYPE(b)) - #define GET_SPELL(a) (const_cast(GetSpellStore()->LookupEntry(a))) - class ScriptedInstance; - class SummonList : public std::list { public: @@ -39,178 +32,125 @@ class SummonList : public std::list private: Creature *m_creature; }; - struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { explicit ScriptedAI(Creature* pCreature); ~ScriptedAI() {} - //************* //CreatureAI Functions //************* - void AttackStartNoMove(Unit *target); - // Called at any Damage from any attacker (before damage apply) void DamageTaken(Unit* pDone_by, uint32& uiDamage) {} - //Called at World update tick void UpdateAI(const uint32); - //Called at creature death void JustDied(Unit* who){} - //Called at creature killing another unit void KilledUnit(Unit* who){} - // Called when the creature summon successfully other creature void JustSummoned(Creature* ) {} - // Called when a summoned creature is despawned void SummonedCreatureDespawn(Creature*) {} - // Called when hit by a spell void SpellHit(Unit* caster, const SpellEntry *spell) {} - // Called when spell hits a target void SpellHitTarget(Unit* target, const SpellEntry *spell) {} - //Called at waypoint reached or PointMovement end void MovementInform(uint32 type, uint32 id){} - // Called when AI is temporarily replaced or put back when possess is applied or removed void OnPossess(bool apply) {} - //************* // Variables //************* - //Pointer to creature we are manipulating Creature* m_creature; - //For fleeing bool IsFleeing; - bool HeroicMode; - //************* //Pure virtual functions //************* - //Called at creature reset either by death or evade void Reset() {} - //Called at creature aggro either by MoveInLOS or Attack Start void EnterCombat(Unit* who) {} - //************* //AI Helper Functions //************* - //Start movement toward victim void DoStartMovement(Unit* pVictim, float fDistance = 0, float fAngle = 0); - //Start no movement on victim void DoStartNoMovement(Unit* pVictim); - //Stop attack of current victim void DoStopAttack(); - //Cast spell by spell info void DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered = false); - //Plays a sound to all nearby players void DoPlaySoundToSet(WorldObject* pSource, uint32 sound); - //Drops all threat to 0%. Does not remove players from the threat list void DoResetThreat(); - float DoGetThreat(Unit* u); void DoModifyThreatPercent(Unit* pUnit, int32 pct); - void DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime = 0); void DoTeleportTo(const float pos[4]); - void DoAction(const int32 param) {} - //Teleports a player without dropping threat (only teleports to same map) void DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO); void DoTeleportAll(float fX, float fY, float fZ, float fO); - //Returns friendly unit with the most amount of hp missing from max hp Unit* DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff = 1); - //Returns a list of friendly CC'd units within range std::list DoFindFriendlyCC(float fRange); - //Returns a list of all friendly units missing a specific buff within range std::list DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId); - //Return a player with at least minimumRange from m_creature Player* GetPlayerAtMinimumRange(float fMinimumRange); - //Spawns a creature relative to m_creature Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime); - //Selects a unit from the creature's current aggro list Unit* SelectUnit(SelectAggroTarget target, uint32 uiPosition); - bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < m_creature->GetMaxHealth() * pct; } - //Returns spells that meet the specified criteria from the creatures spell list SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect); - //Checks if you can cast the specified spell bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false); - void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE); - //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims void SetCombatMovement(bool CombatMove); bool IsCombatMovement() { return m_bCombatMovement; } - bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff); - private: bool m_bCombatMovement; uint32 m_uiEvadeCheckCooldown; }; - struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI { Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {} - //Called at each attack of m_creature by any victim void AttackStart(Unit* who); }; - struct TRINITY_DLL_DECL BossAI : public ScriptedAI { BossAI(Creature *c, uint32 id); - const uint32 bossId; EventMap events; SummonList summons; InstanceData * const instance; const BossBoundaryMap * const boundary; - void JustSummoned(Creature *summon); void SummonedCreatureDespawn(Creature *summon); - void UpdateAI(const uint32 diff) = 0; - void Reset() { _Reset(); } void EnterCombat(Unit *who) { _EnterCombat(); } void JustDied(Unit *killer) { _JustDied(); } void JustReachedHome() { me->setActive(false); } - protected: void _Reset(); void _EnterCombat(); void _JustDied(); void _JustReachedHome() { me->setActive(false); } - bool CheckInRoom() { if(CheckBoundary(me)) @@ -221,11 +161,8 @@ struct TRINITY_DLL_DECL BossAI : public ScriptedAI bool CheckBoundary(Unit *who); void TeleportCheaters(); }; - // SD2's grid searchers - //return closest creature alive in grid, with range from pSource Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange); - #endif diff --git a/src/bindings/scripts/include/sc_gossip.h b/src/bindings/scripts/include/sc_gossip.h index 5c8ded7d579..1ade3edd3f5 100644 --- a/src/bindings/scripts/include/sc_gossip.h +++ b/src/bindings/scripts/include/sc_gossip.h @@ -4,18 +4,14 @@ * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_GOSSIP_H #define SC_GOSSIP_H - #include "Player.h" #include "GossipDef.h" #include "QuestDef.h" - // Gossip Item Text #define GOSSIP_TEXT_BROWSE_GOODS "I'd like to browse your goods." #define GOSSIP_TEXT_TRAIN "Train me!" - #define GOSSIP_TEXT_BANK "The bank" #define GOSSIP_TEXT_IRONFORGE_BANK "The bank of Ironforge" #define GOSSIP_TEXT_STORMWIND_BANK "The bank of Stormwind" @@ -39,14 +35,12 @@ #define GOSSIP_TEXT_CLASSTRAINER "A class trainer" #define GOSSIP_TEXT_PROFTRAINER "A profession trainer" #define GOSSIP_TEXT_LEXICON "Lexicon of Power" - #define GOSSIP_TEXT_ALTERACVALLEY "Alterac Valley" #define GOSSIP_TEXT_ARATHIBASIN "Arathi Basin" #define GOSSIP_TEXT_WARSONGULCH "Warsong Gulch" #define GOSSIP_TEXT_ARENA "Arena" #define GOSSIP_TEXT_EYEOFTHESTORM "Eye of The Storm" #define GOSSIP_TEXT_STRANDOFANCIENT "Strand of the Ancients" - #define GOSSIP_TEXT_DEATH_KNIGHT "Death Knight" #define GOSSIP_TEXT_DRUID "Druid" #define GOSSIP_TEXT_HUNTER "Hunter" @@ -57,7 +51,6 @@ #define GOSSIP_TEXT_SHAMAN "Shaman" #define GOSSIP_TEXT_MAGE "Mage" #define GOSSIP_TEXT_WARLOCK "Warlock" - #define GOSSIP_TEXT_ALCHEMY "Alchemy" #define GOSSIP_TEXT_BLACKSMITHING "Blacksmithing" #define GOSSIP_TEXT_COOKING "Cooking" @@ -72,7 +65,6 @@ #define GOSSIP_TEXT_MINING "Mining" #define GOSSIP_TEXT_FISHING "Fishing" #define GOSSIP_TEXT_SKINNING "Skinning" - enum eTradeskill { // Skill defines @@ -91,7 +83,6 @@ enum eTradeskill TRADESKILL_SKINNING = 13, TRADESKILL_JEWLCRAFTING = 14, TRADESKILL_INSCRIPTION = 15, - TRADESKILL_LEVEL_NONE = 0, TRADESKILL_LEVEL_APPRENTICE = 1, TRADESKILL_LEVEL_JOURNEYMAN = 2, @@ -99,7 +90,6 @@ enum eTradeskill TRADESKILL_LEVEL_ARTISAN = 4, TRADESKILL_LEVEL_MASTER = 5, TRADESKILL_LEVEL_GRAND_MASTER = 6, - // Gossip defines GOSSIP_ACTION_TRADE = 1, GOSSIP_ACTION_TRAIN = 2, @@ -114,7 +104,6 @@ enum eTradeskill GOSSIP_ACTION_INN_INFO = 11, GOSSIP_ACTION_UNLEARN = 12, GOSSIP_ACTION_INFO_DEF = 1000, - GOSSIP_SENDER_MAIN = 1, GOSSIP_SENDER_INN_INFO = 2, GOSSIP_SENDER_INFO = 3, @@ -126,11 +115,8 @@ enum eTradeskill GOSSIP_SENDER_SEC_MAILBOX = 9, GOSSIP_SENDER_SEC_STABLEMASTER = 10 }; - extern uint32 GetSkillLevel(Player *player,uint32 skill); - // Defined fuctions to use with player. - // This fuction add's a menu item, // a - Icon Id // b - Text @@ -140,10 +126,8 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill); // f - Money value in pop up box #define ADD_GOSSIP_ITEM(a,b,c,d) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,"",0) #define ADD_GOSSIP_ITEM_EXTENDED(a,b,c,d,e,f,g) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,e,f,g) - // This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64) #define SEND_GOSSIP_MENU(a,b) PlayerTalkClass->SendGossipMenu(a,b) - // This fuction shows POI(point of interest) to client. // a - position X // b - position Y @@ -152,23 +136,19 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill); // e - Data // f - Location Name #define SEND_POI(a,b,c,d,e,f) PlayerTalkClass->SendPointOfInterest(a,b,c,d,e,f) - // Closes the Menu #define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip() - // Fuction to tell to client the details // a - quest object // b - npc guid(uint64) // c - Activate accept(bool) #define SEND_QUEST_DETAILS(a,b,c) PlayerTalkClass->SendQuestDetails(a,b,c) - // Fuction to tell to client the requested items to complete quest // a - quest object // b - npc guid(uint64) // c - Iscompletable(bool) // d - close at cancel(bool) - in case single incomplite ques #define SEND_REQUESTEDITEMS(a,b,c,d) PlayerTalkClass->SendRequestedItems(a,b,c,d) - // Fuctions to send NPC lists, a - is always the npc guid(uint64) #define SEND_VENDORLIST(a) GetSession()->SendListInventory(a) #define SEND_TRAINERLIST(a) GetSession()->SendTrainerList(a) @@ -176,16 +156,12 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill); #define SEND_TABARDLIST(a) GetSession()->SendTabardVendorActivate(a) #define SEND_AUCTIONLIST(a) GetSession()->SendAuctionHello(a) #define SEND_TAXILIST(a) GetSession()->SendTaxiStatus(a) - // Ressurect's the player if is dead. #define SEND_SPRESURRECT() GetSession()->SendSpiritResurrect() - // Get the player's honor rank. #define GET_HONORRANK() GetHonorRank() // ----------------------------------- - // defined fuctions to use with Creature - #define QUEST_DIALOG_STATUS(a,b,c) GetSession()->getDialogStatus(a,b,c) #endif diff --git a/src/bindings/scripts/include/sc_instance.h b/src/bindings/scripts/include/sc_instance.h index 25593e05300..7849d97ad61 100644 --- a/src/bindings/scripts/include/sc_instance.h +++ b/src/bindings/scripts/include/sc_instance.h @@ -1,20 +1,15 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_INSTANCE_H #define SC_INSTANCE_H - #include "InstanceData.h" #include "Map.h" - #define OUT_SAVE_INST_DATA debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_SAVE_INST_DATA_COMPLETE debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA(a) debug_log("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) #define OUT_LOAD_INST_DATA_COMPLETE debug_log("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA_FAIL error_log("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) - #define ScriptedInstance InstanceData - #endif diff --git a/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp b/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp index b09f129788e..d69006277f3 100644 --- a/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp +++ b/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp @@ -1,17 +1,13 @@ #include "precompiled.h" #include "WorldPacket.h" - #define GOSSIP_FLIGHT "I need a ride" - bool GossipHello_npc_acherus_taxi(Player* pPlayer, Creature* pCreature) { pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_acherus_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -19,18 +15,17 @@ bool GossipSelect_npc_acherus_taxi(Player* pPlayer, Creature* pCreature, uint32 if (pPlayer->GetPositionZ() >=316) { pPlayer->GetSession()->SendDoFlight(24446, 1053); - }else{ + } + else + { pPlayer->GetSession()->SendDoFlight(24446, 1054); } - } return true; } - void AddSC_npc_acherus_taxi() { Script *newscript; - newscript = new Script; newscript->Name = "npc_acherus_taxi"; newscript->pGossipHello = &GossipHello_npc_acherus_taxi; diff --git a/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp b/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp index 1f25d15205d..ea5ea5001f1 100644 --- a/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp +++ b/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp @@ -1,24 +1,19 @@ #include "precompiled.h" #include "WorldPacket.h" - #define GOSSIP_UP "My Lord, I must go to the upper floor of the temple." #define GOSSIP_DOWN "I would like to take a flight to the ground, Lord Afrasastrasz." #define GOSSIP_MIDDLE "Can you spare a drake to travel to Lord Afrasastrasz, in the middle of the temple?" #define GOSSIP_TOP "Please, Let me take one of these dragons to the top floor of the temple." #define GOSSIP_BOTTOM "Yes, Please. I would like to return to the ground floor of the temple." #define GOSSIP_ONEDOWN "I would like to see Lord Afrasastrasz, in the middle of the temple." - bool GossipHello_npc_wyrmresttempel_middle_taxi(Player* pPlayer, Creature* pCreature) { pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); pPlayer->SEND_GOSSIP_MENU(12887, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_wyrmresttempel_middle_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -26,28 +21,21 @@ bool GossipSelect_npc_wyrmresttempel_middle_taxi(Player* pPlayer, Creature* pCre pPlayer->GetSession()->SendDoFlight(6376, 881); } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) { pPlayer->GetSession()->SendDoFlight(6376, 882); - } return true; } - bool GossipHello_npc_wyrmresttempel_bottom_taxi(Player* pPlayer, Creature* pCreature) { pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TOP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MIDDLE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); pPlayer->SEND_GOSSIP_MENU(12713, pCreature->GetGUID()); - return true; } - - bool GossipSelect_npc_wyrmresttempel_bottom_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 4) @@ -55,62 +43,48 @@ bool GossipSelect_npc_wyrmresttempel_bottom_taxi(Player* pPlayer, Creature* pCre pPlayer->GetSession()->SendDoFlight(6376, 878); } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 3) { pPlayer->GetSession()->SendDoFlight(6376, 883); - } return true; } - bool GossipHello_npc_wyrmresttempel_top_taxi(Player* pPlayer, Creature* pCreature) { pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOTTOM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ONEDOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); pPlayer->SEND_GOSSIP_MENU(12714, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_wyrmresttempel_top_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 5) { pPlayer->GetSession()->SendDoFlight(6376, 879); } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 6) - { pPlayer->GetSession()->SendDoFlight(6376, 880); - } return true; } - void AddSC_npc_wyrmresttempel_taxi() { Script *newscript; - newscript = new Script; newscript->Name = "npc_wyrmresttempelmiddle_taxi"; newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_middle_taxi; newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_middle_taxi; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_wyrmresttempelbottom_taxi"; newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_bottom_taxi; newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_bottom_taxi; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_wyrmresttempeltop_taxi"; newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_top_taxi; newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_top_taxi; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/custom/on_events.cpp b/src/bindings/scripts/scripts/custom/on_events.cpp index e8d9a68e793..2580db7836f 100644 --- a/src/bindings/scripts/scripts/custom/on_events.cpp +++ b/src/bindings/scripts/scripts/custom/on_events.cpp @@ -1,89 +1,68 @@ #include "precompiled.h" #include - //This function is called when the player logs in (every login) void OnLogin(Player *pPlayer) { - } - //This function is called when the player logs out void OnLogout(Player *pPlayer) { - } - //This function is called when the player kills another player void OnPVPKill(Player *killer, Player *killed) { - } - //This function is called when a players AreaID changes void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea) { - } - //This is called when a player kills a creature (non pvp) void OnCreatureKill(Player *pPlayer, Creature *pCreature) { - } - //This function is called when a player has a money exchange int32 OnGetMoney(Player *pPlayer, int32 amount) { return amount; } - //This function is called whenever a player gets XP uint32 OnGetXP(Player *pPlayer, uint32 amount) { return amount; } - //This function is called when a player clicks a GO Object bool OnGoClick(Player *pPlayer, GameObject *pGameObject) { return true; } - //This function is called when a player clicks and item bool OnItemClick(Player *pPlayer, Item *pItem) { return true; } - //This function is called when a player opens an item (like a clam) bool OnItemOpen(Player *pPlayer, Item *pItem) { return true; } - //This function is called when a player sends a chat message bool OnPlayerChat(Player *pPlayer, const char *text) { return true; } - //this function is called when the server starts void OnServerStartup() { - } //this function is called when the server shuts down void OnServerShutdown() { - } - //this function is called when a player casts a spell bool OnSpellCast(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell) { return true; } - void AddSC_onevents() { Script *newscript; @@ -103,6 +82,5 @@ bool OnSpellCast(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, ui newscript->pOnServerShutdown = &OnServerShutdown; newscript->pOnServerStartup = &OnServerStartup; newscript->pOnSpellCast = &OnSpellCast; - newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/alterac_mountains.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/alterac_mountains.cpp index 8b4c360a886..c3f93b426e1 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/alterac_mountains.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/alterac_mountains.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Alterac_Mountains SD%Complete: 0 SDComment: Placeholder SDCategory: Alterac Mountains EndScriptData */ - /* ContentData EndContentData */ - #include "precompiled.h" - /*void AddSC_alterac_mountains() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp index 60255570c59..7757d8da84d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Arathi Highlands SD%Complete: 100 SDComment: Quest support: 665 SDCategory: Arathi Highlands EndScriptData */ - /* ContentData npc_professor_phizzlethorpe EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_professor_phizzlethorpe ######*/ - enum eEnums { SAY_PROGRESS_1 = -1000235, @@ -44,22 +39,17 @@ enum eEnums SAY_PROGRESS_7 = -1000242, EMOTE_PROGRESS_8 = -1000243, SAY_PROGRESS_9 = -1000244, - QUEST_SUNKEN_TREASURE = 665, MOB_VENGEFUL_SURGE = 2776 }; - struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI { npc_professor_phizzlethorpeAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 4:DoScriptText(SAY_PROGRESS_2, m_creature, pPlayer);break; @@ -85,23 +75,19 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI break; } } - void JustSummoned(Creature* pSummoned) { pSummoned->AI()->AttackStart(m_creature); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); } }; - bool QuestAccept_npc_professor_phizzlethorpe(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_SUNKEN_TREASURE) @@ -109,21 +95,17 @@ bool QuestAccept_npc_professor_phizzlethorpe(Player* pPlayer, Creature* pCreatur DoScriptText(SAY_PROGRESS_1, pCreature, pPlayer); if (npc_escortAI* pEscortAI = CAST_AI(npc_professor_phizzlethorpeAI, (pCreature->AI()))) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - pCreature->setFaction(113); } return true; } - CreatureAI* GetAI_npc_professor_phizzlethorpeAI(Creature* pCreature) { return new npc_professor_phizzlethorpeAI(pCreature); } - void AddSC_arathi_highlands() { Script * newscript; - newscript = new Script; newscript->Name = "npc_professor_phizzlethorpe"; newscript->GetAI = &GetAI_npc_professor_phizzlethorpeAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp index a7bb66ac9cf..7d97bd80a22 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp @@ -1,6 +1,5 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * 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. @@ -14,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Blackrock_Depths SD%Complete: 95 SDComment: Quest support: 4001, 4342, 7604, 4322. Vendor Lokhtos Darkbargainer. Need to rewrite the Jail Break support SDCategory: Blackrock Depths EndScriptData */ - /* ContentData go_shadowforge_brazier at_ring_of_law @@ -35,15 +32,12 @@ npc_marshal_reginald_windsor npc_tobias_seecher npc_rocknot EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_blackrock_depths.h" - /*###### +## go_shadowforge_brazier +######*/ - bool GOHello_go_shadowforge_brazier(Player* pPlayer, GameObject* pGo) { if (ScriptedInstance* pInstance = pGo->GetInstanceData()) @@ -55,20 +49,16 @@ bool GOHello_go_shadowforge_brazier(Player* pPlayer, GameObject* pGo) } return false; } - /*###### ## npc_grimstone ######*/ - enum eGrimstone { NPC_GRIMSTONE = 10096, NPC_THELDREN = 16059, - //4 or 6 in total? 1+2+1 / 2+2+2 / 3+3. Depending on this, code should be changed. MAX_MOB_AMOUNT = 4 }; - uint32 RingMob[]= { 8925, // Dredge Worm @@ -78,7 +68,6 @@ uint32 RingMob[]= 8933, // Cave Creeper 8932, // Borer Beetle }; - uint32 RingBoss[]= { 9027, // Gorosh @@ -88,33 +77,27 @@ uint32 RingBoss[]= 9031, // Anub'shiah 9032, // Hedrum }; - bool AreaTrigger_at_ring_of_law(Player* pPlayer, AreaTriggerEntry *at) { if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) { if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) return false; - pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); pPlayer->SummonCreature(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); - return false; } return false; } - /*###### ## npc_grimstone ######*/ - #define SCRIPT_TEXT1 -1000000 #define SCRIPT_TEXT2 -1000000 #define SCRIPT_TEXT3 -1000000 #define SCRIPT_TEXT4 -1000000 #define SCRIPT_TEXT5 -1000000 #define SCRIPT_TEXT6 -1000000 - //TODO: implement quest part of event (different end boss) struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI { @@ -123,60 +106,43 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI pInstance = c->GetInstanceData(); MobSpawnId = rand()%6; } - ScriptedInstance* pInstance; - uint8 EventPhase; uint32 Event_Timer; - uint8 MobSpawnId; uint8 MobCount; uint32 MobDeath_Timer; - uint64 RingMobGUID[4]; uint64 RingBossGUID; - bool CanWalk; - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - EventPhase = 0; Event_Timer = 1000; - MobCount = 0; MobDeath_Timer = 0; - - for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) RingMobGUID[i] = 0; - RingBossGUID = 0; - CanWalk = false; } - //TODO: move them to center void SummonRingMob() { if (Creature* tmp = m_creature->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) RingMobGUID[MobCount] = tmp->GetGUID(); - ++MobCount; - if (MobCount == MAX_MOB_AMOUNT) MobDeath_Timer = 2500; } - //TODO: move them to center void SummonRingBoss() { if (Creature* tmp = m_creature->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) RingBossGUID = tmp->GetGUID(); - MobDeath_Timer = 2500; } - void WaypointReached(uint32 i) { switch(i) @@ -211,23 +177,19 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI break; } } - void HandleGameObject(uint32 id, bool open) { pInstance->HandleGameObject(pInstance->GetData64(id), open); } - void UpdateAI(const uint32 diff) { if (!pInstance) return; - if (MobDeath_Timer) { if (MobDeath_Timer <= diff) { MobDeath_Timer = 2500; - if (RingBossGUID) { Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID); @@ -240,15 +202,13 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI } return; } - - for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]); if (mob && !mob->isAlive() && mob->isDead()) { RingMobGUID[i] = 0; --MobCount; - //seems all are gone, so set timer to continue and discontinue this if (!MobCount) { @@ -259,7 +219,6 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI } }else MobDeath_Timer -= diff; } - if (Event_Timer) { if (Event_Timer <= diff) @@ -327,53 +286,43 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI ++EventPhase; }else Event_Timer -= diff; } - if (CanWalk) npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_grimstone(Creature* pCreature) { return new npc_grimstoneAI(pCreature); } - /*###### ## mob_phalanx ######*/ - #define SPELL_THUNDERCLAP 8732 #define SPELL_FIREBALLVOLLEY 22425 #define SPELL_MIGHTYBLOW 14099 - struct TRINITY_DLL_DECL mob_phalanxAI : public ScriptedAI { mob_phalanxAI(Creature *c) : ScriptedAI(c) {} - uint32 ThunderClap_Timer; uint32 FireballVolley_Timer; uint32 MightyBlow_Timer; - void Reset() { ThunderClap_Timer = 12000; FireballVolley_Timer =0; MightyBlow_Timer = 15000; } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ThunderClap_Timer if (ThunderClap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); ThunderClap_Timer = 10000; }else ThunderClap_Timer -= diff; - //FireballVolley_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51) { @@ -383,14 +332,12 @@ struct TRINITY_DLL_DECL mob_phalanxAI : public ScriptedAI FireballVolley_Timer = 15000; }else FireballVolley_Timer -= diff; } - //MightyBlow_Timer if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MIGHTYBLOW); MightyBlow_Timer = 10000; }else MightyBlow_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -398,17 +345,13 @@ CreatureAI* GetAI_mob_phalanx(Creature* pCreature) { return new mob_phalanxAI (pCreature); } - /*###### ## npc_kharan_mighthammer ######*/ - #define QUEST_4001 4001 #define QUEST_4342 4342 - #define GOSSIP_ITEM_KHARAN_1 "I need to know where the princess are, Kharan!" #define GOSSIP_ITEM_KHARAN_2 "All is not lost, Kharan!" - #define GOSSIP_ITEM_KHARAN_3 "Gor'shak is my friend, you can trust me." #define GOSSIP_ITEM_KHARAN_4 "Not enough, you need to tell me more." #define GOSSIP_ITEM_KHARAN_5 "So what happened?" @@ -417,26 +360,20 @@ CreatureAI* GetAI_mob_phalanx(Creature* pCreature) #define GOSSIP_ITEM_KHARAN_8 "Continue with your story please." #define GOSSIP_ITEM_KHARAN_9 "Indeed." #define GOSSIP_ITEM_KHARAN_10 "The door is open, Kharan. You are a free man." - bool GossipHello_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - if (pPlayer->GetTeam() == HORDE) pPlayer->SEND_GOSSIP_MENU(2473, pCreature->GetGUID()); else pPlayer->SEND_GOSSIP_MENU(2474, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -449,7 +386,6 @@ bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, u pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); pPlayer->SEND_GOSSIP_MENU(2476, pCreature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+3: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); pPlayer->SEND_GOSSIP_MENU(2477, pCreature->GetGUID()); @@ -484,42 +420,33 @@ bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, u } return true; } - /*###### ## npc_lokhtos_darkbargainer ######*/ - #define ITEM_THRORIUM_BROTHERHOOD_CONTRACT 18628 #define ITEM_SULFURON_INGOT 17203 #define QUEST_A_BINDING_CONTRACT 7604 #define SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND 23059 - #define GOSSIP_ITEM_SHOW_ACCESS "Show me what I have access to, Lothos." #define GOSSIP_ITEM_GET_CONTRACT "Get Thorium Brotherhood Contract" - bool GossipHello_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && !pPlayer->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && pPlayer->HasItemCount(ITEM_SULFURON_INGOT, 1)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); } - if (pPlayer->GetReputationRank(59) < REP_FRIENDLY) pPlayer->SEND_GOSSIP_MENU(3673, pCreature->GetGUID()); else pPlayer->SEND_GOSSIP_MENU(3677, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -529,23 +456,18 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature } if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_dughal_stormwing ######*/ - #define QUEST_JAIL_BREAK 4322 #define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" #define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" - /* struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI { npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { switch(i) @@ -560,10 +482,8 @@ struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI break; } } - void EnterCombat(Unit* who) { } void Reset() {} - void JustDied(Unit* killer) { if (IsBeingEscorted && killer == m_creature) @@ -574,7 +494,6 @@ struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); } } - void UpdateAI(const uint32 diff) { if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; @@ -596,11 +515,9 @@ struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI CreatureAI* GetAI_npc_dughal_stormwing(Creature* pCreature) { npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature); - dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); - return dughal_stormwingAI; } bool GossipHello_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature) @@ -612,7 +529,6 @@ bool GossipHello_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -628,7 +544,6 @@ bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uin /*###### ## npc_marshal_windsor ######*/ - #define SAY_WINDSOR_AGGRO1 "You locked up the wrong Marshal. Prepare to be destroyed!" #define SAY_WINDSOR_AGGRO2 "I bet you're sorry now, aren't you !?!!" #define SAY_WINDSOR_AGGRO3 "You better hold me back $N or they are going to feel some prison house beatings." @@ -639,7 +554,6 @@ bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uin #define SAY_WINDSOR_6 "This is it, $N. My stuff should be in that room. Cover me, I'm going in!" #define SAY_WINDSOR_9 "Ah, there it is!" #define MOB_ENTRY_REGINALD_WINDSOR 9682 - Player* pPlayerStart; /* struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI @@ -648,7 +562,6 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI { pInstance = c->GetInstanceData(); } - void WaypointReached(uint32 i) { switch(i) @@ -693,7 +606,6 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI break; } } - void EnterCombat(Unit* who) { switch(rand()%3) @@ -703,14 +615,11 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; } } - void Reset() {} - void JustDied(Unit *slayer) { pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); } - void UpdateAI(const uint32 diff) { if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; @@ -744,7 +653,6 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI CreatureAI* GetAI_npc_marshal_windsor(Creature* pCreature) { npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature); - marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); @@ -765,10 +673,8 @@ CreatureAI* GetAI_npc_marshal_windsor(Creature* pCreature) marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); - return marshal_windsorAI; } - bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest const *quest) { if (quest->GetQuestId() == 4322) @@ -779,7 +685,6 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); pCreature->setFaction(11); } - } return false; } @@ -787,7 +692,6 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest /*###### ## npc_marshal_reginald_windsor ######*/ - #define SAY_REGINALD_WINDSOR_0_1 "Can you feel the power, $N??? It's time to ROCK!" #define SAY_REGINALD_WINDSOR_0_2 "Now we just have to free Tobias and we can get out of here. This way!" #define SAY_REGINALD_WINDSOR_5_1 "Open it." @@ -804,7 +708,6 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest #define SAY_REGINALD_WINDSOR_20_2 "Meet me at Maxwell's encampment. We'll go over the next stages of the plan there and figure out a way to decode my tablets without the decryption ring." #define MOB_ENTRY_SHILL_DINGER 9678 #define MOB_ENTRY_CREST_KILLER 9680 - int wp = 0; /* struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI @@ -812,7 +715,6 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) { } - void WaypointReached(uint32 i) { wp=i; @@ -870,12 +772,10 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI break; } } - void MoveInLineOfSight(Unit *who) { if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (who->GetTypeId() == TYPEID_PLAYER) { if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE) @@ -889,7 +789,6 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI } } } - void EnterCombat(Unit* who) { switch(rand()%3) @@ -900,12 +799,10 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI } } void Reset() {} - void JustDied(Unit *slayer) { pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); } - void UpdateAI(const uint32 diff) { if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; @@ -956,7 +853,6 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature* pCreature) { npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature); - marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); @@ -992,23 +888,19 @@ CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature* pCreature) marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); - return marshal_reginald_windsorAI; } */ /*###### ## npc_tobias_seecher ######*/ - #define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" /* struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI { npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} - void EnterCombat(Unit* who) { } void Reset() {} - void JustDied(Unit* killer) { if (IsBeingEscorted && killer == m_creature) @@ -1019,7 +911,6 @@ struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); } } - void WaypointReached(uint32 i) { switch(i) @@ -1035,7 +926,6 @@ struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI break; } } - void UpdateAI(const uint32 diff) { if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; @@ -1054,20 +944,16 @@ struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_tobias_seecher(Creature* pCreature) { npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature); - tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); - return tobias_seecherAI; } - bool GossipHello_npc_tobias_seecher(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) @@ -1077,7 +963,6 @@ bool GossipHello_npc_tobias_seecher(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_tobias_seecher(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -1090,47 +975,37 @@ bool GossipSelect_npc_tobias_seecher(Player* pPlayer, Creature* pCreature, uint3 return true; } */ - /*###### ## npc_rocknot ######*/ - #define SAY_GOT_BEER -1230000 #define SPELL_DRUNKEN_RAGE 14872 #define QUEST_ALE 4295 - struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI { npc_rocknotAI(Creature *c) : npc_escortAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 BreakKeg_Timer; uint32 BreakDoor_Timer; - void Reset() { if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - BreakKeg_Timer = 0; BreakDoor_Timer = 0; } - void DoGo(uint32 id, uint32 state) { if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(id))) pGo->SetGoState((GOState)state); } - void WaypointReached(uint32 i) { if (!pInstance) return; - switch(i) { case 1: @@ -1151,12 +1026,10 @@ struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI break; } } - void UpdateAI(const uint32 diff) { if (!pInstance) return; - if (BreakKeg_Timer) { if (BreakKeg_Timer <= diff) @@ -1166,7 +1039,6 @@ struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI BreakDoor_Timer = 1000; }else BreakKeg_Timer -= diff; } - if (BreakDoor_Timer) { if (BreakDoor_Timer <= diff) @@ -1174,44 +1046,33 @@ struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI DoGo(DATA_GO_BAR_DOOR,2); DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future //spell by trap has effect61, this indicate the bar go hostile - if (Unit *tmp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_PHALANX))) tmp->setFaction(14); - //for later, this event(s) has alot more to it. //optionally, DONE can trigger bar to go hostile. pInstance->SetData(TYPE_BAR,DONE); - BreakDoor_Timer = 0; }else BreakDoor_Timer -= diff; } - npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_rocknot(Creature* pCreature) { return new npc_rocknotAI(pCreature); } - bool ChooseReward_npc_rocknot(Player* pPlayer, Creature* pCreature, const Quest *_Quest, uint32 item) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (!pInstance) return true; - if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) return true; - if (_Quest->GetQuestId() == QUEST_ALE) { if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) pInstance->SetData(TYPE_BAR,IN_PROGRESS); - pInstance->SetData(TYPE_BAR,SPECIAL); - //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress if (pInstance->GetData(TYPE_BAR) == SPECIAL) { @@ -1221,44 +1082,35 @@ bool ChooseReward_npc_rocknot(Player* pPlayer, Creature* pCreature, const Quest pEscortAI->Start(false, false); } } - return true; } - /*###### ## ######*/ - void AddSC_blackrock_depths() { Script *newscript; - newscript = new Script; newscript->Name = "go_shadowforge_brazier"; newscript->pGOHello = &GOHello_go_shadowforge_brazier; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_ring_of_law"; newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_grimstone"; newscript->GetAI = &GetAI_npc_grimstone; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_phalanx"; newscript->GetAI = &GetAI_mob_phalanx; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kharan_mighthammer"; newscript->pGossipHello = &GossipHello_npc_kharan_mighthammer; newscript->pGossipSelect = &GossipSelect_npc_kharan_mighthammer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lokhtos_darkbargainer"; newscript->pGossipHello = &GossipHello_npc_lokhtos_darkbargainer; @@ -1271,26 +1123,22 @@ void AddSC_blackrock_depths() newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; newscript->GetAI = &GetAI_npc_dughal_stormwing; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tobias_seecher"; newscript->pGossipHello = &GossipHello_npc_tobias_seecher; newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; newscript->GetAI = &GetAI_npc_tobias_seecher; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_marshal_windsor"; newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; newscript->GetAI = &GetAI_npc_marshal_windsor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_marshal_reginald_windsor"; newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; newscript->RegisterSelf(); */ - newscript = new Script; newscript->Name = "npc_rocknot"; newscript->GetAI = &GetAI_npc_rocknot; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp index ba10c873b23..39f2be7e644 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp @@ -13,37 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ambassador_Flamelash SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_FIREBLAST 15573 - struct TRINITY_DLL_DECL boss_ambassador_flamelashAI : public ScriptedAI { boss_ambassador_flamelashAI(Creature *c) : ScriptedAI(c) {} - uint32 FireBlast_Timer; uint32 Spirit_Timer; int Rand; int RandX; int RandY; Creature* Summoned; - void Reset() { FireBlast_Timer = 2000; Spirit_Timer = 24000; } - void EnterCombat(Unit *who) {} - void SummonSpirits(Unit* victim) { Rand = rand()%10; @@ -63,20 +55,17 @@ struct TRINITY_DLL_DECL boss_ambassador_flamelashAI : public ScriptedAI if (Summoned) (Summoned->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //FireBlast_Timer if (FireBlast_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIREBLAST); FireBlast_Timer = 7000; }else FireBlast_Timer -= diff; - //Spirit_Timer if (Spirit_Timer < diff) { @@ -84,10 +73,8 @@ struct TRINITY_DLL_DECL boss_ambassador_flamelashAI : public ScriptedAI SummonSpirits(m_creature->getVictim()); SummonSpirits(m_creature->getVictim()); SummonSpirits(m_creature->getVictim()); - Spirit_Timer = 30000; }else Spirit_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -95,7 +82,6 @@ CreatureAI* GetAI_boss_ambassador_flamelash(Creature* pCreature) { return new boss_ambassador_flamelashAI (pCreature); } - void AddSC_boss_ambassador_flamelash() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_anubshiah.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_anubshiah.cpp index d5589967cac..a6589ed0fd7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_anubshiah.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_anubshiah.cpp @@ -13,32 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Anubshiah SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWBOLT 17228 #define SPELL_CURSEOFTONGUES 15470 #define SPELL_CURSEOFWEAKNESS 17227 #define SPELL_DEMONARMOR 11735 #define SPELL_ENVELOPINGWEB 15471 - struct TRINITY_DLL_DECL boss_anubshiahAI : public ScriptedAI { boss_anubshiahAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowBolt_Timer; uint32 CurseOfTongues_Timer; uint32 CurseOfWeakness_Timer; uint32 DemonArmor_Timer; uint32 EnvelopingWeb_Timer; - void Reset() { ShadowBolt_Timer = 7000; @@ -47,24 +41,20 @@ struct TRINITY_DLL_DECL boss_anubshiahAI : public ScriptedAI DemonArmor_Timer = 3000; EnvelopingWeb_Timer = 16000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT); ShadowBolt_Timer = 7000; }else ShadowBolt_Timer -= diff; - //CurseOfTongues_Timer if (CurseOfTongues_Timer < diff) { @@ -73,21 +63,18 @@ struct TRINITY_DLL_DECL boss_anubshiahAI : public ScriptedAI if (target) DoCast(target,SPELL_CURSEOFTONGUES); CurseOfTongues_Timer = 18000; }else CurseOfTongues_Timer -= diff; - //CurseOfWeakness_Timer if (CurseOfWeakness_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSEOFWEAKNESS); CurseOfWeakness_Timer = 45000; }else CurseOfWeakness_Timer -= diff; - //DemonArmor_Timer if (DemonArmor_Timer < diff) { DoCast(m_creature,SPELL_DEMONARMOR); DemonArmor_Timer = 300000; }else DemonArmor_Timer -= diff; - //EnvelopingWeb_Timer if (EnvelopingWeb_Timer < diff) { @@ -96,7 +83,6 @@ struct TRINITY_DLL_DECL boss_anubshiahAI : public ScriptedAI if (target) DoCast(target,SPELL_ENVELOPINGWEB); EnvelopingWeb_Timer = 12000; }else EnvelopingWeb_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -104,7 +90,6 @@ CreatureAI* GetAI_boss_anubshiah(Creature* pCreature) { return new boss_anubshiahAI (pCreature); } - void AddSC_boss_anubshiah() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp index 83a3839b44f..0b9c430917d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp @@ -13,59 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Emperor_Dagran_Thaurissan SD%Complete: 99 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1230001 #define SAY_SLAY -1230002 - #define SPELL_HANDOFTHAURISSAN 17492 #define SPELL_AVATAROFFLAME 15636 - struct TRINITY_DLL_DECL boss_draganthaurissanAI : public ScriptedAI { boss_draganthaurissanAI(Creature *c) : ScriptedAI(c) {} - uint32 HandOfThaurissan_Timer; uint32 AvatarOfFlame_Timer; //uint32 Counter; - void Reset() { HandOfThaurissan_Timer = 4000; AvatarOfFlame_Timer = 25000; //Counter= 0; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); m_creature->CallForHelp(VISIBLE_RANGE); } - void KilledUnit(Unit* victim) { DoScriptText(SAY_SLAY, m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (HandOfThaurissan_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_HANDOFTHAURISSAN); - //3 Hands of Thaurissan will be casted //if (Counter < 3) //{ @@ -78,23 +66,19 @@ struct TRINITY_DLL_DECL boss_draganthaurissanAI : public ScriptedAI //Counter=0; //} }else HandOfThaurissan_Timer -= diff; - //AvatarOfFlame_Timer if (AvatarOfFlame_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_AVATAROFFLAME); AvatarOfFlame_Timer = 18000; }else AvatarOfFlame_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_draganthaurissan(Creature* pCreature) { return new boss_draganthaurissanAI (pCreature); } - void AddSC_boss_draganthaurissan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp index 4c02c438347..0ba98b48998 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_General_Angerforge SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_MIGHTYBLOW 14099 #define SPELL_HAMSTRING 9080 #define SPELL_CLEAVE 20691 - struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI { boss_general_angerforgeAI(Creature *c) : ScriptedAI(c) {} - uint32 MightyBlow_Timer; uint32 HamString_Timer; uint32 Cleave_Timer; @@ -44,7 +39,6 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI int Rand2Y; Creature* SummonedAdds; Creature* SummonedMedics; - void Reset() { MightyBlow_Timer = 8000; @@ -53,11 +47,9 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI Adds_Timer = 0; Medics = false; } - void EnterCombat(Unit *who) { } - void SummonAdds(Unit* victim) { Rand1 = rand()%15; @@ -78,7 +70,6 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI if (SummonedAdds) (SummonedAdds->AI())->AttackStart(victim); } - void SummonMedics(Unit* victim) { Rand2 = rand()%10; @@ -99,34 +90,29 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI if (SummonedMedics) (SummonedMedics->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //MightyBlow_Timer if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MIGHTYBLOW); MightyBlow_Timer = 18000; }else MightyBlow_Timer -= diff; - //HamString_Timer if (HamString_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HAMSTRING); HamString_Timer = 15000; }else HamString_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 9000; }else Cleave_Timer -= diff; - //Adds_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21) { @@ -136,11 +122,9 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI SummonAdds(m_creature->getVictim()); SummonAdds(m_creature->getVictim()); SummonAdds(m_creature->getVictim()); - Adds_Timer = 25000; } else Adds_Timer -= diff; } - //Summon Medics if (!Medics && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21) { @@ -148,7 +132,6 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI SummonMedics(m_creature->getVictim()); Medics = true; } - DoMeleeAttackIfReady(); } }; @@ -156,7 +139,6 @@ CreatureAI* GetAI_boss_general_angerforge(Creature* pCreature) { return new boss_general_angerforgeAI (pCreature); } - void AddSC_boss_general_angerforge() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_gorosh_the_dervish.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_gorosh_the_dervish.cpp index 5fcb18295f0..6aa1c60252d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_gorosh_the_dervish.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_gorosh_the_dervish.cpp @@ -13,56 +13,45 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gorosh_the_Dervish SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_WHIRLWIND 15589 #define SPELL_MORTALSTRIKE 24573 - struct TRINITY_DLL_DECL boss_gorosh_the_dervishAI : public ScriptedAI { boss_gorosh_the_dervishAI(Creature *c) : ScriptedAI(c) {} - uint32 WhirlWind_Timer; uint32 MortalStrike_Timer; - void Reset() { WhirlWind_Timer = 12000; MortalStrike_Timer = 22000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //WhirlWind_Timer if (WhirlWind_Timer < diff) { DoCast(m_creature,SPELL_WHIRLWIND); WhirlWind_Timer = 15000; }else WhirlWind_Timer -= diff; - //MortalStrike_Timer if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); MortalStrike_Timer = 15000; }else MortalStrike_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -70,7 +59,6 @@ CreatureAI* GetAI_boss_gorosh_the_dervish(Creature* pCreature) { return new boss_gorosh_the_dervishAI (pCreature); } - void AddSC_boss_gorosh_the_dervish() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_grizzle.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_grizzle.cpp index 5950e92612f..560e5874c0d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_grizzle.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_grizzle.cpp @@ -13,51 +13,40 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Grizzle SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define EMOTE_GENERIC_FRENZY_KILL -1000001 - #define SPELL_GROUNDTREMOR 6524 #define SPELL_FRENZY 28371 - struct TRINITY_DLL_DECL boss_grizzleAI : public ScriptedAI { boss_grizzleAI(Creature *c) : ScriptedAI(c) {} - uint32 GroundTremor_Timer; uint32 Frenzy_Timer; - void Reset() { GroundTremor_Timer = 12000; Frenzy_Timer =0; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //GroundTremor_Timer if (GroundTremor_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_GROUNDTREMOR); GroundTremor_Timer = 8000; }else GroundTremor_Timer -= diff; - //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51) { @@ -65,11 +54,9 @@ struct TRINITY_DLL_DECL boss_grizzleAI : public ScriptedAI { DoCast(m_creature,SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - Frenzy_Timer = 15000; }else Frenzy_Timer -= diff; } - DoMeleeAttackIfReady(); } }; @@ -77,7 +64,6 @@ CreatureAI* GetAI_boss_grizzle(Creature* pCreature) { return new boss_grizzleAI (pCreature); } - void AddSC_boss_grizzle() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_high_interrogator_gerstahn.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_high_interrogator_gerstahn.cpp index 94e8b8281e1..a61e47ccfb2 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_high_interrogator_gerstahn.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_high_interrogator_gerstahn.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_High_Interrogator_Gerstahn SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWWORDPAIN 10894 #define SPELL_MANABURN 10876 #define SPELL_PSYCHICSCREAM 8122 #define SPELL_SHADOWSHIELD 22417 - struct TRINITY_DLL_DECL boss_high_interrogator_gerstahnAI : public ScriptedAI { boss_high_interrogator_gerstahnAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowWordPain_Timer; uint32 ManaBurn_Timer; uint32 PsychicScream_Timer; uint32 ShadowShield_Timer; - void Reset() { ShadowWordPain_Timer = 4000; @@ -44,17 +38,14 @@ struct TRINITY_DLL_DECL boss_high_interrogator_gerstahnAI : public ScriptedAI PsychicScream_Timer = 32000; ShadowShield_Timer = 8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ShadowWordPain_Timer if (ShadowWordPain_Timer < diff) { @@ -63,7 +54,6 @@ struct TRINITY_DLL_DECL boss_high_interrogator_gerstahnAI : public ScriptedAI if (target)DoCast(target,SPELL_SHADOWWORDPAIN); ShadowWordPain_Timer = 7000; }else ShadowWordPain_Timer -= diff; - //ManaBurn_Timer if (ManaBurn_Timer < diff) { @@ -72,21 +62,18 @@ struct TRINITY_DLL_DECL boss_high_interrogator_gerstahnAI : public ScriptedAI if (target)DoCast(target,SPELL_MANABURN); ManaBurn_Timer = 10000; }else ManaBurn_Timer -= diff; - //PsychicScream_Timer if (PsychicScream_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_PSYCHICSCREAM); PsychicScream_Timer = 30000; }else PsychicScream_Timer -= diff; - //ShadowShield_Timer if (ShadowShield_Timer < diff) { DoCast(m_creature,SPELL_SHADOWSHIELD); ShadowShield_Timer = 25000; }else ShadowShield_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -94,7 +81,6 @@ CreatureAI* GetAI_boss_high_interrogator_gerstahn(Creature* pCreature) { return new boss_high_interrogator_gerstahnAI (pCreature); } - void AddSC_boss_high_interrogator_gerstahn() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp index 773271d7e5e..dc8b9a269e9 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp @@ -13,49 +13,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Magmus SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_FIERYBURST 13900 #define SPELL_WARSTOMP 24375 - struct TRINITY_DLL_DECL boss_magmusAI : public ScriptedAI { boss_magmusAI(Creature *c) : ScriptedAI(c) {} - uint32 FieryBurst_Timer; uint32 WarStomp_Timer; - void Reset() { FieryBurst_Timer = 5000; WarStomp_Timer =0; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //FieryBurst_Timer if (FieryBurst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIERYBURST); FieryBurst_Timer = 6000; }else FieryBurst_Timer -= diff; - //WarStomp_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51) { @@ -65,7 +55,6 @@ struct TRINITY_DLL_DECL boss_magmusAI : public ScriptedAI WarStomp_Timer = 8000; }else WarStomp_Timer -= diff; } - DoMeleeAttackIfReady(); } }; @@ -73,7 +62,6 @@ CreatureAI* GetAI_boss_magmus(Creature* pCreature) { return new boss_magmusAI (pCreature); } - void AddSC_boss_magmus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_moira_bronzebeard.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_moira_bronzebeard.cpp index 63395dd5016..8687a1fbeeb 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_moira_bronzebeard.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_moira_bronzebeard.cpp @@ -13,27 +13,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Moira_Bronzbeard SD%Complete: 90 SDComment: Healing of Emperor NYI SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" - #define SPELL_HEAL 10917 #define SPELL_RENEW 10929 #define SPELL_SHIELD 10901 #define SPELL_MINDBLAST 10947 #define SPELL_SHADOWWORDPAIN 10894 #define SPELL_SMITE 10934 - struct TRINITY_DLL_DECL boss_moira_bronzebeardAI : public ScriptedAI { boss_moira_bronzebeardAI(Creature *c) : ScriptedAI(c) {} - uint32 Heal_Timer; uint32 MindBlast_Timer; uint32 ShadowWordPain_Timer; @@ -41,7 +36,6 @@ struct TRINITY_DLL_DECL boss_moira_bronzebeardAI : public ScriptedAI Unit* PlayerHolder; Unit* Target; bool Heal; - void Reset() { Target = NULL; @@ -50,45 +44,38 @@ struct TRINITY_DLL_DECL boss_moira_bronzebeardAI : public ScriptedAI ShadowWordPain_Timer = 2000; Smite_Timer = 8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //MindBlast_Timer if (MindBlast_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MINDBLAST); MindBlast_Timer = 14000; }else MindBlast_Timer -= diff; - //ShadowWordPain_Timer if (ShadowWordPain_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWWORDPAIN); ShadowWordPain_Timer = 18000; }else ShadowWordPain_Timer -= diff; - //Smite_Timer if (Smite_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SMITE); Smite_Timer = 10000; }else Smite_Timer -= diff; - } }; CreatureAI* GetAI_boss_moira_bronzebeard(Creature* pCreature) { return new boss_moira_bronzebeardAI (pCreature); } - void AddSC_boss_moira_bronzebeard() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp index 80b2ea8ac08..57ffc0bb52c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Tomb_Of_Seven SD%Complete: 90 SDComment: Learning Smelt Dark Iron if tribute quest rewarded. Missing event. SDCategory: Blackrock Depths EndScriptData */ - #include "precompiled.h" #include "def_blackrock_depths.h" - enum eEnums { SPELL_SMELT_DARK_IRON = 14891, @@ -31,24 +28,19 @@ enum eEnums QUEST_SPECTRAL_CHALICE = 4083, SKILLPOINT_MIN = 230 }; - #define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron" #define GOSSIP_ITEM_TEACH_2 "Continue..." #define GOSSIP_ITEM_TEACH_3 "[PH] Continue..." #define GOSSIP_ITEM_TRIBUTE "I want to pay tribute" - bool GossipHello_boss_gloomrel(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= SKILLPOINT_MIN && !pPlayer->HasSpell(SPELL_SMELT_DARK_IRON)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= SKILLPOINT_MIN) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_boss_gloomrel(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -76,7 +68,6 @@ bool GossipSelect_boss_gloomrel(Player* pPlayer, Creature* pCreature, uint32 uiS } return true; } - enum eSpells { SPELL_SHADOWBOLTVOLLEY = 15245, @@ -85,14 +76,12 @@ enum eSpells SPELL_DEMONARMOR = 13787, SPELL_SUMMON_VOIDWALKERS = 15092 }; - struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI { boss_doomrelAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; uint32 ShadowVolley_Timer; uint32 Immolate_Timer; @@ -103,7 +92,6 @@ struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI int RandX; int RandY; Creature* Summoned; - void Reset() { ShadowVolley_Timer = 10000; @@ -111,23 +99,18 @@ struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI CurseOfWeakness_Timer = 5000; DemonArmor_Timer = 16000; Voidwalkers = false; - m_creature->setFaction(FACTION_FRIEND); - // was set before event start, so set again m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - if (pInstance) if (pInstance->GetData(DATA_GHOSTKILL) >= 7) m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); else m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - void EnterCombat(Unit *who) { } - void EnterEvadeMode() { m_creature->RemoveAllAuras(); @@ -140,75 +123,61 @@ struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI if (pInstance) pInstance->SetData64(DATA_EVENSTARTER, 0); } - void JustDied(Unit *who) { if (pInstance) pInstance->SetData(DATA_GHOSTKILL, 1); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowVolley_Timer if (ShadowVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWBOLTVOLLEY); ShadowVolley_Timer = 12000; }else ShadowVolley_Timer -= diff; - //Immolate_Timer if (Immolate_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_IMMOLATE); - Immolate_Timer = 25000; }else Immolate_Timer -= diff; - //CurseOfWeakness_Timer if (CurseOfWeakness_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSEOFWEAKNESS); CurseOfWeakness_Timer = 45000; }else CurseOfWeakness_Timer -= diff; - //DemonArmor_Timer if (DemonArmor_Timer < diff) { DoCast(m_creature,SPELL_DEMONARMOR); DemonArmor_Timer = 300000; }else DemonArmor_Timer -= diff; - //Summon Voidwalkers if (!Voidwalkers && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51) { m_creature->CastSpell(m_creature->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); Voidwalkers = true; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_doomrel(Creature* pCreature) { return new boss_doomrelAI (pCreature); } - #define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" #define GOSSIP_SELECT_DOOMREL "[PH] Continue..." - bool GossipHello_boss_doomrel(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(2601, pCreature->GetGUID()); - return true; } - bool GossipSelect_boss_doomrel(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -230,17 +199,14 @@ bool GossipSelect_boss_doomrel(Player* pPlayer, Creature* pCreature, uint32 uiSe } return true; } - void AddSC_boss_tomb_of_seven() { Script *newscript; - newscript = new Script; newscript->Name = "boss_gloomrel"; newscript->pGossipHello = &GossipHello_boss_gloomrel; newscript->pGossipSelect = &GossipSelect_boss_gloomrel; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_doomrel"; newscript->GetAI = &GetAI_boss_doomrel; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/def_blackrock_depths.h b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/def_blackrock_depths.h index 6ced6bafe15..4f31378a495 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/def_blackrock_depths.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/def_blackrock_depths.h @@ -1,14 +1,11 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_BRD_H #define DEF_BRD_H - #define FACTION_NEUTRAL 734 #define FACTION_HOSTILE 754 #define FACTION_FRIEND 35 - enum eTypes { TYPE_RING_OF_LAW = 1, @@ -17,20 +14,16 @@ enum eTypes TYPE_TOMB_OF_SEVEN = 4, TYPE_LYCEUM = 5, TYPE_IRON_HALL = 6, - DATA_EMPEROR = 10, DATA_PHALANX = 11, - DATA_ARENA1 = 12, DATA_ARENA2 = 13, DATA_ARENA3 = 14, DATA_ARENA4 = 15, - DATA_GO_BAR_KEG = 16, DATA_GO_BAR_KEG_TRAP = 17, DATA_GO_BAR_DOOR = 18, DATA_GO_CHALICE = 19, - DATA_GHOSTKILL = 20, DATA_EVENSTARTER = 21 }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp index f14b7603fa7..c17c27209e2 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Blackrock_Depths SD%Complete: 100 SDComment: SDCategory: Blackrock Depths EndScriptData */ - /* update `creature_template` set `npcflag`='1',`ScriptName`='npc_dughal_stormwing' where `entry`='9022'; update `creature_template` set `ScriptName`='npc_marshal_windsor' where `entry`='9023'; @@ -28,16 +26,12 @@ update `creature_template` set `ScriptName`='npc_marshal_reginald_windsor' where update `creature_template` set `npcflag`='1',`ScriptName`='npc_tobias_seecher' where `entry`='9679'; update `instance_template` set `script`='instance_blackrock_depths' where `map`='230'; */ - #include "precompiled.h" #include "def_blackrock_depths.h" - #define TIMER_TOMBOFTHESEVEN 15000 - enum eEnums { MAX_ENCOUNTER = 6, - NPC_EMPEROR = 9019, NPC_PHALANX = 9502, NPC_ANGERREL = 9035, @@ -47,7 +41,6 @@ enum eEnums NPC_SEETHREL = 9038, NPC_GLOOMREL = 9037, NPC_DOOMREL = 9039, - GO_ARENA1 = 161525, GO_ARENA2 = 161522, GO_ARENA3 = 161524, @@ -65,21 +58,16 @@ enum eEnums GO_GOLEM_ROOM_N = 170573, GO_GOLEM_ROOM_S = 170574, GO_THONE_ROOM = 170575, - GO_SPECTRAL_CHALICE = 164869, GO_CHEST_SEVEN = 169243 }; - struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance { instance_blackrock_depths(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - uint64 EmperorGUID; uint64 PhalanxGUID; - uint64 GoArena1GUID; uint64 GoArena2GUID; uint64 GoArena3GUID; @@ -98,21 +86,17 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance uint64 GoGolemSGUID; uint64 GoThoneGUID; uint64 GoChestGUID; - uint32 BarAleCount; uint32 GhostKillCount; uint64 TombBossGUIDs[7]; uint64 TombEventStarterGUID; uint32 TombTimer; uint32 TombEventCounter; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - EmperorGUID = 0; PhalanxGUID = 0; - GoArena1GUID = 0; GoArena2GUID = 0; GoArena3GUID = 0; @@ -131,17 +115,14 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance GoGolemSGUID = 0; GoThoneGUID = 0; GoChestGUID = 0; - BarAleCount = 0; GhostKillCount = 0; TombEventStarterGUID = 0; TombTimer = TIMER_TOMBOFTHESEVEN; TombEventCounter = 0; - - for(uint8 i = 0; i < 7; ++i) + for (uint8 i = 0; i < 7; ++i) TombBossGUIDs[i] = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -157,7 +138,6 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -188,11 +168,9 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance case GO_CHEST_SEVEN: GoChestGUID = pGo->GetGUID(); break; } } - void SetData64(uint32 type, uint64 data) { debug_log("TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data %u)", type, data); - switch(type) { case DATA_EVENSTARTER: @@ -204,11 +182,9 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { debug_log("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); - switch(type) { case TYPE_RING_OF_LAW: @@ -236,22 +212,17 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance GhostKillCount += data; break; } - if (data == DONE || GhostKillCount >= 7) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << GhostKillCount; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint32 GetData(uint32 type) { switch(type) @@ -276,7 +247,6 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -304,12 +274,10 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance } return 0; } - std::string GetSaveData() { return str_data; } - void Load(const char* in) { if (!in) @@ -317,24 +285,19 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> GhostKillCount; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; if (GhostKillCount > 0 && GhostKillCount < 7) GhostKillCount = 0;//reset tomb of seven event if (GhostKillCount > 7) GhostKillCount = 7; - OUT_LOAD_INST_DATA_COMPLETE; } - void TombOfSevenEvent() { if (GhostKillCount < 7 && TombBossGUIDs[TombEventCounter]) @@ -348,12 +311,11 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance } } } - void TombOfSevenReset() { HandleGameObject(GoTombExitGUID,false);//event reseted, close exit door HandleGameObject(GoTombEnterGUID,true);//event reseted, open entrance door - for(uint8 i = 0; i < 7; ++i) + for (uint8 i = 0; i < 7; ++i) { if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) { @@ -376,14 +338,12 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance TombTimer = TIMER_TOMBOFTHESEVEN; SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); } - void TombOfSevenStart() { HandleGameObject(GoTombExitGUID,false);//event started, close exit door HandleGameObject(GoTombEnterGUID,false);//event started, close entrance door SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS); } - void TombOfSevenEnd() { DoRespawnGameObject(GoChestGUID,DAY); @@ -407,12 +367,10 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance TombOfSevenEnd(); } }; - InstanceData* GetInstanceData_instance_blackrock_depths(Map* pMap) { return new instance_blackrock_depths(pMap); } - void AddSC_instance_blackrock_depths() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_drakkisath.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_drakkisath.cpp index 5aa5ea42520..28a9d09aa0d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_drakkisath.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_drakkisath.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Drakkisath SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_FIRENOVA 23462 #define SPELL_CLEAVE 20691 #define SPELL_CONFLIGURATION 16805 #define SPELL_THUNDERCLAP 15548 //Not sure if right ID. 23931 would be a harder possibility. - struct TRINITY_DLL_DECL boss_drakkisathAI : public ScriptedAI { boss_drakkisathAI(Creature *c) : ScriptedAI(c) {} - uint32 FireNova_Timer; uint32 Cleave_Timer; uint32 Confliguration_Timer; uint32 Thunderclap_Timer; - void Reset() { FireNova_Timer = 6000; @@ -44,45 +38,38 @@ struct TRINITY_DLL_DECL boss_drakkisathAI : public ScriptedAI Confliguration_Timer = 15000; Thunderclap_Timer = 17000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //FireNova_Timer if (FireNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIRENOVA); FireNova_Timer = 10000; }else FireNova_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 8000; }else Cleave_Timer -= diff; - //Confliguration_Timer if (Confliguration_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CONFLIGURATION); Confliguration_Timer = 18000; }else Confliguration_Timer -= diff; - //Thunderclap_Timer if (Thunderclap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); Thunderclap_Timer = 20000; }else Thunderclap_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -90,7 +77,6 @@ CreatureAI* GetAI_boss_drakkisath(Creature* pCreature) { return new boss_drakkisathAI (pCreature); } - void AddSC_boss_drakkisath() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_gyth.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_gyth.cpp index 423a5cc1268..d37d03d07b0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_gyth.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_gyth.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gyth SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_CORROSIVEACID 20667 #define SPELL_FREEZE 18763 #define SPELL_FLAMEBREATH 20712 - struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI { boss_gythAI(Creature *c) : ScriptedAI(c) {} - uint32 Aggro_Timer; uint32 Dragons_Timer; uint32 Orc_Timer; @@ -39,7 +34,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI uint32 Flamebreath_Timer; uint32 Line1Count; uint32 Line2Count; - bool Event; bool SummonedDragons; bool SummonedOrcs; @@ -47,7 +41,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI bool bAggro; bool RootSelf; Creature *SummonedCreature; - void Reset() { Dragons_Timer = 3000; @@ -62,7 +55,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI SummonedRend = false; bAggro = false; RootSelf = false; - // how many times should the two lines of summoned creatures be spawned // min 2 x 2, max 7 lines of attack in total Line1Count = rand() % 4 + 2; @@ -70,16 +62,13 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI Line2Count = rand() % (5 - Line1Count) + 2; else Line2Count = 2; - //Invisible for event start m_creature->SetDisplayId(11686); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) { } - void SummonCreatureWithRandomTarget(uint32 creatureId) { Unit* Summoned = m_creature->SummonCreature(creatureId, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000); @@ -90,22 +79,18 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI Summoned->AddThreat(target, 1.0f); } } - void UpdateAI(const uint32 diff) { //char buf[200]; - //Return since we have no target if (!UpdateVictim()) return; - if (!RootSelf) { //m_creature->m_canMove = true; DoCast(m_creature, 33356); RootSelf = true; } - if (!bAggro && Line1Count == 0 && Line2Count == 0) { if (Aggro_Timer < diff) @@ -117,7 +102,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } else Aggro_Timer -= diff; } - // Summon Dragon pack. 2 Dragons and 3 Whelps if (!bAggro && !SummonedRend && Line1Count > 0) { @@ -132,7 +116,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI Dragons_Timer = 60000; } else Dragons_Timer -= diff; } - //Summon Orc pack. 1 Orc Handler 1 Elite Dragonkin and 3 Whelps if (!bAggro && !SummonedRend && Line1Count == 0 && Line2Count > 0) { @@ -147,7 +130,6 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI Orc_Timer = 60000; } else Orc_Timer -= diff; } - // we take part in the fight if (bAggro) { @@ -157,21 +139,18 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_CORROSIVEACID); CorrosiveAcid_Timer = 7000; } else CorrosiveAcid_Timer -= diff; - // Freeze_Timer if (Freeze_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FREEZE); Freeze_Timer = 16000; } else Freeze_Timer -= diff; - // Flamebreath_Timer if (Flamebreath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMEBREATH); Flamebreath_Timer = 10500; } else Flamebreath_Timer -= diff; - //Summon Rend if (!SummonedRend && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11 && m_creature->GetHealth() > 0) @@ -184,17 +163,14 @@ struct TRINITY_DLL_DECL boss_gythAI : public ScriptedAI m_creature->SummonCreature(10429, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000); SummonedRend = true; } - DoMeleeAttackIfReady(); } // end if Aggro } }; - CreatureAI* GetAI_boss_gyth(Creature* pCreature) { return new boss_gythAI (pCreature); } - void AddSC_boss_gyth() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_halycon.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_halycon.cpp index 6937aae0dc5..bcde2df4baf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_halycon.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_halycon.cpp @@ -13,70 +13,57 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Halycon SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_CROWDPUMMEL 10887 #define SPELL_MIGHTYBLOW 14099 - #define ADD_1X -169.839203 #define ADD_1Y -324.961395 #define ADD_1Z 64.401443 #define ADD_1O 3.124724 - struct TRINITY_DLL_DECL boss_halyconAI : public ScriptedAI { boss_halyconAI(Creature *c) : ScriptedAI(c) {} - uint32 CrowdPummel_Timer; uint32 MightyBlow_Timer; bool Summoned; - void Reset() { CrowdPummel_Timer = 8000; MightyBlow_Timer = 14000; Summoned = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //CrowdPummel_Timer if (CrowdPummel_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CROWDPUMMEL); CrowdPummel_Timer = 14000; }else CrowdPummel_Timer -= diff; - //MightyBlow_Timer if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MIGHTYBLOW); MightyBlow_Timer = 10000; }else MightyBlow_Timer -= diff; - //Summon Gizrul if (!Summoned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25) { m_creature->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); Summoned = true; } - DoMeleeAttackIfReady(); } }; @@ -84,7 +71,6 @@ CreatureAI* GetAI_boss_halycon(Creature* pCreature) { return new boss_halyconAI (pCreature); } - void AddSC_boss_halycon() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_highlord_omokk.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_highlord_omokk.cpp index 5fccc3333a5..edd5d039d4d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_highlord_omokk.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_highlord_omokk.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Highlord_Omokk SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_WARSTOMP 24375 #define SPELL_CLEAVE 15579 #define SPELL_STRIKE 18368 @@ -30,11 +27,9 @@ EndScriptData */ #define SPELL_SUNDERARMOR 24317 #define SPELL_KNOCKAWAY 20686 #define SPELL_SLOW 22356 - struct TRINITY_DLL_DECL boss_highlordomokkAI : public ScriptedAI { boss_highlordomokkAI(Creature *c) : ScriptedAI(c) {} - uint32 WarStomp_Timer; uint32 Cleave_Timer; uint32 Strike_Timer; @@ -42,7 +37,6 @@ struct TRINITY_DLL_DECL boss_highlordomokkAI : public ScriptedAI uint32 SunderArmor_Timer; uint32 KnockAway_Timer; uint32 Slow_Timer; - void Reset() { WarStomp_Timer = 15000; @@ -53,66 +47,56 @@ struct TRINITY_DLL_DECL boss_highlordomokkAI : public ScriptedAI KnockAway_Timer = 18000; Slow_Timer = 24000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //WarStomp_Timer if (WarStomp_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WARSTOMP); WarStomp_Timer = 14000; }else WarStomp_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 8000; }else Cleave_Timer -= diff; - //Strike_Timer if (Strike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_STRIKE); Strike_Timer = 10000; }else Strike_Timer -= diff; - //Rend_Timer if (Rend_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_REND); Rend_Timer = 18000; }else Rend_Timer -= diff; - //SunderArmor_Timer if (SunderArmor_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUNDERARMOR); SunderArmor_Timer = 25000; }else SunderArmor_Timer -= diff; - //KnockAway_Timer if (KnockAway_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKAWAY); KnockAway_Timer = 12000; }else KnockAway_Timer -= diff; - //Slow_Timer if (Slow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SLOW); Slow_Timer = 18000; }else Slow_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -120,7 +104,6 @@ CreatureAI* GetAI_boss_highlordomokk(Creature* pCreature) { return new boss_highlordomokkAI (pCreature); } - void AddSC_boss_highlordomokk() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp index 61a92ebfe40..cc858a33628 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp @@ -13,61 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Mother_Smolderweb SD%Complete: 100 SDComment: Uncertain how often mother's milk is casted SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_CRYSTALIZE 16104 #define SPELL_MOTHERSMILK 16468 #define SPELL_SUMMON_SPIRE_SPIDERLING 16103 - struct TRINITY_DLL_DECL boss_mothersmolderwebAI : public ScriptedAI { boss_mothersmolderwebAI(Creature *c) : ScriptedAI(c) {} - uint32 Crystalize_Timer; uint32 MothersMilk_Timer; - void Reset() { Crystalize_Timer = 20000; MothersMilk_Timer = 10000; } - void EnterCombat(Unit *who) { } - void DamageTaken(Unit *done_by, uint32 &damage) { if (m_creature->GetHealth() <= damage) m_creature->CastSpell(m_creature,SPELL_SUMMON_SPIRE_SPIDERLING,true); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Crystalize_Timer if (Crystalize_Timer < diff) { DoCast(m_creature,SPELL_CRYSTALIZE); Crystalize_Timer = 15000; }else Crystalize_Timer -= diff; - //MothersMilk_Timer if (MothersMilk_Timer < diff) { DoCast(m_creature,SPELL_MOTHERSMILK); MothersMilk_Timer = 5000+rand()%7500; }else MothersMilk_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -75,7 +63,6 @@ CreatureAI* GetAI_boss_mothersmolderweb(Creature* pCreature) { return new boss_mothersmolderwebAI (pCreature); } - void AddSC_boss_mothersmolderweb() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_overlord_wyrmthalak.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_overlord_wyrmthalak.cpp index 3e5611da95a..285c455d437 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_overlord_wyrmthalak.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_overlord_wyrmthalak.cpp @@ -13,42 +13,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Overlord_Wyrmthalak SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_BLASTWAVE 11130 #define SPELL_SHOUT 23511 #define SPELL_CLEAVE 20691 #define SPELL_KNOCKAWAY 20686 - #define ADD_1X -39.355381 #define ADD_1Y -513.456482 #define ADD_1Z 88.472046 #define ADD_1O 4.679872 - #define ADD_2X -49.875881 #define ADD_2Y -511.896942 #define ADD_2Z 88.195160 #define ADD_2O 4.613114 - struct TRINITY_DLL_DECL boss_overlordwyrmthalakAI : public ScriptedAI { boss_overlordwyrmthalakAI(Creature *c) : ScriptedAI(c) {} - uint32 BlastWave_Timer; uint32 Shout_Timer; uint32 Cleave_Timer; uint32 Knockaway_Timer; bool Summoned; Creature *SummonedCreature; - void Reset() { BlastWave_Timer = 20000; @@ -57,51 +49,43 @@ struct TRINITY_DLL_DECL boss_overlordwyrmthalakAI : public ScriptedAI Knockaway_Timer = 12000; Summoned = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //BlastWave_Timer if (BlastWave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLASTWAVE); BlastWave_Timer = 20000; }else BlastWave_Timer -= diff; - //Shout_Timer if (Shout_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHOUT); Shout_Timer = 10000; }else Shout_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //Knockaway_Timer if (Knockaway_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKAWAY); Knockaway_Timer = 14000; }else Knockaway_Timer -= diff; - //Summon two Beserks if (!Summoned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - SummonedCreature = m_creature->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); if (SummonedCreature) (SummonedCreature->AI())->AttackStart(target); @@ -110,7 +94,6 @@ struct TRINITY_DLL_DECL boss_overlordwyrmthalakAI : public ScriptedAI (SummonedCreature->AI())->AttackStart(target); Summoned = true; } - DoMeleeAttackIfReady(); } }; @@ -118,7 +101,6 @@ CreatureAI* GetAI_boss_overlordwyrmthalak(Creature* pCreature) { return new boss_overlordwyrmthalakAI (pCreature); } - void AddSC_boss_overlordwyrmthalak() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_pyroguard_emberseer.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_pyroguard_emberseer.cpp index 9b9460181c2..36d0b38b304 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_pyroguard_emberseer.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_pyroguard_emberseer.cpp @@ -13,59 +13,48 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Pyroguard_Emberseer SD%Complete: 100 SDComment: Event to activate Emberseer NYI SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_FIRENOVA 23462 #define SPELL_FLAMEBUFFET 23341 #define SPELL_PYROBLAST 17274 - struct TRINITY_DLL_DECL boss_pyroguard_emberseerAI : public ScriptedAI { boss_pyroguard_emberseerAI(Creature *c) : ScriptedAI(c) {} - uint32 FireNova_Timer; uint32 FlameBuffet_Timer; uint32 PyroBlast_Timer; - void Reset() { FireNova_Timer = 6000; FlameBuffet_Timer = 3000; PyroBlast_Timer = 14000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //FireNova_Timer if (FireNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIRENOVA); FireNova_Timer = 6000; }else FireNova_Timer -= diff; - //FlameBuffet_Timer if (FlameBuffet_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMEBUFFET); FlameBuffet_Timer = 14000; }else FlameBuffet_Timer -= diff; - //PyroBlast_Timer if (PyroBlast_Timer < diff) { @@ -74,7 +63,6 @@ struct TRINITY_DLL_DECL boss_pyroguard_emberseerAI : public ScriptedAI if (target) DoCast(target,SPELL_PYROBLAST); PyroBlast_Timer = 15000; }else PyroBlast_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -82,7 +70,6 @@ CreatureAI* GetAI_boss_pyroguard_emberseer(Creature* pCreature) { return new boss_pyroguard_emberseerAI (pCreature); } - void AddSC_boss_pyroguard_emberseer() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_quartermaster_zigris.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_quartermaster_zigris.cpp index a8c560c71c7..5c295d97f12 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_quartermaster_zigris.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_quartermaster_zigris.cpp @@ -13,60 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Quartmaster_Zigris SD%Complete: 100 SDComment: Needs revision SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_SHOOT 16496 #define SPELL_STUNBOMB 16497 #define SPELL_HEALING_POTION 15504 #define SPELL_HOOKEDNET 15609 - struct TRINITY_DLL_DECL boss_quatermasterzigrisAI : public ScriptedAI { boss_quatermasterzigrisAI(Creature *c) : ScriptedAI(c) {} - uint32 Shoot_Timer; uint32 StunBomb_Timer; //uint32 HelingPotion_Timer; - void Reset() { Shoot_Timer = 1000; StunBomb_Timer = 16000; //HelingPotion_Timer = 25000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Shoot_Timer if (Shoot_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHOOT); Shoot_Timer = 500; }else Shoot_Timer -= diff; - //StunBomb_Timer if (StunBomb_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_STUNBOMB); StunBomb_Timer = 14000; }else StunBomb_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -74,7 +63,6 @@ CreatureAI* GetAI_boss_quatermasterzigris(Creature* pCreature) { return new boss_quatermasterzigrisAI (pCreature); } - void AddSC_boss_quatermasterzigris() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_rend_blackhand.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_rend_blackhand.cpp index cd2aa32039e..28c1ffcf0d8 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_rend_blackhand.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_rend_blackhand.cpp @@ -13,66 +13,54 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Rend_Blackhand SD%Complete: 100 SDComment: Intro event NYI SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_WHIRLWIND 26038 #define SPELL_CLEAVE 20691 #define SPELL_THUNDERCLAP 23931 //Not sure if he cast this spell - struct TRINITY_DLL_DECL boss_rend_blackhandAI : public ScriptedAI { boss_rend_blackhandAI(Creature *c) : ScriptedAI(c) {} - uint32 WhirlWind_Timer; uint32 Cleave_Timer; uint32 Thunderclap_Timer; - void Reset() { WhirlWind_Timer = 20000; Cleave_Timer = 5000; Thunderclap_Timer = 9000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //WhirlWind_Timer if (WhirlWind_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WHIRLWIND); WhirlWind_Timer = 18000; }else WhirlWind_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 10000; }else Cleave_Timer -= diff; - //Thunderclap_Timer if (Thunderclap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); Thunderclap_Timer = 16000; }else Thunderclap_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -80,7 +68,6 @@ CreatureAI* GetAI_boss_rend_blackhand(Creature* pCreature) { return new boss_rend_blackhandAI (pCreature); } - void AddSC_boss_rend_blackhand() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_shadow_hunter_voshgajin.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_shadow_hunter_voshgajin.cpp index 3e4be74b777..4525722f3e7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_shadow_hunter_voshgajin.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_shadow_hunter_voshgajin.cpp @@ -13,54 +13,43 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Shadow_Hunter_Voshgajin SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_CURSEOFBLOOD 24673 #define SPELL_HEX 16708 #define SPELL_CLEAVE 20691 - struct TRINITY_DLL_DECL boss_shadowvoshAI : public ScriptedAI { boss_shadowvoshAI(Creature *c) : ScriptedAI(c) {} - uint32 CurseOfBlood_Timer; uint32 Hex_Timer; uint32 Cleave_Timer; - void Reset() { CurseOfBlood_Timer = 2000; Hex_Timer = 8000; Cleave_Timer = 14000; - //m_creature->CastSpell(m_creature,SPELL_ICEARMOR,true); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //CurseOfBlood_Timer if (CurseOfBlood_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSEOFBLOOD); CurseOfBlood_Timer = 45000; }else CurseOfBlood_Timer -= diff; - //Hex_Timer if (Hex_Timer < diff) { @@ -69,14 +58,12 @@ struct TRINITY_DLL_DECL boss_shadowvoshAI : public ScriptedAI if (target) DoCast(target,SPELL_HEX); Hex_Timer = 15000; }else Hex_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -84,7 +71,6 @@ CreatureAI* GetAI_boss_shadowvosh(Creature* pCreature) { return new boss_shadowvoshAI (pCreature); } - void AddSC_boss_shadowvosh() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_the_beast.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_the_beast.cpp index 0776c155562..971d4551806 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_the_beast.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_the_beast.cpp @@ -13,52 +13,42 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_The_Best SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_FLAMEBREAK 16785 #define SPELL_IMMOLATE 20294 #define SPELL_TERRIFYINGROAR 14100 - struct TRINITY_DLL_DECL boss_thebeastAI : public ScriptedAI { boss_thebeastAI(Creature *c) : ScriptedAI(c) {} - uint32 Flamebreak_Timer; uint32 Immolate_Timer; uint32 TerrifyingRoar_Timer; - void Reset() { Flamebreak_Timer = 12000; Immolate_Timer = 3000; TerrifyingRoar_Timer = 23000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Flamebreak_Timer if (Flamebreak_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMEBREAK); Flamebreak_Timer = 10000; }else Flamebreak_Timer -= diff; - //Immolate_Timer if (Immolate_Timer < diff) { @@ -67,14 +57,12 @@ struct TRINITY_DLL_DECL boss_thebeastAI : public ScriptedAI if (target) DoCast(target,SPELL_IMMOLATE); Immolate_Timer = 8000; }else Immolate_Timer -= diff; - //TerrifyingRoar_Timer if (TerrifyingRoar_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TERRIFYINGROAR); TerrifyingRoar_Timer = 20000; }else TerrifyingRoar_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -82,7 +70,6 @@ CreatureAI* GetAI_boss_thebeast(Creature* pCreature) { return new boss_thebeastAI (pCreature); } - void AddSC_boss_thebeast() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_warmaster_voone.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_warmaster_voone.cpp index 26fe20f8b05..428c570d086 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_warmaster_voone.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_warmaster_voone.cpp @@ -13,34 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warmaster_Voone SD%Complete: 100 SDComment: SDCategory: Blackrock Spire EndScriptData */ - #include "precompiled.h" - #define SPELL_SNAPKICK 15618 #define SPELL_CLEAVE 15579 #define SPELL_UPPERCUT 10966 #define SPELL_MORTALSTRIKE 16856 #define SPELL_PUMMEL 15615 #define SPELL_THROWAXE 16075 - struct TRINITY_DLL_DECL boss_warmastervooneAI : public ScriptedAI { boss_warmastervooneAI(Creature *c) : ScriptedAI(c) {} - uint32 Snapkick_Timer; uint32 Cleave_Timer; uint32 Uppercut_Timer; uint32 MortalStrike_Timer; uint32 Pummel_Timer; uint32 ThrowAxe_Timer; - void Reset() { Snapkick_Timer = 8000; @@ -50,59 +44,50 @@ struct TRINITY_DLL_DECL boss_warmastervooneAI : public ScriptedAI Pummel_Timer = 32000; ThrowAxe_Timer = 1000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Snapkick_Timer if (Snapkick_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SNAPKICK); Snapkick_Timer = 6000; }else Snapkick_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 12000; }else Cleave_Timer -= diff; - //Uppercut_Timer if (Uppercut_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_UPPERCUT); Uppercut_Timer = 14000; }else Uppercut_Timer -= diff; - //MortalStrike_Timer if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); MortalStrike_Timer = 10000; }else MortalStrike_Timer -= diff; - //Pummel_Timer if (Pummel_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_PUMMEL); Pummel_Timer = 16000; }else Pummel_Timer -= diff; - //ThrowAxe_Timer if (ThrowAxe_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THROWAXE); ThrowAxe_Timer = 8000; }else ThrowAxe_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -110,7 +95,6 @@ CreatureAI* GetAI_boss_warmastervoone(Creature* pCreature) { return new boss_warmastervooneAI (pCreature); } - void AddSC_boss_warmastervoone() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_broodlord_lashlayer.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_broodlord_lashlayer.cpp index 71b9850454f..a6842af41c0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_broodlord_lashlayer.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_broodlord_lashlayer.cpp @@ -13,33 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Broodlord_Lashlayer SD%Complete: 100 SDComment: SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1469000 #define SAY_LEASH -1469001 - #define SPELL_CLEAVE 26350 #define SPELL_BLASTWAVE 23331 #define SPELL_MORTALSTRIKE 24573 #define SPELL_KNOCKBACK 25778 - struct TRINITY_DLL_DECL boss_broodlordAI : public ScriptedAI { boss_broodlordAI(Creature *c) : ScriptedAI(c) {} - uint32 Cleave_Timer; uint32 BlastWave_Timer; uint32 MortalStrike_Timer; uint32 KnockBack_Timer; - void Reset() { Cleave_Timer = 8000; //These times are probably wrong @@ -47,52 +40,43 @@ struct TRINITY_DLL_DECL boss_broodlordAI : public ScriptedAI MortalStrike_Timer = 20000; KnockBack_Timer = 30000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - // BlastWave if (BlastWave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLASTWAVE); BlastWave_Timer = 8000 + rand()%8000; }else BlastWave_Timer -= diff; - //MortalStrike_Timer if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); MortalStrike_Timer = 25000 + rand()%10000; }else MortalStrike_Timer -= diff; - if (KnockBack_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKBACK); //Drop 50% aggro if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-50); - KnockBack_Timer = 15000 + rand()%15000; }else KnockBack_Timer -= diff; - if (EnterEvadeIfOutOfCombatArea(diff)) DoScriptText(SAY_LEASH, m_creature); - DoMeleeAttackIfReady(); } }; @@ -100,7 +84,6 @@ CreatureAI* GetAI_boss_broodlord(Creature* pCreature) { return new boss_broodlordAI (pCreature); } - void AddSC_boss_broodlord() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp index b36b4afe7b1..9d492ce8460 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Chromaggus SD%Complete: 95 SDComment: Chromatic Mutation disabled due to lack of core support SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define EMOTE_FRENZY -1469002 #define EMOTE_SHIMMER -1469003 - //These spells are actually called elemental shield //What they do is decrease all damage by 75% then they increase //One school of damage by 1100% @@ -34,13 +30,11 @@ EndScriptData */ #define SPELL_SHADOW_VURNALBILTY 22279 #define SPELL_NATURE_VURNALBILTY 22280 #define SPELL_ARCANE_VURNALBILTY 22281 - #define SPELL_INCINERATE 23308 //Incinerate 23308,23309 #define SPELL_TIMELAPSE 23310 //Time lapse 23310, 23311(old threat mod that was removed in 2.01) #define SPELL_CORROSIVEACID 23313 //Corrosive Acid 23313, 23314 #define SPELL_IGNITEFLESH 23315 //Ignite Flesh 23315,23316 #define SPELL_FROSTBURN 23187 //Frost burn 23187, 23189 - //Brood Affliction 23173 - Scripted Spell that cycles through all targets within 100 yards and has a chance to cast one of the afflictions on them //Since Scripted spells arn't coded I'll just write a function that does the same thing #define SPELL_BROODAF_BLUE 23153 //Blue affliction 23153 @@ -48,12 +42,9 @@ EndScriptData */ #define SPELL_BROODAF_RED 23155 //Red affliction 23155 (23168 on death) #define SPELL_BROODAF_BRONZE 23170 //Bronze Affliction 23170 #define SPELL_BROODAF_GREEN 23169 //Brood Affliction Green 23169 - #define SPELL_CHROMATIC_MUT_1 23174 //Spell cast on player if they get all 5 debuffs - #define SPELL_FRENZY 28371 //The frenzy spell may be wrong #define SPELL_ENRAGE 28747 - struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI { boss_chromaggusAI(Creature *c) : ScriptedAI(c) @@ -82,7 +73,6 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI Breath1_Spell = SPELL_INCINERATE; Breath2_Spell = SPELL_FROSTBURN; break; - //B1 - TL case 4: Breath1_Spell = SPELL_TIMELAPSE; @@ -100,7 +90,6 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI Breath1_Spell = SPELL_TIMELAPSE; Breath2_Spell = SPELL_FROSTBURN; break; - //B1 - Acid case 8: Breath1_Spell = SPELL_CORROSIVEACID; @@ -118,7 +107,6 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI Breath1_Spell = SPELL_CORROSIVEACID; Breath2_Spell = SPELL_FROSTBURN; break; - //B1 - Ignite case 12: Breath1_Spell = SPELL_IGNITEFLESH; @@ -136,7 +124,6 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI Breath1_Spell = SPELL_IGNITEFLESH; Breath2_Spell = SPELL_FROSTBURN; break; - //B1 - Frost case 16: Breath1_Spell = SPELL_FROSTBURN; @@ -155,50 +142,40 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI Breath2_Spell = SPELL_IGNITEFLESH; break; }; - EnterEvadeMode(); } - uint32 Breath1_Spell; uint32 Breath2_Spell; uint32 CurrentVurln_Spell; - uint32 Shimmer_Timer; uint32 Breath1_Timer; uint32 Breath2_Timer; uint32 Affliction_Timer; uint32 Frenzy_Timer; bool Enraged; - void Reset() { CurrentVurln_Spell = 0; //We use this to store our last vurlnability spell so we can remove it later - Shimmer_Timer = 0; //Time till we change vurlnerabilites Breath1_Timer = 30000; //First breath is 30 seconds Breath2_Timer = 60000; //Second is 1 minute so that we can alternate Affliction_Timer = 10000; //This is special - 5 seconds means that we cast this on 1 player every 5 sconds Frenzy_Timer = 15000; - Enraged = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Shimmer_Timer Timer if (Shimmer_Timer < diff) { //Remove old vurlnability spell if (CurrentVurln_Spell) m_creature->RemoveAurasDueToSpell(CurrentVurln_Spell); - //Cast new random vurlnabilty on self uint32 spell; switch (rand()%5) @@ -209,33 +186,27 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI case 3: spell = SPELL_NATURE_VURNALBILTY; break; case 4: spell = SPELL_ARCANE_VURNALBILTY; break; } - DoCast(m_creature,spell); CurrentVurln_Spell = spell; - DoScriptText(EMOTE_SHIMMER, m_creature); Shimmer_Timer = 45000; }else Shimmer_Timer -= diff; - //Breath1_Timer if (Breath1_Timer < diff) { DoCast(m_creature->getVictim(),Breath1_Spell); Breath1_Timer = 60000; }else Breath1_Timer -= diff; - //Breath2_Timer if (Breath2_Timer < diff) { DoCast(m_creature->getVictim(),Breath2_Spell); Breath2_Timer = 60000; }else Breath2_Timer -= diff; - //Affliction_Timer if (Affliction_Timer < diff) { uint32 SpellAfflict = 0; - switch (rand()%5) { case 0: SpellAfflict = SPELL_BROODAF_BLUE; break; @@ -244,20 +215,16 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI case 3: SpellAfflict = SPELL_BROODAF_BRONZE; break; case 4: SpellAfflict = SPELL_BROODAF_GREEN; break; } - std::list::iterator i; - - for (i = m_creature->getThreatManager().getThreatList().begin();i != m_creature->getThreatManager().getThreatList().end();) + for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ) { Unit* pUnit = NULL; pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); ++i; - if (pUnit) { //Cast affliction DoCast(pUnit, SpellAfflict, true); - //Chromatic mutation if target is effected by all afflictions if (pUnit->HasAura(SPELL_BROODAF_BLUE) && pUnit->HasAura(SPELL_BROODAF_BLACK) @@ -267,21 +234,17 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI { //target->RemoveAllAuras(); //DoCast(target,SPELL_CHROMATIC_MUT_1); - //Chromatic mutation is causing issues //Assuming it is caused by a lack of core support for Charm //So instead we instant kill our target - //WORKAROUND if (pUnit->GetTypeId() == TYPEID_PLAYER) pUnit->CastSpell(pUnit, 5, false); } } } - Affliction_Timer = 10000; }else Affliction_Timer -= diff; - //Frenzy_Timer if (Frenzy_Timer < diff) { @@ -289,14 +252,12 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI DoScriptText(EMOTE_FRENZY, m_creature); Frenzy_Timer = 10000 + (rand() % 5000); }else Frenzy_Timer -= diff; - //Enrage if not already enraged and below 20% if (!Enraged && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20) { DoCast(m_creature,SPELL_ENRAGE); Enraged = true; } - DoMeleeAttackIfReady(); } }; @@ -304,7 +265,6 @@ CreatureAI* GetAI_boss_chromaggus(Creature* pCreature) { return new boss_chromaggusAI (pCreature); } - void AddSC_boss_chromaggus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_ebonroc.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_ebonroc.cpp index a09da22e398..aee7d02f33e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_ebonroc.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_ebonroc.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ebonroc SD%Complete: 50 SDComment: Shadow of Ebonroc needs core support SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 18500 #define SPELL_SHADOWOFEBONROC 23340 #define SPELL_HEAL 41386 //Thea Heal spell of his Shadow - struct TRINITY_DLL_DECL boss_ebonrocAI : public ScriptedAI { boss_ebonrocAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowFlame_Timer; uint32 WingBuffet_Timer; uint32 ShadowOfEbonroc_Timer; uint32 Heal_Timer; - void Reset() { ShadowFlame_Timer = 15000; //These times are probably wrong @@ -44,38 +38,32 @@ struct TRINITY_DLL_DECL boss_ebonrocAI : public ScriptedAI ShadowOfEbonroc_Timer = 45000; Heal_Timer = 1000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Shadowflame Timer if (ShadowFlame_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWFLAME); ShadowFlame_Timer = 12000 + rand()%3000; }else ShadowFlame_Timer -= diff; - //Wing Buffet Timer if (WingBuffet_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WINGBUFFET); WingBuffet_Timer = 25000; }else WingBuffet_Timer -= diff; - //Shadow of Ebonroc Timer if (ShadowOfEbonroc_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWOFEBONROC); ShadowOfEbonroc_Timer = 25000 + rand()%10000; }else ShadowOfEbonroc_Timer -= diff; - if (m_creature->getVictim()->HasAura(SPELL_SHADOWOFEBONROC)) { if (Heal_Timer < diff) @@ -84,7 +72,6 @@ struct TRINITY_DLL_DECL boss_ebonrocAI : public ScriptedAI Heal_Timer = 1000 + rand()%2000; }else Heal_Timer -= diff; } - DoMeleeAttackIfReady(); } }; @@ -92,7 +79,6 @@ CreatureAI* GetAI_boss_ebonroc(Creature* pCreature) { return new boss_ebonrocAI (pCreature); } - void AddSC_boss_ebonroc() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_firemaw.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_firemaw.cpp index 73d546e0a2c..8692563f4e7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_firemaw.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_firemaw.cpp @@ -13,69 +13,56 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Firemaw SD%Complete: 100 SDComment: SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FLAMEBUFFET 23341 - struct TRINITY_DLL_DECL boss_firemawAI : public ScriptedAI { boss_firemawAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowFlame_Timer; uint32 WingBuffet_Timer; uint32 FlameBuffet_Timer; - void Reset() { ShadowFlame_Timer = 30000; //These times are probably wrong WingBuffet_Timer = 24000; FlameBuffet_Timer = 5000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowFlame_Timer if (ShadowFlame_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWFLAME); ShadowFlame_Timer = 15000 + rand()%3000; }else ShadowFlame_Timer -= diff; - //WingBuffet_Timer if (WingBuffet_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WINGBUFFET); if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-75); - WingBuffet_Timer = 25000; }else WingBuffet_Timer -= diff; - //FlameBuffet_Timer if (FlameBuffet_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMEBUFFET); FlameBuffet_Timer = 5000; }else FlameBuffet_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -83,7 +70,6 @@ CreatureAI* GetAI_boss_firemaw(Creature* pCreature) { return new boss_firemawAI (pCreature); } - void AddSC_boss_firemaw() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_flamegor.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_flamegor.cpp index 622ba445306..6cf1f43b485 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_flamegor.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_flamegor.cpp @@ -13,64 +13,51 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Flamegor SD%Complete: 100 SDComment: SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define EMOTE_FRENZY -1469031 - #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FRENZY 23342 //This spell periodically triggers fire nova - struct TRINITY_DLL_DECL boss_flamegorAI : public ScriptedAI { boss_flamegorAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowFlame_Timer; uint32 WingBuffet_Timer; uint32 Frenzy_Timer; - void Reset() { ShadowFlame_Timer = 21000; //These times are probably wrong WingBuffet_Timer = 35000; Frenzy_Timer = 10000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowFlame_Timer if (ShadowFlame_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWFLAME); ShadowFlame_Timer = 15000 + rand()%7000; }else ShadowFlame_Timer -= diff; - //WingBuffet_Timer if (WingBuffet_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WINGBUFFET); if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-75); - WingBuffet_Timer = 25000; }else WingBuffet_Timer -= diff; - //Frenzy_Timer if (Frenzy_Timer < diff) { @@ -78,7 +65,6 @@ struct TRINITY_DLL_DECL boss_flamegorAI : public ScriptedAI DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 8000 + (rand()%2000); }else Frenzy_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -86,7 +72,6 @@ CreatureAI* GetAI_boss_flamegor(Creature* pCreature) { return new boss_flamegorAI (pCreature); } - void AddSC_boss_flamegor() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp index b0d2d01494e..0f0d4d7d613 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp @@ -13,23 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Nefarian SD%Complete: 80 SDComment: Some issues with class calls effecting more than one class SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1469007 #define SAY_XHEALTH -1469008 #define SAY_SHADOWFLAME -1469009 #define SAY_RAISE_SKELETONS -1469010 #define SAY_SLAY -1469011 #define SAY_DEATH -1469012 - #define SAY_MAGE -1469013 #define SAY_WARRIOR -1469014 #define SAY_DRUID -1469015 @@ -39,7 +35,6 @@ EndScriptData */ #define SAY_WARLOCK -1469019 #define SAY_HUNTER -1469020 #define SAY_ROGUE -1469021 - #define SPELL_SHADOWFLAME_INITIAL 22972 #define SPELL_SHADOWFLAME 22539 #define SPELL_BELLOWINGROAR 22686 @@ -47,7 +42,6 @@ EndScriptData */ #define SPELL_CLEAVE 20691 #define SPELL_TAILLASH 23364 #define SPELL_BONECONTRUST 23363 //23362, 23361 - #define SPELL_MAGE 23410 //wild magic #define SPELL_WARRIOR 23397 //beserk #define SPELL_DRUID 23398 // cat form @@ -57,11 +51,9 @@ EndScriptData */ #define SPELL_WARLOCK 23427 //infernals #define SPELL_HUNTER 23436 //bow broke #define SPELL_ROGUE 23414 //Paralise - struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI { boss_nefarianAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowFlame_Timer; uint32 BellowingRoar_Timer; uint32 VeilOfShadow_Timer; @@ -69,9 +61,7 @@ struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI uint32 TailLash_Timer; uint32 ClassCall_Timer; bool Phase3; - uint32 DespawnTimer; - void Reset() { ShadowFlame_Timer = 12000; //These times are probably wrong @@ -81,31 +71,24 @@ struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI TailLash_Timer = 10000; ClassCall_Timer = 35000; //35-40 seconds Phase3 = false; - DespawnTimer = 5000; } - void KilledUnit(Unit* Victim) { if (rand()%5) return; - DoScriptText(SAY_SLAY, m_creature, Victim); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), m_creature); - DoCast(who,SPELL_SHADOWFLAME_INITIAL); DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { if(DespawnTimer < diff) @@ -114,54 +97,45 @@ struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI m_creature->ForcedDespawn(); DespawnTimer = 5000; }else DespawnTimer -= diff; - if (!UpdateVictim()) return; - //ShadowFlame_Timer if (ShadowFlame_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWFLAME); ShadowFlame_Timer = 12000; }else ShadowFlame_Timer -= diff; - //BellowingRoar_Timer if (BellowingRoar_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BELLOWINGROAR); BellowingRoar_Timer = 30000; }else BellowingRoar_Timer -= diff; - //VeilOfShadow_Timer if (VeilOfShadow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_VEILOFSHADOW); VeilOfShadow_Timer = 15000; }else VeilOfShadow_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //TailLash_Timer if (TailLash_Timer < diff) { //Cast NYI since we need a better check for behind target //DoCast(m_creature->getVictim(),SPELL_TAILLASH); - TailLash_Timer = 10000; }else TailLash_Timer -= diff; - //ClassCall_Timer if (ClassCall_Timer < diff) { //Cast a random class call //On official it is based on what classes are currently on the hostil list //but we can't do that yet so just randomly call one - switch (rand()%9) { case 0: @@ -201,17 +175,14 @@ struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI DoCast(m_creature,SPELL_ROGUE); break; } - ClassCall_Timer = 35000 + (rand() % 5000); }else ClassCall_Timer -= diff; - //Phase3 begins when we are below X health if (!Phase3 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20) { Phase3 = true; DoScriptText(SAY_RAISE_SKELETONS, m_creature); } - DoMeleeAttackIfReady(); } }; @@ -219,7 +190,6 @@ CreatureAI* GetAI_boss_nefarian(Creature* pCreature) { return new boss_nefarianAI (pCreature); } - void AddSC_boss_nefarian() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_razorgore.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_razorgore.cpp index 5496448b6ed..e88b479d43c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_razorgore.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_razorgore.cpp @@ -13,37 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Razorgore SD%Complete: 50 SDComment: Needs additional review. Phase 1 NYI (Grethok the Controller) SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - //Razorgore Phase 2 Script - #define SAY_EGGS_BROKEN1 -1469022 #define SAY_EGGS_BROKEN2 -1469023 #define SAY_EGGS_BROKEN3 -1469024 #define SAY_DEATH -1469025 - #define SPELL_CLEAVE 22540 #define SPELL_WARSTOMP 24375 #define SPELL_FIREBALLVOLLEY 22425 #define SPELL_CONFLAGRATION 23023 - struct TRINITY_DLL_DECL boss_razorgoreAI : public ScriptedAI { boss_razorgoreAI(Creature *c) : ScriptedAI(c) {} - uint32 Cleave_Timer; uint32 WarStomp_Timer; uint32 FireballVolley_Timer; uint32 Conflagration_Timer; - void Reset() { Cleave_Timer = 15000; //These times are probably wrong @@ -51,55 +43,45 @@ struct TRINITY_DLL_DECL boss_razorgoreAI : public ScriptedAI FireballVolley_Timer = 7000; Conflagration_Timer = 12000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000 + rand()%3000; }else Cleave_Timer -= diff; - //WarStomp_Timer if (WarStomp_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WARSTOMP); WarStomp_Timer = 15000 + rand()%10000; }else WarStomp_Timer -= diff; - //FireballVolley_Timer if (FireballVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIREBALLVOLLEY); FireballVolley_Timer = 12000 + rand()%3000; }else FireballVolley_Timer -= diff; - //Conflagration_Timer if (Conflagration_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CONFLAGRATION); //We will remove this threat reduction and add an aura check. - //if (DoGetThreat(m_creature->getVictim())) //DoModifyThreatPercent(m_creature->getVictim(),-50); - Conflagration_Timer = 12000; }else Conflagration_Timer -= diff; - // Aura Check. If the gamer is affected by confliguration we attack a random gamer. if (m_creature->getVictim() && m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION)) { @@ -108,16 +90,13 @@ struct TRINITY_DLL_DECL boss_razorgoreAI : public ScriptedAI if (target) m_creature->TauntApply(target); } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_razorgore(Creature* pCreature) { return new boss_razorgoreAI (pCreature); } - void AddSC_boss_razorgore() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_vaelastrasz.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_vaelastrasz.cpp index ac9a0f6aaaa..9fb1f05d24e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_vaelastrasz.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_vaelastrasz.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Vaelastrasz SD%Complete: 75 SDComment: Burning Adrenaline not correctly implemented in core SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SAY_LINE1 -1469026 #define SAY_LINE2 -1469027 #define SAY_LINE3 -1469028 #define SAY_HALFLIFE -1469029 #define SAY_KILLTARGET -1469030 - #define GOSSIP_ITEM "Start Event " - #define SPELL_ESSENCEOFTHERED 23513 #define SPELL_FLAMEBREATH 23461 #define SPELL_FIRENOVA 23462 #define SPELL_TAILSWIPE 15847 #define SPELL_BURNINGADRENALINE 23620 #define SPELL_CLEAVE 20684 //Chain cleave is most likely named something different and contains a dummy effect - struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI { boss_vaelAI(Creature *c) : ScriptedAI(c) @@ -46,7 +40,6 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI c->setFaction(35); c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - uint64 PlayerGUID; uint32 SpeachTimer; uint32 SpeachNum; @@ -58,7 +51,6 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI uint32 TailSwipe_Timer; bool HasYelled; bool DoingSpeach; - void Reset() { PlayerGUID = 0; @@ -73,37 +65,29 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI HasYelled = false; DoingSpeach = false; } - void BeginSpeach(Unit* target) { //Stand up and begin speach PlayerGUID = target->GetGUID(); - //10 seconds DoScriptText(SAY_LINE1, m_creature); - SpeachTimer = 10000; SpeachNum = 0; DoingSpeach = true; - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - void KilledUnit(Unit *victim) { if (rand()%5) return; - DoScriptText(SAY_KILLTARGET, m_creature, victim); } - void EnterCombat(Unit *who) { DoCast(m_creature,SPELL_ESSENCEOFTHERED); DoZoneInCombat(); m_creature->SetHealth(int(m_creature->GetMaxHealth()*.3)); } - void UpdateAI(const uint32 diff) { //Speach @@ -138,37 +122,31 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI } }else SpeachTimer -= diff; } - //Return since we have no target if (!UpdateVictim()) return; - // Yell if hp lower than 15% if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 15 && !HasYelled) { DoScriptText(SAY_HALFLIFE, m_creature); HasYelled = true; } - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 15000; }else Cleave_Timer -= diff; - //FlameBreath_Timer if (FlameBreath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMEBREATH); FlameBreath_Timer = 4000 + rand()%4000; }else FlameBreath_Timer -= diff; - //BurningAdrenalineCaster_Timer if (BurningAdrenalineCaster_Timer < diff) { Unit* target = NULL; - int i = 0 ; while (i < 3) // max 3 tries to get a random target with power_mana { @@ -180,27 +158,22 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI } if (target) // cast on self (see below) target->CastSpell(target,SPELL_BURNINGADRENALINE,1); - BurningAdrenalineCaster_Timer = 15000; }else BurningAdrenalineCaster_Timer -= diff; - //BurningAdrenalineTank_Timer if (BurningAdrenalineTank_Timer < diff) { // have the victim cast the spell on himself otherwise the third effect aura will be applied // to Vael instead of the player m_creature->getVictim()->CastSpell(m_creature->getVictim(),SPELL_BURNINGADRENALINE,1); - BurningAdrenalineTank_Timer = 45000; }else BurningAdrenalineTank_Timer -= diff; - //FireNova_Timer if (FireNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIRENOVA); FireNova_Timer = 5000; }else FireNova_Timer -= diff; - //TailSwipe_Timer if (TailSwipe_Timer < diff) { @@ -209,14 +182,11 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_TAILSWIPE); }*/ - TailSwipe_Timer = 20000; }else TailSwipe_Timer -= diff; - DoMeleeAttackIfReady(); } }; - void SendDefaultMenu_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time @@ -225,28 +195,22 @@ void SendDefaultMenu_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiAc CAST_AI(boss_vaelAI, pCreature->AI())->BeginSpeach(pPlayer); } } - bool GossipSelect_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiSender == GOSSIP_SENDER_MAIN) SendDefaultMenu_boss_vael(pPlayer, pCreature, uiAction); - return true; } - bool GossipHello_boss_vael(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; } - CreatureAI* GetAI_boss_vael(Creature* pCreature) { return new boss_vaelAI (pCreature); } - void AddSC_boss_vael() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_victor_nefarius.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_victor_nefarius.cpp index 4b7fcecf683..d0c8b510124 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_victor_nefarius.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/boss_victor_nefarius.cpp @@ -13,51 +13,40 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Victor_Nefarius SD%Complete: 75 SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong place SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" - #define SAY_GAMESBEGIN_1 -1469004 #define SAY_GAMESBEGIN_2 -1469005 #define SAY_VAEL_INTRO -1469006 //when he corrupts Vaelastrasz - #define GOSSIP_ITEM_1 "I've made no mistakes." #define GOSSIP_ITEM_2 "You have lost your mind, Nefarius. You speak in riddles." #define GOSSIP_ITEM_3 "Please do." - #define CREATURE_BRONZE_DRAKANOID 14263 #define CREATURE_BLUE_DRAKANOID 14261 #define CREATURE_RED_DRAKANOID 14264 #define CREATURE_GREEN_DRAKANOID 14262 #define CREATURE_BLACK_DRAKANOID 14265 - #define CREATURE_CHROMATIC_DRAKANOID 14302 #define CREATURE_NEFARIAN 11583 - #define ADD_X1 -7591.151855 #define ADD_X2 -7514.598633 #define ADD_Y1 -1204.051880 #define ADD_Y2 -1150.448853 #define ADD_Z1 476.800476 #define ADD_Z2 476.796570 - #define NEF_X -7445 #define NEF_Y -1332 #define NEF_Z 536 - #define HIDE_X -7592 #define HIDE_Y -1264 #define HIDE_Z 481 - #define SPELL_SHADOWBOLT 21077 #define SPELL_FEAR 26070 - //This script is complicated //Instead of morphing Victor Nefarius we will have him control phase 1 //And then have him spawn "Nefarian" for phase 2 @@ -66,7 +55,6 @@ EndScriptData */ //and allow players to start the event over //If nefarian dies then he will kill himself then he will kill himself in his hiding place //To prevent players from doing the event twice - struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI { boss_victor_nefariusAI(Creature *c) : ScriptedAI(c) @@ -157,7 +145,6 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI break; } } - uint32 SpawnedAdds; uint32 AddSpawnTimer; uint32 ShadowBoltTimer; @@ -168,7 +155,6 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI uint32 DrakType2; uint64 NefarianGUID; uint32 NefCheckTime; - void Reset() { SpawnedAdds = 0; @@ -178,20 +164,16 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier NefarianGUID = 0; NefCheckTime = 2000; - m_creature->SetUInt32Value(UNIT_NPC_FLAGS,1); m_creature->setFaction(35); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void BeginEvent(Player* target) { DoScriptText(SAY_GAMESBEGIN_2, m_creature); - //Trinity::Singleton::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); /* list ::iterator i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); - for (i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); i != MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().end(); ++i) { AttackStart((*i)); @@ -202,27 +184,22 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); AttackStart(target); } - void EnterCombat(Unit *who) { } - void MoveInLineOfSight(Unit *who) { //We simply use this function to find players until we can use pMap->GetPlayers() - if (who && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsHostileTo(who)) { //Add them to our threat list m_creature->AddThreat(who,0.0f); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Only do this if we haven't spawned nef yet if (SpawnedAdds < 42) { @@ -233,10 +210,8 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_SHADOWBOLT); - ShadowBoltTimer = 3000 + (rand()%7000); }else ShadowBoltTimer -= diff; - //FearTimer if (FearTimer < diff) { @@ -244,10 +219,8 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_FEAR); - FearTimer = 10000 + (rand()%10000); }else FearTimer -= diff; - //Add spawning mechanism if (AddSpawnTimer < diff) { @@ -255,14 +228,11 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI uint32 CreatureID; Creature* Spawned = NULL; Unit* target = NULL; - //1 in 3 chance it will be a chromatic if (rand()%3 == 0) CreatureID = CREATURE_CHROMATIC_DRAKANOID; else CreatureID = DrakType1; - SpawnedAdds++; - //Spawn Creature and force it to start attacking a random target Spawned = m_creature->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); target = SelectUnit(SELECT_TARGET_RANDOM,0); @@ -271,14 +241,11 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI Spawned->AI()->AttackStart(target); Spawned->setFaction(103); } - //1 in 3 chance it will be a chromatic if (rand()%3 == 0) CreatureID = CREATURE_CHROMATIC_DRAKANOID; else CreatureID = DrakType2; - SpawnedAdds++; - target = NULL; Spawned = NULL; Spawned = m_creature->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); @@ -288,26 +255,20 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI Spawned->AI()->AttackStart(target); Spawned->setFaction(103); } - //Begin phase 2 by spawning Nefarian and what not if (SpawnedAdds >= 42) { //Teleport Victor Nefarius way out of the map //MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->CreatureRelocation(m_creature,0,0,-5000,0); - //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); - //Root self DoCast(m_creature,33356); - //Make super invis DoCast(m_creature,8149); - //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z); m_creature->addUnitState(UNIT_STAT_FLEEING); - //Spawn nef and have him attack a random target Creature* Nefarian = NULL; Nefarian = m_creature->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); @@ -321,7 +282,6 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI } else error_log("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); } - AddSpawnTimer = 4000; }else AddSpawnTimer -= diff; } @@ -330,7 +290,6 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI if (NefCheckTime < diff) { Unit* Nefarian = Unit::GetCreature((*m_creature),NefarianGUID); - //If nef is dead then we die to so the players get out of combat //and cannot repeat the event if (!Nefarian || !Nefarian->isAlive()) @@ -338,25 +297,21 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI NefarianGUID = 0; m_creature->ForcedDespawn(); } - NefCheckTime = 2000; }else NefCheckTime -= diff; } } }; - CreatureAI* GetAI_boss_victor_nefarius(Creature* pCreature) { return new boss_victor_nefariusAI (pCreature); } - bool GossipHello_boss_victor_nefarius(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1 , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(7134, pCreature->GetGUID()); return true; } - bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -377,11 +332,9 @@ bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uin } return true; } - void AddSC_boss_victor_nefarius() { Script *newscript; - newscript = new Script; newscript->Name = "boss_victor_nefarius"; newscript->GetAI = &GetAI_boss_victor_nefarius; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/instance_blackwing_lair.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/instance_blackwing_lair.cpp index 97bf717589a..781ae028c9f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/instance_blackwing_lair.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackwing_lair/instance_blackwing_lair.cpp @@ -13,13 +13,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Blackwing_Lair SD%Complete: 0 SDComment: SDCategory: Blackwing Lair EndScriptData */ - #include "precompiled.h" diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp index 97e10f59e59..42fdbb98c60 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp @@ -13,41 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Blasted_Lands SD%Complete: 90 SDComment: Quest support: 2784, 2801, 3628. Missing some texts for Fallen Hero. Teleporter to Rise of the Defiler missing group support. SDCategory: Blasted Lands EndScriptData */ - /* ContentData npc_deathly_usher npc_fallen_hero_of_horde EndContentData */ - #include "precompiled.h" - /*###### ## npc_deathly_usher ######*/ - #define GOSSIP_ITEM_USHER "I wish to to visit the Rise of the Defiler." - #define SPELL_TELEPORT_SINGLE 12885 #define SPELL_TELEPORT_SINGLE_IN_GROUP 13142 #define SPELL_TELEPORT_GROUP 27686 - bool GossipHello_npc_deathly_usher(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -55,43 +45,32 @@ bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer, SPELL_TELEPORT_SINGLE, true); } - return true; } - /*###### ## npc_fallen_hero_of_horde ######*/ #define GOSSIP_H_F1 "Why are you here?" #define GOSSIP_H_F2 "Continue story..." - #define GOSSIP_ITEM_FALLEN "Continue..." - #define GOSSIP_ITEM_FALLEN1 "What could be worse than death?" #define GOSSIP_ITEM_FALLEN2 "Subordinates?" #define GOSSIP_ITEM_FALLEN3 "What are the stones of binding?" #define GOSSIP_ITEM_FALLEN4 "You can count on me, Hero" #define GOSSIP_ITEM_FALLEN5 "I shall" - bool GossipHello_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == HORDE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -110,7 +89,6 @@ bool GossipSelect_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature, pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); } break; - case GOSSIP_ACTION_INFO_DEF+2: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); pPlayer->SEND_GOSSIP_MENU(1451, pCreature->GetGUID()); @@ -142,17 +120,14 @@ bool GossipSelect_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature, } return true; } - void AddSC_blasted_lands() { Script *newscript; - newscript = new Script; newscript->Name = "npc_deathly_usher"; newscript->pGossipHello = &GossipHello_npc_deathly_usher; newscript->pGossipSelect = &GossipSelect_npc_deathly_usher; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_fallen_hero_of_horde"; newscript->pGossipHello = &GossipHello_npc_fallen_hero_of_horde; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/boss_kruul.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/boss_kruul.cpp index 267bbdefe95..e85d7ed2ce2 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/boss_kruul.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/boss_kruul.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kruul SD%Complete: 100 SDComment: Highlord Kruul are presumably no longer in-game on regular bases, however future events could bring him back. SDCategory: Bosses EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWVOLLEY 21341 #define SPELL_CLEAVE 20677 #define SPELL_THUNDERCLAP 23931 @@ -30,11 +27,9 @@ EndScriptData */ #define SPELL_VOIDBOLT 21066 #define SPELL_RAGE 21340 #define SPELL_CAPTURESOUL 21054 - struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI { boss_kruulAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowVolley_Timer; uint32 Cleave_Timer; uint32 ThunderClap_Timer; @@ -46,7 +41,6 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI int RandX; int RandY; Creature* Summoned; - void Reset() { ShadowVolley_Timer = 10000; @@ -57,18 +51,14 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI Rage_Timer = 60000; //Cast rage after 1 minute Hound_Timer = 8000; } - void EnterCombat(Unit *who) { } - void KilledUnit() { // When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health. DoCast(m_creature,SPELL_CAPTURESOUL); - } - void SummonHounds(Unit* victim) { Rand = rand()%10; @@ -89,13 +79,11 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI if (Summoned) (Summoned->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ShadowVolley_Timer if (ShadowVolley_Timer < diff) { @@ -103,10 +91,8 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_SHADOWVOLLEY); } - ShadowVolley_Timer = 5000; }else ShadowVolley_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { @@ -114,10 +100,8 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_CLEAVE); } - Cleave_Timer = 10000; }else Cleave_Timer -= diff; - //ThunderClap_Timer if (ThunderClap_Timer < diff) { @@ -125,17 +109,14 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); } - ThunderClap_Timer = 12000; }else ThunderClap_Timer -= diff; - //TwistedReflection_Timer if (TwistedReflection_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TWISTEDREFLECTION); TwistedReflection_Timer = 30000; }else TwistedReflection_Timer -= diff; - //VoidBolt_Timer if (VoidBolt_Timer < diff) { @@ -143,27 +124,22 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_VOIDBOLT); } - VoidBolt_Timer = 18000; }else VoidBolt_Timer -= diff; - //Rage_Timer if (Rage_Timer < diff) { DoCast(m_creature,SPELL_RAGE); Rage_Timer = 70000; }else Rage_Timer -= diff; - //Hound_Timer if (Hound_Timer < diff) { SummonHounds(m_creature->getVictim()); SummonHounds(m_creature->getVictim()); SummonHounds(m_creature->getVictim()); - Hound_Timer = 45000; }else Hound_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -171,7 +147,6 @@ CreatureAI* GetAI_boss_kruul(Creature* pCreature) { return new boss_kruulAI (pCreature); } - void AddSC_boss_kruul() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/burning_steppes.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/burning_steppes.cpp index d1b4c778a1f..38a0a8052c6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/burning_steppes.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/burning_steppes.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Burning_Steppes SD%Complete: 100 SDComment: Quest support: 4224, 4866 SDCategory: Burning Steppes EndScriptData */ - /* ContentData npc_ragged_john EndContentData */ - #include "precompiled.h" - /*###### ## npc_ragged_john ######*/ - #define GOSSIP_HELLO "Official buisness, John. I need some information about Marsha Windsor. Tell me about the last time you saw him." #define GOSSIP_SELECT1 "So what did you do?" #define GOSSIP_SELECT2 "Start making sense, dwarf. I don't want to have anything to do with your cracker, your pappy, or any sort of 'discreditin'." @@ -43,13 +38,10 @@ EndContentData */ #define GOSSIP_SELECT9 "300? So the Dark Irons killed him and dragged him into the Depths?" #define GOSSIP_SELECT10 "Ahh... Ironfoe" #define GOSSIP_SELECT11 "Thanks, Ragged John. Your story was very uplifting and informative" - struct TRINITY_DLL_DECL npc_ragged_johnAI : public ScriptedAI { npc_ragged_johnAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} - void MoveInLineOfSight(Unit *who) { if (who->HasAura(16468)) @@ -60,30 +52,23 @@ struct TRINITY_DLL_DECL npc_ragged_johnAI : public ScriptedAI CAST_PLR(who)->AreaExploredOrEventHappens(4866); } } - ScriptedAI::MoveInLineOfSight(who); } - void EnterCombat(Unit *who) {} }; - CreatureAI* GetAI_npc_ragged_john(Creature* pCreature) { return new npc_ragged_johnAI (pCreature); } - bool GossipHello_npc_ragged_john(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(2713, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_ragged_john(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -139,11 +124,9 @@ bool GossipSelect_npc_ragged_john(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - void AddSC_burning_steppes() { Script *newscript; - newscript = new Script; newscript->Name = "npc_ragged_john"; newscript->GetAI = &GetAI_npc_ragged_john; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/deadmines.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/deadmines.cpp index d2544cc881f..c2a052917f6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/deadmines.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/deadmines.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Deadmines SD%Complete: 0 SDComment: Placeholder SDCategory: Deadmines EndScriptData */ - #include "precompiled.h" #include "def_deadmines.h" #include "Spell.h" - #define SOUND_CANNONFIRE 1400 #define SOUND_DESTROYDOOR 3079 #define SAY_MR_SMITE_ALARM1 "You there, check out that noise!" #define SOUND_MR_SMITE_ALARM1 5775 #define SAY_MR_SMITE_ALARM2 "We're under attack! A vast, ye swabs! Repel the invaders!" #define SOUND_MR_SMITE_ALARM2 5777 - #define GO_IRONCLAD_DOOR 16397 #define GO_DEFIAS_CANNON 16398 #define GO_DOOR_LEVER 101833 - #define CANNON_BLAST_TIMER 3000 #define PIRATES_DELAY_TIMER 1000 - struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance { instance_deadmines(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - GameObject* IronCladDoor; GameObject* DefiasCannon; GameObject* DoorLever; @@ -52,7 +45,6 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance uint32 State; uint32 CannonBlast_Timer; uint32 PiratesDelay_Timer; - void Initialize() { IronCladDoor = NULL; @@ -60,12 +52,10 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance DoorLever = NULL; State = CANNON_NOT_USED; } - virtual void Update(uint32 diff) { if (!IronCladDoor || !DefiasCannon || !DoorLever) return; - switch(State) { case CANNON_GUNPOWDER_USED: @@ -100,47 +90,39 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance break; } } - void SummonCreatures() { DefiasPirate1 = IronCladDoor->SummonCreature(657,IronCladDoor->GetPositionX() - 2,IronCladDoor->GetPositionY()-7,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); DefiasPirate2 = IronCladDoor->SummonCreature(657,IronCladDoor->GetPositionX() + 3,IronCladDoor->GetPositionY()-6,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); DefiasCompanion = IronCladDoor->SummonCreature(3450,IronCladDoor->GetPositionX() + 2,IronCladDoor->GetPositionY()-6,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); } - void MoveCreaturesInside() { if (!DefiasPirate1 || !DefiasPirate2 || !DefiasCompanion) return; - MoveCreatureInside(DefiasPirate1); MoveCreatureInside(DefiasPirate2); MoveCreatureInside(DefiasCompanion); } - void MoveCreatureInside(Creature* pCreature) { pCreature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pCreature->GetMotionMaster()->MovePoint(0, -102.7,-655.9, pCreature->GetPositionZ()); } - void ShootCannon() { DefiasCannon->SetGoState(GO_STATE_ACTIVE); DoPlaySound(DefiasCannon, SOUND_CANNONFIRE); } - void BlastOutDoor() { IronCladDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); DoPlaySound(IronCladDoor, SOUND_DESTROYDOOR); } - void LeverStucked() { DoorLever->SetUInt32Value(GAMEOBJECT_FLAGS, 4); } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -156,7 +138,6 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { if (type == EVENT_STATE) @@ -165,14 +146,12 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance State=data; } } - uint32 GetData(uint32 type) { if (type == EVENT_STATE) return State; return 0; } - void DoPlaySound(GameObject* unit, uint32 sound) { WorldPacket data(4); @@ -180,7 +159,6 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance data << uint32(sound); unit->SendMessageToSet(&data,false); } - void DoPlaySoundCreature(Unit* unit, uint32 sound) { WorldPacket data(4); @@ -189,15 +167,12 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance unit->SendMessageToSet(&data,false); } }; - /*##### # item_Defias_Gunpowder #####*/ - bool ItemUse_item_defias_gunpowder(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { ScriptedInstance *pInstance = pPlayer->GetInstanceData(); - if (!pInstance) { pPlayer->GetSession()->SendNotification("Instance script not initialized"); @@ -210,16 +185,13 @@ bool ItemUse_item_defias_gunpowder(Player* pPlayer, Item* _Item, SpellCastTarget { pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); } - pPlayer->DestroyItemCount(_Item->GetEntry(), 1, true); return true; } - InstanceData* GetInstanceData_instance_deadmines(Map* pMap) { return new instance_deadmines(pMap); } - void AddSC_instance_deadmines() { Script *newscript; @@ -227,7 +199,6 @@ void AddSC_instance_deadmines() newscript->Name = "instance_deadmines"; newscript->GetInstanceData = &GetInstanceData_instance_deadmines; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_defias_gunpowder"; newscript->pItemUse = &ItemUse_item_defias_gunpowder; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/def_deadmines.h b/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/def_deadmines.h index 9b535a9fd80..faa55500209 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/def_deadmines.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/deadmines/def_deadmines.h @@ -1,14 +1,11 @@ #ifndef DEF_DEADMINES_H #define DEF_DEADMINES_H - #include "precompiled.h" - #define CANNON_NOT_USED 1 #define CANNON_GUNPOWDER_USED 2 #define CANNON_BLAST_INITIATED 3 #define PIRATES_ATTACK 4 #define EVENT_DONE 5 - #define EVENT_STATE 1 #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp index f2d589d5302..488807a0109 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp @@ -13,34 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Dun_Morogh SD%Complete: 50 SDComment: Quest support: 1783 SDCategory: Dun Morogh EndScriptData */ - /* ContentData npc_narm_faulk EndContentData */ - #include "precompiled.h" - /*###### ## npc_narm_faulk ######*/ - // signed for 6172 #define SAY_HEAL -1000280 - struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI { uint32 lifeTimer; bool spellHit; - npc_narm_faulkAI(Creature *c) : ScriptedAI(c) {} - void Reset() { lifeTimer = 120000; @@ -48,16 +40,13 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI m_creature->SetStandState(UNIT_STAND_STATE_DEAD); spellHit = false; } - void EnterCombat(Unit *who) { } - void MoveInLineOfSight(Unit *who) { return; } - void UpdateAI(const uint32 diff) { if (m_creature->IsStandState()) @@ -71,7 +60,6 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI lifeTimer -= diff; } } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { if (Spellkind->Id == 8593 && !spellHit) @@ -84,17 +72,14 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI spellHit = true; } } - }; CreatureAI* GetAI_npc_narm_faulk(Creature* pCreature) { return new npc_narm_faulkAI (pCreature); } - void AddSC_dun_morogh() { Script *newscript; - newscript = new Script; newscript->Name = "npc_narm_faulk"; newscript->GetAI = &GetAI_npc_narm_faulk; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/duskwood.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/duskwood.cpp index 394f652d8ff..e97094ecc23 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/duskwood.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/duskwood.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Duskwood SD%Complete: 100 SDComment: Quest Support:8735 SDCategory: Duskwood EndScriptData */ - #include "precompiled.h" - /*###### # at_twilight_grove ######*/ - bool AreaTrigger_at_twilight_grove(Player* pPlayer, AreaTriggerEntry *at) { if (pPlayer->HasQuestForItem(21149)) @@ -45,23 +41,18 @@ bool AreaTrigger_at_twilight_grove(Player* pPlayer, AreaTriggerEntry *at) } return false; }; - /*###### # boss_twilight_corrupter ######*/ - #define SPELL_SOUL_CORRUPTION 25805 #define SPELL_CREATURE_OF_NIGHTMARE 25806 #define SPELL_LEVEL_UP 24312 - struct TRINITY_DLL_DECL boss_twilight_corrupterAI : public ScriptedAI { boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {} - uint32 SoulCorruption_Timer; uint32 CreatureOfNightmare_Timer; uint8 KillCount; - void Reset() { SoulCorruption_Timer = 15000; @@ -72,14 +63,12 @@ struct TRINITY_DLL_DECL boss_twilight_corrupterAI : public ScriptedAI { m_creature->MonsterYell("The Nightmare cannot be stopped!",0,m_creature->GetGUID()); } - void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) { ++KillCount; m_creature->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true); - if (KillCount == 3) { DoCast(m_creature, SPELL_LEVEL_UP, true); @@ -87,7 +76,6 @@ struct TRINITY_DLL_DECL boss_twilight_corrupterAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if(!UpdateVictim()) @@ -109,16 +97,13 @@ CreatureAI* GetAI_boss_twilight_corrupter(Creature* pCreature) { return new boss_twilight_corrupterAI (pCreature); } - void AddSC_duskwood() { Script *newscript; - newscript = new Script; newscript->Name = "boss_twilight_corrupter"; newscript->GetAI = &GetAI_boss_twilight_corrupter; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_twilight_grove"; newscript->pAreaTrigger = &AreaTrigger_at_twilight_grove; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp index c801398b830..b7ae3722615 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp @@ -13,94 +13,73 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Eastern_Plaguelands SD%Complete: 100 SDComment: Quest support: 5211, 5742. Special vendor Augustus the Touched SDCategory: Eastern Plaguelands EndScriptData */ - /* ContentData mobs_ghoul_flayer npc_augustus_the_touched npc_darrowshire_spirit npc_tirion_fordring EndContentData */ - #include "precompiled.h" - //id8530 - cannibal ghoul //id8531 - gibbering ghoul //id8532 - diseased flayer - struct TRINITY_DLL_DECL mobs_ghoul_flayerAI : public ScriptedAI { mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void EnterCombat(Unit* who) { } - void JustDied(Unit* Killer) { if (Killer->GetTypeId() == TYPEID_PLAYER) m_creature->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); } }; - CreatureAI* GetAI_mobs_ghoul_flayer(Creature* pCreature) { return new mobs_ghoul_flayerAI (pCreature); } - /*###### ## npc_augustus_the_touched ######*/ - bool GossipHello_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); return true; } - /*###### ## npc_darrowshire_spirit ######*/ - #define SPELL_SPIRIT_SPAWNIN 17321 - struct TRINITY_DLL_DECL npc_darrowshire_spiritAI : public ScriptedAI { npc_darrowshire_spiritAI(Creature *c) : ScriptedAI(c) {} - void Reset() { DoCast(m_creature,SPELL_SPIRIT_SPAWNIN); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) { } - }; CreatureAI* GetAI_npc_darrowshire_spirit(Creature* pCreature) { return new npc_darrowshire_spiritAI (pCreature); } - bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) { pPlayer->SEND_GOSSIP_MENU(3873, pCreature->GetGUID()); @@ -108,29 +87,22 @@ bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return true; } - /*###### ## npc_tirion_fordring ######*/ - #define GOSSIP_HELLO "I am ready to hear your tale, Tirion." #define GOSSIP_SELECT1 "Thank you, Tirion. What of your identity?" #define GOSSIP_SELECT2 "That is terrible." #define GOSSIP_SELECT3 "I will, Tirion." - bool GossipHello_npc_tirion_fordring(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_tirion_fordring(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -154,28 +126,23 @@ bool GossipSelect_npc_tirion_fordring(Player* pPlayer, Creature* pCreature, uint } return true; } - void AddSC_eastern_plaguelands() { Script *newscript; - newscript = new Script; newscript->Name = "mobs_ghoul_flayer"; newscript->GetAI = &GetAI_mobs_ghoul_flayer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_augustus_the_touched"; newscript->pGossipHello = &GossipHello_npc_augustus_the_touched; newscript->pGossipSelect = &GossipSelect_npc_augustus_the_touched; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_darrowshire_spirit"; newscript->GetAI = &GetAI_npc_darrowshire_spirit; newscript->pGossipHello = &GossipHello_npc_darrowshire_spirit; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tirion_fordring"; newscript->pGossipHello = &GossipHello_npc_tirion_fordring; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp index 40f0ceecd09..ea69f408e94 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp @@ -13,33 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Elwynn_Forest SD%Complete: 50 SDComment: Quest support: 1786 SDCategory: Elwynn Forest EndScriptData */ - /* ContentData npc_henze_faulk EndContentData */ - #include "precompiled.h" - /*###### ## npc_henze_faulk ######*/ - #define SAY_HEAL -1000280 - struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI { uint32 lifeTimer; bool spellHit; - npc_henze_faulkAI(Creature *c) : ScriptedAI(c) {} - void Reset() { lifeTimer = 120000; @@ -47,16 +39,13 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI m_creature->SetStandState(UNIT_STAND_STATE_DEAD); // lay down spellHit = false; } - void EnterCombat(Unit *who) { } - void MoveInLineOfSight(Unit *who) { return; } - void UpdateAI(const uint32 diff) { if (m_creature->IsStandState()) @@ -70,7 +59,6 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI lifeTimer -= diff; } } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { if (Spellkind->Id == 8593 && !spellHit) @@ -83,17 +71,14 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI spellHit = true; } } - }; CreatureAI* GetAI_npc_henze_faulk(Creature* pCreature) { return new npc_henze_faulkAI (pCreature); } - void AddSC_elwynn_forest() { Script *newscript; - newscript = new Script; newscript->Name = "npc_henze_faulk"; newscript->GetAI = &GetAI_npc_henze_faulk; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp index b3d598c7669..3474d46f1df 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Eversong_Woods SD%Complete: 100 SDComment: Quest support: 8483, 8488, 8490, 9686 SDCategory: Eversong Woods EndScriptData */ - /* ContentData npc_prospector_anvilward npc_apprentice_mirveda @@ -28,35 +26,26 @@ npc_infused_crystal npc_kelerun_bloodmourn go_harbinger_second_trial EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_prospector_anvilward ######*/ - #define GOSSIP_HELLO "I need a moment of your time, sir." #define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward." - #define SAY_PR_1 -1000281 #define SAY_PR_2 -1000282 - #define QUEST_THE_DWARVEN_SPY 8483 - struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI { // CreatureAI functions npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {} - // Pure Virtual Functions void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { case 0: DoScriptText(SAY_PR_1, m_creature, pPlayer); break; @@ -64,32 +53,26 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI case 6: m_creature->setFaction(24); break; } } - void Reset() { me->RestoreFaction(); } - void JustDied(Unit* killer) { me->RestoreFaction(); } }; - CreatureAI* GetAI_npc_prospector_anvilward(Creature* pCreature) { return new npc_prospector_anvilwardAI(pCreature); } - bool GossipHello_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -106,50 +89,36 @@ bool GossipSelect_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature, } return true; } - /*###### ## Quest 9686 Second Trial ######*/ - #define QUEST_SECOND_TRIAL 9686 - #define MASTER_KELERUN_BLOODMOURN 17807 - #define CHAMPION_BLOODWRATH 17809 #define CHAMPION_LIGHTREND 17810 #define CHAMPION_SWIFTBLADE 17811 #define CHAMPION_SUNSTRIKER 17812 - #define HARBINGER_OF_THE_SECOND_TRIAL 182052 - #define SPELL_FLASH_OF_LIGHT 19939 #define TIMER_FLASH_OF_LIGHT 3225 - #define SPELL_SEAL_OF_JUSTICE 20164 #define TIMER_SEAL_OF_JUSTICE 10000 - #define SPELL_JUDGEMENT_OF_LIGHT 20271 #define TIMER_JUDGEMENT_OF_LIGHT 10000 - #define SPELL_SEAL_OF_COMMAND 20375 #define TIMER_SEAL_OF_COMMAND 20000 - #define OFFSET_NEXT_ATTACK 750 - #define FACTION_HOSTILE 45 #define FACTION_FRIENDLY 7 - // missing from db #define TEXT_SECOND_TRIAL_1 -1645006 #define TEXT_SECOND_TRIAL_2 -1645007 #define TEXT_SECOND_TRIAL_3 -1645008 #define TEXT_SECOND_TRIAL_4 -1645009 - struct Locations { float x, y, z, o; }; - static Locations SpawnPosition[]= { {5.3, -11.8, 0.361, 4.2}, @@ -157,46 +126,35 @@ static Locations SpawnPosition[]= {-5.7, -34.85, 0.361, 1.09}, {-11.9, -18, 0.361, 5.87} }; - static uint32 PaladinEntry[]= {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPION_SWIFTBLADE, CHAMPION_SUNSTRIKER}; - /*###### ## npc_second_trial_paladin ######*/ - struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI { npc_secondTrialAI(Creature *c) : ScriptedAI(c) {} - uint32 timer; uint8 questPhase; uint64 summonerGuid; - bool spellFlashLight; bool spellJustice; bool spellJudLight; bool spellCommand; - uint32 timerFlashLight; uint32 timerJustice; uint32 timerJudLight; uint32 timerCommand; - void Reset() { - timer = 2000; questPhase = 0; summonerGuid = 0; - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL); m_creature->setFaction(FACTION_FRIENDLY); - spellFlashLight = false; spellJustice = false; spellJudLight = false; spellCommand = false; - switch(m_creature->GetEntry()) { case CHAMPION_BLOODWRATH : spellFlashLight = true; @@ -220,18 +178,14 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI break; } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (questPhase == 1) { - if (timer < diff) { m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); m_creature->setFaction(FACTION_HOSTILE); questPhase = 0; - Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target && target->GetTypeId() == TYPEID_PLAYER) // only on players. { @@ -241,10 +195,8 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI } else timer -= diff; } - if (!UpdateVictim()) return; - // healer if (spellFlashLight) { if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 70){ @@ -256,7 +208,6 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI timerFlashLight -= diff; } } - if (spellJustice) { if (timerJustice < diff) { @@ -266,7 +217,6 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI else timerJustice -= diff; } - if (spellJudLight) { if (timerJudLight < diff) { DoCast(m_creature, SPELL_JUDGEMENT_OF_LIGHT); @@ -275,7 +225,6 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI else timerJudLight -= diff; } - if (spellCommand) { if (timerCommand < diff) { DoCast(m_creature, TIMER_SEAL_OF_COMMAND); @@ -284,41 +233,29 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI else timerCommand -= diff; } - DoMeleeAttackIfReady(); } - void Activate(uint64 summonerguid); void KilledUnit(Unit* Killed); void JustDied(Unit* Killer); - }; - /*###### ## npc_second_trial_controller ######*/ - struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI { master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {} - uint8 questPhase; uint8 paladinPhase; uint32 timer; - uint64 paladinGuid[4]; - void Reset() { - questPhase = 0; timer = 60000; paladinPhase = 0; uint64 paladinGuid[] = {0,0,0,0}; - } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { // Quest accepted but object not activated, object despawned (if in sync 1 minute!) @@ -328,14 +265,11 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI } // fight the 4 paladin mobs phase else if (questPhase == 2) { - if (timer < diff) { - Creature* paladinSpawn; paladinSpawn = (Unit::GetCreature((*m_creature), paladinGuid[paladinPhase])); if (paladinSpawn) { CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(m_creature->GetGUID()); - switch(paladinPhase) { case 0: DoScriptText(TEXT_SECOND_TRIAL_1,m_creature); @@ -353,99 +287,75 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI } else Reset(); - questPhase=4; timer = OFFSET_NEXT_ATTACK; } else timer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void StartEvent() { - if (questPhase == 1) { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code - for (int i = 0; i<4; ++i) { Creature* Summoned; Summoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000); - if (Summoned) paladinGuid[i] = Summoned->GetGUID(); } - timer = OFFSET_NEXT_ATTACK; questPhase = 2; } } - void SecondTrialKill(); void SummonedCreatureDespawn(Creature* c) {} }; - bool GossipHello_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature) { // quest only available if not already started // Quest_template flag is set to : QUEST_FLAGS_EVENT // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest. // !not sure if this really works! - if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) { pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SendPreparedQuest(pCreature->GetGUID()); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID()); return true; } - bool QuestAccept_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature, Quest const *quest) { // One Player exclusive quest, wait for user go activation if (quest->GetQuestId() == QUEST_SECOND_TRIAL) CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1; - return true; } - void master_kelerun_bloodmournAI::SecondTrialKill() { - if (questPhase > 0) { - ++paladinPhase; - if (paladinPhase < 4) questPhase=2; else Reset(); // Quest Complete, QuestComplete handler is in npc_secondTrialAI::JustDied } } - void npc_secondTrialAI::JustDied(Unit* Killer) { - if (Killer->GetTypeId() == TYPEID_PLAYER) { Creature* Summoner; Summoner = (Unit::GetCreature((*m_creature), summonerGuid)); - if (Summoner) CAST_AI(master_kelerun_bloodmournAI, Summoner->AI())->SecondTrialKill(); - // last kill quest complete for group if (m_creature->GetEntry() == CHAMPION_SUNSTRIKER) { - if (Group *pGroup = CAST_PLR(Killer)->GetGroup()) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *pGroupGuy = itr->getSource(); - // for any leave or dead (with not released body) group member at appropriate distance if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(m_creature) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) pGroupGuy->CompleteQuest(QUEST_SECOND_TRIAL); @@ -458,62 +368,47 @@ void npc_secondTrialAI::JustDied(Unit* Killer) { } } } - void npc_secondTrialAI::KilledUnit(Unit* Killed) { - if (Killed->GetTypeId() == TYPEID_PLAYER) { - if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); } } - void npc_secondTrialAI::Activate(uint64 summonerguid) { - questPhase=1; summonerGuid = summonerguid; } - CreatureAI* GetAI_master_kelerun_bloodmourn(Creature* pCreature) { return new master_kelerun_bloodmournAI (pCreature); } - CreatureAI* GetAI_npc_secondTrial(Creature* pCreature) { return new npc_secondTrialAI (pCreature); } - /*###### ## go_second_trial ######*/ - bool GOHello_go_second_trial(Player* pPlayer, GameObject* pGO) { // find spawn :: master_kelerun_bloodmourn if (Creature* pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->StartEvent(); - return true; } - /*###### ## npc_apprentice_mirveda ######*/ - #define QUEST_UNEXPECTED_RESULT 8488 #define MOB_GHARZUL 15958 #define MOB_ANGERSHADE 15656 - struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI { npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(m_creature) {} - uint32 KillCount; uint64 PlayerGUID; bool Summon; SummonList Summons; - void Reset() { KillCount = 0; @@ -521,21 +416,17 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI Summons.DespawnAll(); Summon = false; } - void EnterCombat(Unit* who){} - void JustSummoned(Creature *summoned) { summoned->AI()->AttackStart(m_creature); Summons.Summon(summoned); } - void SummonedCreatureDespawn(Creature* summoned) { Summons.Despawn(summoned); ++KillCount; } - void JustDied(Unit* killer) { if (PlayerGUID) @@ -545,7 +436,6 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); } } - void UpdateAI(const uint32 diff) { if (KillCount >= 3) @@ -557,7 +447,6 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); } } - if (Summon) { m_creature->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); @@ -567,7 +456,6 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI } } }; - bool QuestAccept_npc_apprentice_mirveda(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) @@ -577,25 +465,20 @@ bool QuestAccept_npc_apprentice_mirveda(Player* pPlayer, Creature* pCreature, Qu } return true; } - CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature* pCreature) { return new npc_apprentice_mirvedaAI (pCreature); } - /*###### ## npc_infused_crystal ######*/ - #define MOB_ENRAGED_WRAITH 17086 #define EMOTE -1000283 #define QUEST_POWERING_OUR_DEFENSES 8490 - struct Location { float x, y, z; }; - static Location SpawnLocations[]= { {8270.68, -7188.53, 139.619}, @@ -607,17 +490,14 @@ static Location SpawnLocations[]= {8278.51, -7242.13, 139.162}, {8267.97, -7239.17, 139.517} }; - struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI { npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} - uint32 EndTimer; uint32 WaveTimer; bool Completed; bool Progress; uint64 PlayerGUID; - void Reset() { EndTimer = 0; @@ -626,7 +506,6 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI PlayerGUID = 0; WaveTimer = 0; } - void MoveInLineOfSight(Unit* who) { if (!Progress && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 10.0f)) @@ -640,12 +519,10 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI } } } - void JustSummoned(Creature *summoned) { summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) { if (PlayerGUID && !Completed) @@ -655,7 +532,6 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); } } - void UpdateAI(const uint32 diff) { if (EndTimer < diff && Progress) @@ -671,7 +547,6 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); }else EndTimer -= diff; - if (WaveTimer < diff && !Completed && Progress) { uint32 ran1 = rand()%8; @@ -684,46 +559,38 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI }else WaveTimer -= diff; } }; - CreatureAI* GetAI_npc_infused_crystalAI(Creature* pCreature) { return new npc_infused_crystalAI (pCreature); } - void AddSC_eversong_woods() { Script *newscript; - newscript = new Script; newscript->Name = "npc_prospector_anvilward"; newscript->GetAI = &GetAI_npc_prospector_anvilward; newscript->pGossipHello = &GossipHello_npc_prospector_anvilward; newscript->pGossipSelect = &GossipSelect_npc_prospector_anvilward; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_second_trial_controller"; newscript->GetAI = &GetAI_master_kelerun_bloodmourn; newscript->pGossipHello = &GossipHello_master_kelerun_bloodmourn; newscript->pQuestAccept = &QuestAccept_master_kelerun_bloodmourn; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_second_trial_paladin"; newscript->GetAI = &GetAI_npc_secondTrial; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_second_trial"; newscript->pGOHello = &GOHello_go_second_trial; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_apprentice_mirveda"; newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_infused_crystal"; newscript->GetAI = &GetAI_npc_infused_crystalAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp index 8dd1a67a0fc..cc31deb29a3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp @@ -13,40 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Ghostlands SD%Complete: 100 SDComment: Quest support: 9692, 9212. Obtain Budd's Guise of Zul'aman. Vendor Rathis Tomber SDCategory: Ghostlands EndScriptData */ - /* ContentData npc_blood_knight_dawnstar npc_budd_nedreck npc_rathis_tomber npc_ranger_lilatha EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_blood_knight_dawnstar ######*/ - #define GOSSIP_H_BKD "Take Blood Knight Insignia" - bool GossipHello_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -61,25 +52,19 @@ bool GossipSelect_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature } return true; } - /*###### ## npc_budd_nedreck ######*/ - #define GOSSIP_HBN "You gave the crew disguises?" - bool GossipHello_npc_budd_nedreck(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_budd_nedreck(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -89,37 +74,30 @@ bool GossipSelect_npc_budd_nedreck(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_rathis_tomber ######*/ - bool GossipHello_npc_rathis_tomber(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); }else pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_rathis_tomber(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); return true; } - /*##### ## go_gilded_brazier (Paladin First Trail quest (9678)) #####*/ - bool GOHello_gilded_brazier(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(9678) == QUEST_STATUS_INCOMPLETE) @@ -130,11 +108,9 @@ bool GOHello_gilded_brazier(Player* pPlayer, GameObject* pGo) } return true; }; - /*###### ## npc_ranger_lilatha ######*/ - enum eEnums { SAY_START = -1000140, @@ -144,26 +120,20 @@ enum eEnums SAY_END1 = -1000144, SAY_END2 = -1000145, SAY_CAPTAIN_ANSWER = -1000146, - QUEST_ESCAPE_FROM_THE_CATACOMBS = 9212, GO_CAGE = 181152, NPC_CAPTAIN_HELIOS = 16220, FACTION_SMOON_E = 1603, }; - struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI { npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} - std::list CageList; - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: @@ -212,58 +182,48 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI break; } } - void Reset() { if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) Cage->SetGoState(GO_STATE_READY); } }; - bool QuestAccept_npc_ranger_lilatha(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) { pCreature->setFaction(113); - if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilathaAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); } return true; } - CreatureAI* GetAI_npc_ranger_lilathaAI(Creature* pCreature) { return new npc_ranger_lilathaAI(pCreature); } - void AddSC_ghostlands() { Script *newscript; - newscript = new Script; newscript->Name = "npc_blood_knight_dawnstar"; newscript->pGossipHello = &GossipHello_npc_blood_knight_dawnstar; newscript->pGossipSelect = &GossipSelect_npc_blood_knight_dawnstar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_budd_nedreck"; newscript->pGossipHello = &GossipHello_npc_budd_nedreck; newscript->pGossipSelect = &GossipSelect_npc_budd_nedreck; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_rathis_tomber"; newscript->pGossipHello = &GossipHello_npc_rathis_tomber; newscript->pGossipSelect = &GossipSelect_npc_rathis_tomber; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_gilded_brazier"; newscript->pGOHello = &GOHello_gilded_brazier; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ranger_lilatha"; newscript->GetAI = &GetAI_npc_ranger_lilathaAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp index 2a4bf67868b..103d3340595 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Hinterlands SD%Complete: 100 SDComment: Quest support: 863, 2742 SDCategory: The Hinterlands EndScriptData */ - /* ContentData npc_00x09hl npc_rinji EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_00x09hl ######*/ - enum eOOX { SAY_OOX_START = -1000287, @@ -40,22 +35,16 @@ enum eOOX SAY_OOX_AGGRO2 = -1000289, SAY_OOX_AMBUSH = -1000290, SAY_OOX_END = -1000292, - QUEST_RESQUE_OOX_09 = 836, - NPC_MARAUDING_OWL = 7808, NPC_VILE_AMBUSHER = 7809, - FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI { npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -73,13 +62,12 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI break; } } - void WaypointStart(uint32 uiPointId) { switch(uiPointId) { case 27: - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; Position pos; @@ -88,7 +76,7 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI } break; case 44: - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; Position dst; @@ -98,52 +86,42 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI break; } } - void Aggro(Unit* pWho) { if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) return; - if (rand()%1) DoScriptText(SAY_OOX_AGGRO1, m_creature); else DoScriptText(SAY_OOX_AGGRO2, m_creature); } - void JustSummoned(Creature* pSummoned) { pSummoned->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); } }; - bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) { pCreature->SetStandState(UNIT_STAND_STATE_STAND); - if (pPlayer->GetTeam() == ALLIANCE) pCreature->setFaction(FACTION_ESCORTEE_A); else if (pPlayer->GetTeam() == HORDE) pCreature->setFaction(FACTION_ESCORTEE_H); - DoScriptText(SAY_OOX_START, pCreature, pPlayer); - if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - CreatureAI* GetAI_npc_00x09hl(Creature* pCreature) { return new npc_00x09hlAI(pCreature); } - /*###### ## npc_rinji ######*/ - enum eRinji { SAY_RIN_FREE = -1000403, //from here @@ -153,30 +131,25 @@ enum eRinji SAY_RIN_COMPLETE = -1000407, SAY_RIN_PROGRESS_1 = -1000408, SAY_RIN_PROGRESS_2 = -1000409, - QUEST_RINJI_TRAPPED = 2742, NPC_RANGER = 2694, NPC_OUTRUNNER = 2691, GO_RINJI_CAGE = 142036 }; - struct Location { float m_fX, m_fY, m_fZ; }; - Location m_afAmbushSpawn[] = { {191.296204, -2839.329346, 107.388}, {70.972466, -2848.674805, 109.459} }; - Location m_afAmbushMoveTo[] = { {166.630386, -2824.780273, 108.153}, {70.886589, -2874.335449, 116.675} }; - struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI { npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) @@ -184,26 +157,21 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI m_bIsByOutrunner = false; m_iSpawnId = 0; } - bool m_bIsByOutrunner; uint32 m_uiPostEventCount; uint32 m_uiPostEventTimer; int m_iSpawnId; - void Reset() { m_uiPostEventCount = 0; m_uiPostEventTimer = 3000; } - void JustRespawned() { m_bIsByOutrunner = false; m_iSpawnId = 0; - npc_escortAI::JustRespawned(); } - void EnterCombat(Unit* pWho) { if (HasEscortState(STATE_ESCORT_ESCORTING)) @@ -213,45 +181,36 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); m_bIsByOutrunner = true; } - if (rand()%4) return; - //only if attacked and escorter is not in combat? DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), m_creature); } } - void DoSpawnAmbush(bool bFirst) { if (!bFirst) m_iSpawnId = 1; - m_creature->SummonCreature(NPC_RANGER, m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) { m_creature->SummonCreature(NPC_OUTRUNNER, m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); } } - void JustSummoned(Creature* pSummoned) { pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); } - void WaypointReached(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 1: @@ -271,7 +230,6 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI break; } } - void UpdateEscortAI(const uint32 uiDiff) { //Check if we have a current target @@ -282,7 +240,6 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI if (m_uiPostEventTimer < uiDiff) { m_uiPostEventTimer = 3000; - if (Unit* pPlayer = GetPlayerForEscort()) { switch(m_uiPostEventCount) @@ -306,42 +263,34 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI else m_uiPostEventTimer -= uiDiff; } - return; } - DoMeleeAttackIfReady(); } }; - bool QuestAccept_npc_rinji(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) { if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) pGo->UseDoorOrButton(); - if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinjiAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - CreatureAI* GetAI_npc_rinji(Creature* pCreature) { return new npc_rinjiAI(pCreature); } - void AddSC_hinterlands() { Script* newscript; - newscript = new Script; newscript->Name = "npc_00x09hl"; newscript->GetAI = &GetAI_npc_00x09hl; newscript->pQuestAccept = &QuestAccept_npc_00x09hl; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_rinji"; newscript->GetAI = &GetAI_npc_rinji; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp index c087434f28c..27f4286bd58 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp @@ -13,35 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Ironforge SD%Complete: 100 SDComment: Quest support: 3702 SDCategory: Ironforge EndScriptData */ - /* ContentData npc_royal_historian_archesonus EndContentData */ - #include "precompiled.h" - /*###### ## npc_royal_historian_archesonus ######*/ - #define GOSSIP_ITEM_ROYAL "I am ready to listen" #define GOSSIP_ITEM_ROYAL_1 "That is tragic. How did this happen?" #define GOSSIP_ITEM_ROYAL_2 "Interesting, continue please." #define GOSSIP_ITEM_ROYAL_3 "Unbelievable! How dare they??" #define GOSSIP_ITEM_ROYAL_4 "Of course I will help!" - bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -49,10 +42,8 @@ bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCrea } else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -80,11 +71,9 @@ bool GossipSelect_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCre } return true; } - void AddSC_ironforge() { Script *newscript; - newscript = new Script; newscript->Name = "npc_royal_historian_archesonus"; newscript->pGossipHello = &GossipHello_npc_royal_historian_archesonus; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/isle_of_queldanas.cpp index 9a9db09c514..7c28190609a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/isle_of_queldanas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/isle_of_queldanas.cpp @@ -13,48 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Isle_of_Queldanas SD%Complete: 100 SDComment: Quest support: 11524, 11525, 11532, 11533, 11542, 11543, 11541 SDCategory: Isle Of Quel'Danas EndScriptData */ - /* ContentData npc_converted_sentry npc_greengill_slave EndContentData */ - #include "precompiled.h" - /*###### ## npc_converted_sentry ######*/ - #define SAY_CONVERTED_1 -1000284 #define SAY_CONVERTED_2 -1000284 - #define SPELL_CONVERT_CREDIT 45009 - struct TRINITY_DLL_DECL npc_converted_sentryAI : public ScriptedAI { npc_converted_sentryAI(Creature *c) : ScriptedAI(c) {} - bool Credit; uint32 Timer; - void Reset() { Credit = false; Timer = 2500; } - void MoveInLineOfSight(Unit *who) { return; } void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (!Credit) @@ -66,7 +55,6 @@ struct TRINITY_DLL_DECL npc_converted_sentryAI : public ScriptedAI DoScriptText(SAY_CONVERTED_1, m_creature); else DoScriptText(SAY_CONVERTED_2, m_creature); - DoCast(m_creature, SPELL_CONVERT_CREDIT); if (m_creature->isPet()) CAST_PET(m_creature)->SetDuration(7500); @@ -79,34 +67,26 @@ CreatureAI* GetAI_npc_converted_sentry(Creature* pCreature) { return new npc_converted_sentryAI (pCreature); } - /*###### ## npc_greengill_slave ######*/ - #define ENRAGE 45111 #define ORB 45109 #define QUESTG 11541 #define DM 25060 - struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI { npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} - uint64 PlayerGUID; - void EnterCombat(Unit* who){} - void Reset() { PlayerGUID = 0; } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) return; - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE)) { PlayerGUID = caster->GetGUID(); @@ -125,27 +105,22 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_greengill_slaveAI(Creature* pCreature) { return new npc_greengill_slaveAI(pCreature); } - void AddSC_isle_of_queldanas() { Script *newscript; - newscript = new Script; newscript->Name = "npc_converted_sentry"; newscript->GetAI = &GetAI_npc_converted_sentry; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_greengill_slave"; newscript->GetAI = &GetAI_npc_greengill_slaveAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_curator.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_curator.cpp index 2a2d64e412e..9416ab3b2c3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_curator.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_curator.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Curator SD%Complete: 100 SDComment: SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1532057 #define SAY_SUMMON1 -1532058 #define SAY_SUMMON2 -1532059 @@ -31,27 +28,21 @@ EndScriptData */ #define SAY_KILL1 -1532062 #define SAY_KILL2 -1532063 #define SAY_DEATH -1532064 - //Flare spell info #define SPELL_ASTRAL_FLARE_PASSIVE 30234 //Visual effect + Flare damage - //Curator spell info #define SPELL_HATEFUL_BOLT 30383 #define SPELL_EVOCATION 30254 #define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage. #define SPELL_BERSERK 26662 - struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI { boss_curatorAI(Creature *c) : ScriptedAI(c) {} - uint32 AddTimer; uint32 HatefulBoltTimer; uint32 BerserkTimer; - bool Enraged; bool Evocating; - void Reset() { AddTimer = 10000; @@ -59,30 +50,24 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI BerserkTimer = 720000; //12 minutes Enraged = false; Evocating = false; - m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //always decrease BerserkTimer if (BerserkTimer < diff) { @@ -91,20 +76,15 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI { if (m_creature->HasAura(SPELL_EVOCATION)) m_creature->RemoveAurasDueToSpell(SPELL_EVOCATION); - Evocating = false; } - //may not be correct SAY (generic hard enrage) DoScriptText(SAY_ENRAGE, m_creature); - m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature, SPELL_BERSERK); - //don't know if he's supposed to do summon/evocate after hard enrage (probably not) Enraged = true; }else BerserkTimer -= diff; - if (Evocating) { //not supposed to do anything while evocate @@ -113,7 +93,6 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI else Evocating = false; } - if (!Enraged) { if (AddTimer < diff) @@ -122,19 +101,16 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI Creature* AstralFlare = DoSpawnCreature(17096, rand()%37, rand()%37, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (AstralFlare && target) { AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); AstralFlare->AI()->AttackStart(target); } - //Reduce Mana by 10% of max health if (int32 mana = m_creature->GetMaxPower(POWER_MANA)) { mana /= 10; m_creature->ModifyPower(POWER_MANA, -mana); - //if this get's us below 10%, then we evocate (the 10th should be summoned now) if (m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA) < 10) { @@ -153,10 +129,8 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI } } } - AddTimer = 10000; }else AddTimer -= diff; - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 15) { Enraged = true; @@ -164,28 +138,22 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI DoScriptText(SAY_ENRAGE, m_creature); } } - if (HatefulBoltTimer < diff) { if (Enraged) HatefulBoltTimer = 7000; else HatefulBoltTimer = 15000; - if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) DoCast(target, SPELL_HATEFUL_BOLT); - }else HatefulBoltTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_curator(Creature* pCreature) { return new boss_curatorAI (pCreature); } - void AddSC_boss_curator() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_maiden_of_virtue.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_maiden_of_virtue.cpp index df30deb1ff3..6ecf759b11f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_maiden_of_virtue.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_maiden_of_virtue.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Maiden_of_Virtue SD%Complete: 100 SDComment: SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1532018 #define SAY_SLAY1 -1532019 #define SAY_SLAY2 -1532020 @@ -30,25 +27,20 @@ EndScriptData */ #define SAY_REPENTANCE1 -1532022 #define SAY_REPENTANCE2 -1532023 #define SAY_DEATH -1532024 - #define SPELL_REPENTANCE 29511 #define SPELL_HOLYFIRE 29522 #define SPELL_HOLYWRATH 32445 #define SPELL_HOLYGROUND 29512 #define SPELL_BERSERK 26662 - struct TRINITY_DLL_DECL boss_maiden_of_virtueAI : public ScriptedAI { boss_maiden_of_virtueAI(Creature *c) : ScriptedAI(c) {} - uint32 Repentance_Timer; uint32 Holyfire_Timer; uint32 Holywrath_Timer; uint32 Holyground_Timer; uint32 Enrage_Timer; - bool Enraged; - void Reset() { Repentance_Timer = 25000+(rand()%15000); @@ -56,78 +48,60 @@ struct TRINITY_DLL_DECL boss_maiden_of_virtueAI : public ScriptedAI Holywrath_Timer = 15000+(rand()%10000); Holyground_Timer = 3000; Enrage_Timer = 600000; - Enraged = false; } - void KilledUnit(Unit* Victim) { if (urand(0,1) == 0) DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Enrage_Timer < diff && !Enraged) { DoCast(m_creature, SPELL_BERSERK,true); Enraged = true; } else Enrage_Timer -=diff; - if (Holyground_Timer < diff) { DoCast(m_creature, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all Holyground_Timer = 3000; } else Holyground_Timer -= diff; - if (Repentance_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_REPENTANCE); DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), m_creature); - Repentance_Timer = 25000 + rand()%10000; //A little randomness on that spell } else Repentance_Timer -= diff; - if (Holyfire_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_HOLYFIRE); - Holyfire_Timer = 8000 + rand()%15000; //Anywhere from 8 to 23 seconds, good luck having several of those in a row! } else Holyfire_Timer -= diff; - if (Holywrath_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_HOLYWRATH); - Holywrath_Timer = 20000+(rand()%5000); //20-30 secs sounds nice - } else Holywrath_Timer -= diff; - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_boss_maiden_of_virtue(Creature* pCreature) { return new boss_maiden_of_virtueAI (pCreature); } - void AddSC_boss_maiden_of_virtue() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp index 57a0a1c1c5b..d81d50b52f9 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Midnight SD%Complete: 100 SDComment: SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" - #define SAY_MIDNIGHT_KILL -1532000 #define SAY_APPEAR1 -1532001 #define SAY_APPEAR2 -1532002 @@ -34,36 +31,27 @@ EndScriptData */ #define SAY_DEATH -1532008 #define SAY_RANDOM1 -1532009 #define SAY_RANDOM2 -1532010 - #define SPELL_SHADOWCLEAVE 29832 #define SPELL_INTANGIBLE_PRESENCE 29833 #define SPELL_BERSERKER_CHARGE 26561 //Only when mounted - #define MOUNTED_DISPLAYID 16040 - //Attumen (TODO: Use the summoning spell instead of Creature id. It works , but is not convenient for us) #define SUMMON_ATTUMEN 15550 - struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI { boss_midnightAI(Creature *c) : ScriptedAI(c) {} - uint64 Attumen; uint8 Phase; uint32 Mount_Timer; - void Reset() { Phase = 1; Attumen = 0; Mount_Timer = 0; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetVisibility(VISIBILITY_ON); } - void EnterCombat(Unit* who) {} - void KilledUnit(Unit *victim) { if (Phase == 2) @@ -72,12 +60,10 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI DoScriptText(SAY_MIDNIGHT_KILL, pUnit); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Phase == 1 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95) { Phase = 2; @@ -117,11 +103,9 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI } else Mount_Timer -= diff; } } - if (Phase != 3) DoMeleeAttackIfReady(); } - void Mount(Unit *pAttumen) { DoScriptText(SAY_MOUNT, pAttumen); @@ -146,28 +130,23 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI //pAttumen->SendMonsterMove(newX, newY, newZ, 0, true, 1000); Mount_Timer = 1000; } - void SetMidnight(Creature *, uint64); //Below .. }; - CreatureAI* GetAI_boss_midnight(Creature* pCreature) { return new boss_midnightAI(pCreature); } - struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI { boss_attumenAI(Creature *c) : ScriptedAI(c) { Phase = 1; - CleaveTimer = urand(10000,15000); CurseTimer = 30000; RandomYellTimer = urand(30000,60000); //Occasionally yell ChargeTimer = 20000; ResetTimer = 0; } - uint64 Midnight; uint8 Phase; uint32 CleaveTimer; @@ -175,26 +154,21 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI uint32 RandomYellTimer; uint32 ChargeTimer; //only when mounted uint32 ResetTimer; - void Reset() { ResetTimer = 2000; } - void EnterCombat(Unit* who) {} - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight)) pMidnight->Kill(pMidnight); } - void UpdateAI(const uint32 diff) { if (ResetTimer) @@ -213,32 +187,26 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI m_creature->Kill(m_creature); } } else ResetTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return; - if (CleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWCLEAVE); CleaveTimer = urand(10000,15000); } else CleaveTimer -= diff; - if (CurseTimer < diff) { DoCast(m_creature->getVictim(), SPELL_INTANGIBLE_PRESENCE); CurseTimer = 30000; } else CurseTimer -= diff; - if (RandomYellTimer < diff) { DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), m_creature); RandomYellTimer = urand(30000,60000); } else RandomYellTimer -= diff; - if (m_creature->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) { if (ChargeTimer < diff) @@ -246,7 +214,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI Unit *target; std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && !target->IsWithinDist(m_creature, ATTACK_DISTANCE, false)) @@ -255,7 +223,6 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI } if (target_list.size()) target = *(target_list.begin()+rand()%target_list.size()); - DoCast(target, SPELL_BERSERKER_CHARGE); ChargeTimer = 20000; } else ChargeTimer -= diff; @@ -273,27 +240,22 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI } } } - DoMeleeAttackIfReady(); } - void SpellHit(Unit *source, const SpellEntry *spell) { if (spell->Mechanic == MECHANIC_DISARM) DoScriptText(SAY_DISARMED, m_creature); } }; - void boss_midnightAI::SetMidnight(Creature *pAttumen, uint64 value) { CAST_AI(boss_attumenAI, pAttumen->AI())->Midnight = value; } - CreatureAI* GetAI_boss_attumen(Creature* pCreature) { return new boss_attumenAI (pCreature); } - void AddSC_boss_attumen() { Script *newscript; @@ -301,7 +263,6 @@ void AddSC_boss_attumen() newscript->Name = "boss_attumen"; newscript->GetAI = &GetAI_boss_attumen; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_midnight"; newscript->GetAI = &GetAI_boss_midnight; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp index 2714b95f3c4..9a6970905fe 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Moroes SD%Complete: 95 SDComment: SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - #define SAY_AGGRO -1532011 #define SAY_SPECIAL_1 -1532012 #define SAY_SPECIAL_2 -1532013 @@ -31,15 +28,12 @@ EndScriptData */ #define SAY_KILL_2 -1532015 #define SAY_KILL_3 -1532016 #define SAY_DEATH -1532017 - #define SPELL_VANISH 29448 #define SPELL_GARROTE 37066 #define SPELL_BLIND 34694 #define SPELL_GOUGE 29425 #define SPELL_FRENZY 37023 - #define POS_Z 81.73 - float Locations[4][3]= { {-10991.0, -1884.33, 0.614315}, @@ -47,7 +41,6 @@ float Locations[4][3]= {-10978.1, -1887.07, 2.035550}, {-10975.9, -1885.81, 2.253890}, }; - const uint32 Adds[6]= { 17007, @@ -57,32 +50,26 @@ const uint32 Adds[6]= 19875, 19876, }; - struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI { boss_moroesAI(Creature *c) : ScriptedAI(c) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { AddId[i] = 0; } pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint64 AddGUID[4]; - uint32 Vanish_Timer; uint32 Blind_Timer; uint32 Gouge_Timer; uint32 Wait_Timer; uint32 CheckAdds_Timer; uint32 AddId[4]; - bool InVanish; bool Enrage; - void Reset() { Vanish_Timer = 30000; @@ -90,58 +77,45 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI Gouge_Timer = 23000; Wait_Timer = 0; CheckAdds_Timer = 5000; - Enrage = false; InVanish = false; if (m_creature->GetHealth() > 0) { SpawnAdds(); } - if (pInstance) pInstance->SetData(TYPE_MOROES, NOT_STARTED); } - void StartEvent() { if (pInstance) pInstance->SetData(TYPE_MOROES, IN_PROGRESS); - DoZoneInCombat(); } - void EnterCombat(Unit* who) { StartEvent(); - DoScriptText(SAY_AGGRO, m_creature); AddsAttack(); DoZoneInCombat(); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), m_creature); } - void JustDied(Unit* victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_MOROES, DONE); - DeSpawnAdds(); - //remove aura from spell Garrote when Moroes dies Map* pMap = m_creature->GetMap(); if (pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_GARROTE,0)) @@ -149,7 +123,6 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } } } - void SpawnAdds() { DeSpawnAdds(); @@ -158,18 +131,14 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI Creature *pCreature = NULL; std::vector AddList; - - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) AddList.push_back(Adds[i]); - while(AddList.size() > 4) AddList.erase((AddList.begin())+(rand()%AddList.size())); - uint8 i = 0; - for(std::vector::iterator itr = AddList.begin(); itr != AddList.end(); ++itr) + for (std::vector::iterator itr = AddList.begin(); itr != AddList.end(); ++itr) { uint32 entry = *itr; - pCreature = m_creature->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); if (pCreature) { @@ -180,7 +149,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } }else { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature *pCreature = m_creature->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); if (pCreature) @@ -190,20 +159,18 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } } } - bool isAddlistEmpty() { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (AddId[i] == 0) return true; } return false; } - void DeSpawnAdds() { - for(uint8 i = 0; i < 4 ; ++i) + for (uint8 i = 0; i < 4 ; ++i) { Creature* Temp = NULL; if (AddGUID[i]) @@ -214,10 +181,9 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } } } - void AddsAttack() { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature* Temp = NULL; if (AddGUID[i]) @@ -232,24 +198,20 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (pInstance && !pInstance->GetData(TYPE_MOROES)) { EnterEvadeMode(); return; } - if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) { DoCast(m_creature, SPELL_FRENZY); Enrage = true; } - if (CheckAdds_Timer < diff) { for (uint8 i = 0; i < 4; ++i) @@ -265,7 +227,6 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI } CheckAdds_Timer = 5000; } else CheckAdds_Timer -= diff; - if (!Enrage) { //Cast Vanish, then Garrote random victim @@ -276,75 +237,61 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI Vanish_Timer = 30000; Wait_Timer = 5000; } else Vanish_Timer -= diff; - if (Gouge_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_GOUGE); Gouge_Timer = 40000; } else Gouge_Timer -= diff; - if (Blind_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target && target->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinMeleeRange(target)) { DoCast(target, SPELL_BLIND); - Blind_Timer = 40000; } else Blind_Timer = 1000; } else Blind_Timer -= diff; } - if (InVanish) { if (Wait_Timer < diff) { DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), m_creature); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) target->CastSpell(target, SPELL_GARROTE,true); - InVanish = false; } else Wait_Timer -= diff; } - if (!InVanish) DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI { ScriptedInstance* pInstance; - uint64 GuestGUID[4]; - boss_moroes_guestAI(Creature* c) : ScriptedAI(c) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) GuestGUID[i] = 0; - pInstance = c->GetInstanceData(); } - void Reset() { if (pInstance) pInstance->SetData(TYPE_MOROES, NOT_STARTED); } - void AcquireGUID() { if (!pInstance) return; - GuestGUID[0] = pInstance->GetData64(DATA_MOROES); Creature* Moroes = (Unit::GetCreature((*m_creature), GuestGUID[0])); if (Moroes) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { uint64 GUID = CAST_AI(boss_moroesAI, Moroes->AI())->AddGUID[i]; if (GUID && GUID != m_creature->GetGUID()) @@ -352,7 +299,6 @@ struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI } } } - Unit* SelectTarget() { uint64 TempGUID = GuestGUID[rand()%5]; @@ -362,57 +308,44 @@ struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI if (pUnit && pUnit->isAlive()) return pUnit; } - return m_creature; } - void UpdateAI(const uint32 diff) { if (pInstance && !pInstance->GetData(TYPE_MOROES)) EnterEvadeMode(); - DoMeleeAttackIfReady(); } }; - #define SPELL_MANABURN 29405 #define SPELL_MINDFLY 29570 #define SPELL_SWPAIN 34441 #define SPELL_SHADOWFORM 29406 - struct TRINITY_DLL_DECL boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI { //Shadow Priest boss_baroness_dorothea_millstipeAI(Creature *c) : boss_moroes_guestAI(c) {} - uint32 ManaBurn_Timer; uint32 MindFlay_Timer; uint32 ShadowWordPain_Timer; - void Reset() { ManaBurn_Timer = 7000; MindFlay_Timer = 1000; ShadowWordPain_Timer = 6000; - DoCast(m_creature,SPELL_SHADOWFORM, true); - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (MindFlay_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MINDFLY); MindFlay_Timer = 12000; //3sec channeled }else MindFlay_Timer -= diff; - if (ManaBurn_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -420,7 +353,6 @@ struct TRINITY_DLL_DECL boss_baroness_dorothea_millstipeAI : public boss_moroes_ DoCast(target,SPELL_MANABURN); ManaBurn_Timer = 5000; //3 sec cast }else ManaBurn_Timer -= diff; - if (ShadowWordPain_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -432,49 +364,39 @@ struct TRINITY_DLL_DECL boss_baroness_dorothea_millstipeAI : public boss_moroes_ }else ShadowWordPain_Timer -= diff; } }; - #define SPELL_HAMMEROFJUSTICE 13005 #define SPELL_JUDGEMENTOFCOMMAND 29386 #define SPELL_SEALOFCOMMAND 29385 - struct TRINITY_DLL_DECL boss_baron_rafe_dreugerAI : public boss_moroes_guestAI { //Retr Pally boss_baron_rafe_dreugerAI(Creature *c) : boss_moroes_guestAI(c){} - uint32 HammerOfJustice_Timer; uint32 SealOfCommand_Timer; uint32 JudgementOfCommand_Timer; - void Reset() { HammerOfJustice_Timer = 1000; SealOfCommand_Timer = 7000; JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (SealOfCommand_Timer < diff) { DoCast(m_creature,SPELL_SEALOFCOMMAND); SealOfCommand_Timer = 32000; JudgementOfCommand_Timer = 29000; }else SealOfCommand_Timer -= diff; - if (JudgementOfCommand_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_JUDGEMENTOFCOMMAND); JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; }else JudgementOfCommand_Timer -= diff; - if (HammerOfJustice_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HAMMEROFJUSTICE); @@ -482,186 +404,144 @@ struct TRINITY_DLL_DECL boss_baron_rafe_dreugerAI : public boss_moroes_guestAI }else HammerOfJustice_Timer -= diff; } }; - #define SPELL_DISPELMAGIC 15090 //Self or other guest+Moroes #define SPELL_GREATERHEAL 29564 //Self or other guest+Moroes #define SPELL_HOLYFIRE 29563 #define SPELL_PWSHIELD 29408 - struct TRINITY_DLL_DECL boss_lady_catriona_von_indiAI : public boss_moroes_guestAI { //Holy Priest boss_lady_catriona_von_indiAI(Creature *c) : boss_moroes_guestAI(c) {} - uint32 DispelMagic_Timer; uint32 GreaterHeal_Timer; uint32 HolyFire_Timer; uint32 PowerWordShield_Timer; - void Reset() { DispelMagic_Timer = 11000; GreaterHeal_Timer = 1500; HolyFire_Timer = 5000; PowerWordShield_Timer = 1000; - AcquireGUID(); - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (PowerWordShield_Timer < diff) { DoCast(m_creature,SPELL_PWSHIELD); PowerWordShield_Timer = 15000; }else PowerWordShield_Timer -= diff; - if (GreaterHeal_Timer < diff) { Unit* target = SelectTarget(); - DoCast(target, SPELL_GREATERHEAL); GreaterHeal_Timer = 17000; }else GreaterHeal_Timer -= diff; - if (HolyFire_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HOLYFIRE); HolyFire_Timer = 22000; }else HolyFire_Timer -= diff; - if (DispelMagic_Timer < diff) { if (rand()%2) { Unit* target = SelectTarget(); - DoCast(target, SPELL_DISPELMAGIC); } else DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DISPELMAGIC); - DispelMagic_Timer = 25000; }else DispelMagic_Timer -= diff; } }; - #define SPELL_CLEANSE 29380 //Self or other guest+Moroes #define SPELL_GREATERBLESSOFMIGHT 29381 //Self or other guest+Moroes #define SPELL_HOLYLIGHT 29562 //Self or other guest+Moroes #define SPELL_DIVINESHIELD 41367 - struct TRINITY_DLL_DECL boss_lady_keira_berrybuckAI : public boss_moroes_guestAI { //Holy Pally boss_lady_keira_berrybuckAI(Creature *c) : boss_moroes_guestAI(c) {} - uint32 Cleanse_Timer; uint32 GreaterBless_Timer; uint32 HolyLight_Timer; uint32 DivineShield_Timer; - void Reset() { Cleanse_Timer = 13000; GreaterBless_Timer = 1000; HolyLight_Timer = 7000; DivineShield_Timer = 31000; - AcquireGUID(); - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (DivineShield_Timer < diff) { DoCast(m_creature,SPELL_DIVINESHIELD); DivineShield_Timer = 31000; }else DivineShield_Timer -= diff; - if (HolyLight_Timer < diff) { Unit* target = SelectTarget(); - DoCast(target, SPELL_HOLYLIGHT); HolyLight_Timer = 10000; }else HolyLight_Timer -= diff; - if (GreaterBless_Timer < diff) { Unit* target = SelectTarget(); - DoCast(target, SPELL_GREATERBLESSOFMIGHT); - GreaterBless_Timer = 50000; }else GreaterBless_Timer -= diff; - if (Cleanse_Timer < diff) { Unit* target = SelectTarget(); - DoCast(target, SPELL_CLEANSE); - Cleanse_Timer = 10000; }else Cleanse_Timer -= diff; } }; - #define SPELL_HAMSTRING 9080 #define SPELL_MORTALSTRIKE 29572 #define SPELL_WHIRLWIND 29573 - struct TRINITY_DLL_DECL boss_lord_robin_darisAI : public boss_moroes_guestAI { //Arms Warr boss_lord_robin_darisAI(Creature *c) : boss_moroes_guestAI(c) {} - uint32 Hamstring_Timer; uint32 MortalStrike_Timer; uint32 WhirlWind_Timer; - void Reset() { Hamstring_Timer = 7000; MortalStrike_Timer = 10000; WhirlWind_Timer = 21000; - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (Hamstring_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HAMSTRING); Hamstring_Timer = 12000; }else Hamstring_Timer -= diff; - if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MORTALSTRIKE); MortalStrike_Timer = 18000; }else MortalStrike_Timer -= diff; - if (WhirlWind_Timer < diff) { DoCast(m_creature,SPELL_WHIRLWIND); @@ -669,57 +549,46 @@ struct TRINITY_DLL_DECL boss_lord_robin_darisAI : public boss_moroes_guestAI }else WhirlWind_Timer -= diff; } }; - #define SPELL_DISARM 8379 #define SPELL_HEROICSTRIKE 29567 #define SPELL_SHIELDBASH 11972 #define SPELL_SHIELDWALL 29390 - struct TRINITY_DLL_DECL boss_lord_crispin_ferenceAI : public boss_moroes_guestAI { //Arms Warr boss_lord_crispin_ferenceAI(Creature *c) : boss_moroes_guestAI(c) {} - uint32 Disarm_Timer; uint32 HeroicStrike_Timer; uint32 ShieldBash_Timer; uint32 ShieldWall_Timer; - void Reset() { Disarm_Timer = 6000; HeroicStrike_Timer = 10000; ShieldBash_Timer = 8000; ShieldWall_Timer = 4000; - boss_moroes_guestAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_moroes_guestAI::UpdateAI(diff); - if (Disarm_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DISARM); Disarm_Timer = 12000; }else Disarm_Timer -= diff; - if (HeroicStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HEROICSTRIKE); HeroicStrike_Timer = 10000; }else HeroicStrike_Timer -= diff; - if (ShieldBash_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHIELDBASH); ShieldBash_Timer = 13000; }else ShieldBash_Timer -= diff; - if (ShieldWall_Timer < diff) { DoCast(m_creature,SPELL_SHIELDWALL); @@ -727,76 +596,61 @@ struct TRINITY_DLL_DECL boss_lord_crispin_ferenceAI : public boss_moroes_guestAI }else ShieldWall_Timer -= diff; } }; - CreatureAI* GetAI_boss_moroes(Creature* pCreature) { return new boss_moroesAI (pCreature); } - CreatureAI* GetAI_baroness_dorothea_millstipe(Creature* pCreature) { return new boss_baroness_dorothea_millstipeAI (pCreature); } - CreatureAI* GetAI_baron_rafe_dreuger(Creature* pCreature) { return new boss_baron_rafe_dreugerAI (pCreature); } - CreatureAI* GetAI_lady_catriona_von_indi(Creature* pCreature) { return new boss_lady_catriona_von_indiAI (pCreature); } - CreatureAI* GetAI_lady_keira_berrybuck(Creature* pCreature) { return new boss_lady_keira_berrybuckAI (pCreature); } - CreatureAI* GetAI_lord_robin_daris(Creature* pCreature) { return new boss_lord_robin_darisAI (pCreature); } - CreatureAI* GetAI_lord_crispin_ference(Creature* pCreature) { return new boss_lord_crispin_ferenceAI (pCreature); } - void AddSC_boss_moroes() { Script *newscript; - newscript = new Script; newscript->Name = "boss_moroes"; newscript->GetAI = &GetAI_boss_moroes; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_baroness_dorothea_millstipe"; newscript->GetAI = &GetAI_baroness_dorothea_millstipe; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_baron_rafe_dreuger"; newscript->GetAI = &GetAI_baron_rafe_dreuger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lady_catriona_von_indi"; newscript->GetAI = &GetAI_lady_catriona_von_indi; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lady_keira_berrybuck"; newscript->GetAI = &GetAI_lady_keira_berrybuck; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lord_robin_daris"; newscript->GetAI = &GetAI_lord_robin_daris; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lord_crispin_ference"; newscript->GetAI = &GetAI_lord_crispin_ference; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp index b6e3d25c021..c2d2de25309 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Netherspite SD%Complete: 90 SDComment: Not sure about timing and portals placing SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - #define EMOTE_PHASE_PORTAL -1532089 #define EMOTE_PHASE_BANISH -1532090 - #define SPELL_NETHERBURN_AURA 30522 #define SPELL_VOIDZONE 37063 #define SPELL_NETHER_INFUSION 38688 @@ -35,49 +31,42 @@ EndScriptData */ #define SPELL_BANISH_ROOT 42716 #define SPELL_EMPOWERMENT 38549 #define SPELL_NETHERSPITE_ROAR 38684 - const float PortalCoord[3][3] = { {-11195.353516, -1613.237183, 278.237258}, // Left side {-11137.846680, -1685.607422, 278.239258}, // Right side {-11094.493164, -1591.969238, 279.949188} // Back side }; - enum Netherspite_Portal{ RED_PORTAL = 0, // Perseverence GREEN_PORTAL = 1, // Serenity BLUE_PORTAL = 2 // Dominance }; - const uint32 PortalID[3] = {17369, 17367, 17368}; const uint32 PortalVisual[3] = {30487,30490,30491}; const uint32 PortalBeam[3] = {30465,30464,30463}; const uint32 PlayerBuff[3] = {30421,30422,30423}; const uint32 NetherBuff[3] = {30466,30467,30468}; const uint32 PlayerDebuff[3] = {38637,38638,38639}; - struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI { boss_netherspiteAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - - for(int i=0; i<3; ++i) + for (int i=0; i<3; ++i) { PortalGUID[i] = 0; BeamTarget[i] = 0; BeamerGUID[i] = 0; } // need core fix - for(int i=0; i<3; ++i) + for (int i=0; i<3; ++i) { if(SpellEntry *spell = (SpellEntry*)GetSpellStore()->LookupEntry(PlayerBuff[i])) spell->AttributesEx |= SPELL_ATTR_EX_NEGATIVE; } } - ScriptedInstance* pInstance; - bool PortalPhase; bool Berserk; uint32 PhaseTimer; // timer for phase switching @@ -89,12 +78,10 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI uint64 PortalGUID[3]; // guid's of portals uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals uint64 BeamTarget[3]; // guid's of portals' current targets - bool IsBetween(WorldObject* u1, WorldObject* target, WorldObject* u2) // the in-line checker { if(!u1 || !u2 || !target) return false; - float xn, yn, xp, yp, xh, yh; xn = u1->GetPositionX(); yn = u1->GetPositionY(); @@ -102,30 +89,25 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI yp = u2->GetPositionY(); xh = target->GetPositionX(); yh = target->GetPositionY(); - // check if target is between (not checking distance from the beam yet) if(dist(xn,yn,xh,yh)>=dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh)>=dist(xn,yn,xp,yp)) return false; // check distance from the beam return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f); } - float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance { return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); } - void Reset() { Berserk = false; NetherInfusionTimer = 540000; VoidZoneTimer = 15000; NetherbreathTimer = 3000; - HandleDoors(true); DestroyPortals(); } - void SummonPortals() { uint8 r = rand()%4; @@ -133,18 +115,16 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) - - for(int i=0; i<3; ++i) + for (int i=0; i<3; ++i) if(Creature *portal = m_creature->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000)) { PortalGUID[i] = portal->GetGUID(); portal->AddAura(PortalVisual[i], portal); } } - void DestroyPortals() { - for(int i=0; i<3; ++i) + for (int i=0; i<3; ++i) { if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i])) portal->DisappearAndDie(); @@ -154,23 +134,20 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI BeamTarget[i] = 0; } } - void UpdatePortals() // Here we handle the beams' behavior { - for(int j=0; j<3; ++j) // j = color + for (int j=0; j<3; ++j) // j = color if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[j])) { // the one who's been casted upon before Unit *current = Unit::GetUnit(*portal, BeamTarget[j]); // temporary store for the best suitable beam reciever Unit *target = m_creature; - if(Map* map = m_creature->GetMap()) { Map::PlayerList const& players = map->GetPlayers(); - // get the best suitable target - for(Map::PlayerList::const_iterator i = players.begin(); i!=players.end(); ++i) + for (Map::PlayerList::const_iterator i = players.begin(); i!=players.end(); ++i) { Player* p = i->getSource(); if(p && p->isAlive() // alive @@ -211,7 +188,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI m_creature->getThreatManager().addThreat(target, 100000.0f+DoGetThreat(m_creature->getVictim())); } } - void SwitchToPortalPhase() { m_creature->RemoveAurasDueToSpell(SPELL_BANISH_ROOT); @@ -223,7 +199,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI EmpowermentTimer = 10000; DoScriptText(EMOTE_PHASE_PORTAL,m_creature); } - void SwitchToBanishPhase() { m_creature->RemoveAurasDueToSpell(SPELL_EMPOWERMENT); @@ -234,41 +209,34 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI PhaseTimer = 30000; PortalPhase = false; DoScriptText(EMOTE_PHASE_BANISH,m_creature); - - for(int i=0; i<3; ++i) + for (int i=0; i<3; ++i) m_creature->RemoveAurasDueToSpell(NetherBuff[i]); } - void HandleDoors(bool open) // Massive Door switcher { if(GameObject *Door = GameObject::GetGameObject(*m_creature, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0)) Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); } - void Aggro(Unit *who) { HandleDoors(false); SwitchToPortalPhase(); } - void JustDied(Unit* killer) { HandleDoors(true); DestroyPortals(); } - void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - // Void Zone if(VoidZoneTimer < diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,45,true),SPELL_VOIDZONE,true); VoidZoneTimer = 15000; }else VoidZoneTimer -= diff; - // NetherInfusion Berserk if(!Berserk && NetherInfusionTimer < diff) { @@ -276,7 +244,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI DoCast(m_creature, SPELL_NETHERSPITE_ROAR); Berserk = true; }else NetherInfusionTimer -= diff; - if(PortalPhase) // PORTAL PHASE { // Distribute beams and buffs @@ -285,7 +252,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI UpdatePortals(); PortalTimer = 1000; }else PortalTimer -= diff; - // Empowerment & Nether Burn if(EmpowermentTimer < diff) { @@ -293,7 +259,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI m_creature->AddAura(SPELL_NETHERBURN_AURA, m_creature); EmpowermentTimer = 90000; }else EmpowermentTimer -= diff; - if(PhaseTimer < diff) { if(!m_creature->IsNonMeleeSpellCasted(false)) @@ -312,7 +277,6 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI DoCast(target,SPELL_NETHERBREATH); NetherbreathTimer = 5000+rand()%2000; }else NetherbreathTimer -= diff; - if(PhaseTimer < diff) { if(!m_creature->IsNonMeleeSpellCasted(false)) @@ -322,20 +286,16 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI } }else PhaseTimer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_netherspite(Creature *_Creature) { return new boss_netherspiteAI(_Creature); } - void AddSC_boss_netherspite() { Script *newscript; - newscript = new Script; newscript->Name = "boss_netherspite"; newscript->GetAI = GetAI_boss_netherspite; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp index 0168ce10a35..b853414448d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Nightbane SD%Complete: 80 SDComment: SDComment: Timers may incorrect SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - //phase 1 #define SPELL_BELLOWING_ROAR 39427 #define SPELL_CHARRED_EARTH 30129 @@ -36,14 +33,12 @@ EndScriptData */ #define SPELL_FIREBALL_BARRAGE 30282 #define SPELL_SEARING_CINDERS 30127 #define SPELL_SUMMON_SKELETON 30170 - #define EMOTE_SUMMON "An ancient being awakens in the distance..." #define YELL_AGGRO "What fools! I shall bring a quick end to your suffering!" #define YELL_FLY_PHASE "Miserable vermin. I shall exterminate you from the air!" #define YELL_LAND_PHASE_1 "Enough! I shall land and crush you myself!" #define YELL_LAND_PHASE_2 "Insects! Let me show you my strength up close!" #define EMOTE_BREATH "takes a deep breath." - float IntroWay[8][3] = { {-11053.37,-1794.48,149}, @@ -55,7 +50,6 @@ float IntroWay[8][3] = {-11140 , -1915 ,122}, {-11163 , -1903 ,91.473} }; - struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI { boss_nightbaneAI(Creature* c) : ScriptedAI(c) @@ -63,14 +57,10 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI pInstance = c->GetInstanceData(); Intro = true; } - ScriptedInstance* pInstance; - uint32 Phase; - bool RainBones; bool Skeletons; - uint32 BellowingRoarTimer; uint32 CharredEarthTimer; uint32 DistractingAshTimer; @@ -80,17 +70,13 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI uint32 SmokingBlastTimer; uint32 FireballBarrageTimer; uint32 SearingCindersTimer; - uint32 FlyCount; uint32 FlyTimer; - bool Intro; bool Flying; bool Movement; - uint32 WaitTimer; uint32 MovePhase; - void Reset() { BellowingRoarTimer = 30000; @@ -103,16 +89,13 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI FireballBarrageTimer = 13000; SearingCindersTimer = 14000; WaitTimer = 1000; - Phase =1; FlyCount = 0; MovePhase = 0; - m_creature->SetSpeed(MOVE_RUN, 2.0f); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->setActive(true); - if (pInstance) { if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS) @@ -120,19 +103,15 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI else pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED); } - HandleTerraceDoors(true); - Flying = false; Movement = false; - if (!Intro) { m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); m_creature->GetMotionMaster()->MoveTargetedHome(); } } - void HandleTerraceDoors(bool open) { if(pInstance) @@ -141,41 +120,33 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); } } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS); - HandleTerraceDoors(false); m_creature->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); } - void AttackStart(Unit* who) { if (!Intro && !Flying) ScriptedAI::AttackStart(who); } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(TYPE_NIGHTBANE, DONE); - HandleTerraceDoors(true); } - void MoveInLineOfSight(Unit *who) { if (!Intro && !Flying) ScriptedAI::MoveInLineOfSight(who); } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (Intro) { if (id >= 8) @@ -184,10 +155,8 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); return; } - WaitTimer = 1; } - if (Flying) { if (id == 0) @@ -197,14 +166,12 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI Phase = 2; return; } - if (id == 3) { MovePhase = 4; WaitTimer = 1; return; } - if (id == 8) { Flying = false; @@ -212,36 +179,28 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI Movement = true; return; } - WaitTimer = 1; } } - void JustSummoned(Creature *summoned) { summoned->AI()->AttackStart(m_creature->getVictim()); } - void TakeOff() { m_creature->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); - m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); (*m_creature).GetMotionMaster()->Clear(false); (*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); - Flying = true; - FlyTimer = 45000+rand()%15000; //timer wrong between 45 and 60 seconds ++FlyCount; - RainofBonesTimer = 5000; //timer wrong (maybe) RainBones = false; Skeletons = false; } - void UpdateAI(const uint32 diff) { if (WaitTimer) @@ -261,7 +220,6 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI ++MovePhase; } } - if (Flying) { if (MovePhase >= 7) @@ -276,16 +234,12 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI ++MovePhase; } } - WaitTimer = 0; }else WaitTimer -= diff; - if (!UpdateVictim()) return; - if (Flying) return; - // Phase 1 "GROUND FIGHT" if (Phase == 1) { @@ -294,26 +248,22 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI DoStartMovement(m_creature->getVictim()); Movement = false; } - if (BellowingRoarTimer < diff) { DoCast(m_creature->getVictim(),SPELL_BELLOWING_ROAR); BellowingRoarTimer = 30000+rand()%10000 ; //Timer }else BellowingRoarTimer -= diff; - if (SmolderingBreathTimer < diff) { DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH); SmolderingBreathTimer = 20000;//timer }else SmolderingBreathTimer -= diff; - if (CharredEarthTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_CHARRED_EARTH); CharredEarthTimer = 20000; //timer }else CharredEarthTimer -= diff; - if (TailSweepTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -321,29 +271,22 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI DoCast(target,SPELL_TAIL_SWEEP); TailSweepTimer = 15000;//timer }else TailSweepTimer -= diff; - if (SearingCindersTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_SEARING_CINDERS); SearingCindersTimer = 10000; //timer }else SearingCindersTimer -= diff; - uint32 Prozent; Prozent = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth(); - if (Prozent < 75 && FlyCount == 0) // first take off 75% TakeOff(); - if (Prozent < 50 && FlyCount == 1) // secound take off 50% TakeOff(); - if (Prozent < 25 && FlyCount == 2) // third take off 25% TakeOff(); - DoMeleeAttackIfReady(); } - //Phase 2 "FLYING FIGHT" if (Phase == 2) { @@ -357,14 +300,12 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI Skeletons = true; } } - if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 { DoCast(m_creature->getVictim(),SPELL_RAIN_OF_BONES); RainBones = true; SmokingBlastTimer = 20000; }else RainofBonesTimer -= diff; - if (DistractingAshTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -372,7 +313,6 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI DistractingAshTimer = 2000;//timer wrong }else DistractingAshTimer -= diff; } - if (RainBones) { if (SmokingBlastTimer < diff) @@ -381,35 +321,29 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI SmokingBlastTimer = 1500 ; //timer wrong }else SmokingBlastTimer -= diff; } - if (FireballBarrageTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0)) DoCast(target,SPELL_FIREBALL_BARRAGE); FireballBarrageTimer = 20000; //Timer }else FireballBarrageTimer -= diff; - if (FlyTimer < diff) //landing { if (rand()%2 == 0) m_creature->MonsterYell(YELL_LAND_PHASE_1, LANG_UNIVERSAL, NULL); else m_creature->MonsterYell(YELL_LAND_PHASE_2, LANG_UNIVERSAL, NULL); - (*m_creature).GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); - Flying = true; }else FlyTimer -= diff; } } }; - CreatureAI* GetAI_boss_nightbane(Creature* pCreature) { return new boss_nightbaneAI (pCreature); } - void AddSC_boss_nightbane() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp index 4f78b626067..89640d64ba0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Prince_Malchezzar SD%Complete: 100 SDComment: SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - #define SAY_AGGRO -1532091 #define SAY_AXE_TOSS1 -1532092 #define SAY_AXE_TOSS2 -1532093 @@ -36,15 +33,12 @@ EndScriptData */ #define SAY_SUMMON1 -1532100 #define SAY_SUMMON2 -1532101 #define SAY_DEATH -1532102 - // 18 Coordinates for Infernal spawns struct InfernalPoint { float x,y; }; - #define INFERNAL_Z 275.5 - static InfernalPoint InfernalPoints[] = { {-10922.8, -1985.2}, @@ -66,16 +60,12 @@ static InfernalPoint InfernalPoints[] = {-10932.8, -1979.6}, {-10935.7, -1996.0} }; - #define TOTAL_INFERNAL_POINTS 18 - //Enfeeble is supposed to reduce hp to 1 and then heal player back to full when it ends //Along with reducing healing and regen while enfeebled to 0% //This spell effect will only reduce healing - #define SPELL_ENFEEBLE 30843 //Enfeeble during phase 1 and 2 #define SPELL_ENFEEBLE_EFFECT 41624 - #define SPELL_SHADOWNOVA 30852 //Shadownova used during all phases #define SPELL_SW_PAIN 30854 //Shadow word pain during phase 1 and 3 (different targeting rules though) #define SPELL_THRASH_PASSIVE 12787 //Extra attack chance during phase 2 @@ -87,27 +77,21 @@ static InfernalPoint InfernalPoints[] = #define SPELL_HELLFIRE 30859 //Infenals' hellfire aura #define NETHERSPITE_INFERNAL 17646 //The netherspite infernal creature #define MALCHEZARS_AXE 17650 //Malchezar's axes (creatures), summoned during phase 3 - #define INFERNAL_MODEL_INVISIBLE 11686 //Infernal Effects #define SPELL_INFERNAL_RELAY 30834 - #define EQUIP_ID_AXE 33542 //Axes info - //---------Infernal code first struct TRINITY_DLL_DECL netherspite_infernalAI : public ScriptedAI { netherspite_infernalAI(Creature *c) : ScriptedAI(c) , malchezaar(0), HellfireTimer(0), CleanupTimer(0), point(NULL) {} - uint32 HellfireTimer; uint32 CleanupTimer; uint32 malchezaar; InfernalPoint *point; - void Reset() {} void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} - void UpdateAI(const uint32 diff) { if (HellfireTimer) @@ -117,7 +101,6 @@ struct TRINITY_DLL_DECL netherspite_infernalAI : public ScriptedAI HellfireTimer = 0; } else HellfireTimer -= diff; - if (CleanupTimer) if (CleanupTimer <= diff) { @@ -125,14 +108,12 @@ struct TRINITY_DLL_DECL netherspite_infernalAI : public ScriptedAI CleanupTimer = 0; } else CleanupTimer -= diff; } - void KilledUnit(Unit *who) { Unit *pMalchezaar = Unit::GetUnit(*m_creature, malchezaar); if (pMalchezaar) CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); } - void SpellHit(Unit *who, const SpellEntry *spell) { if (spell->Id == SPELL_INFERNAL_RELAY) @@ -143,23 +124,19 @@ struct TRINITY_DLL_DECL netherspite_infernalAI : public ScriptedAI CleanupTimer = 170000; } } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetGUID() != malchezaar) damage = 0; } - void Cleanup(); //below ... }; - struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI { boss_malchezaarAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 EnfeebleTimer; uint32 EnfeebleResetTimer; @@ -171,29 +148,22 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI uint32 InfernalTimer; uint32 AxesTargetSwitchTimer; uint32 InfernalCleanupTimer; - std::vector infernals; std::vector positions; - uint64 axes[2]; uint64 enfeeble_targets[5]; uint64 enfeeble_health[5]; - uint32 phase; - void Reset() { AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); - - for(uint8 i =0; i < 5; ++i) + for (uint8 i =0; i < 5; ++i) enfeeble_targets[i] = 0; - - for(uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); - EnfeebleTimer = 30000; EnfeebleResetTimer = 38000; ShadowNovaTimer = 35500; @@ -205,44 +175,35 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI AxesTargetSwitchTimer = 7500 + rand()%12500; SunderArmorTimer = 5000 + rand()%5000; phase = 1; - if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); - - for(uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); - if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in } - void InfernalCleanup() { //Infernal Cleanup - for(std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) + for (std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) { Unit *pInfernal = Unit::GetUnit(*m_creature, *itr); if (pInfernal && pInfernal->isAlive()) @@ -253,10 +214,9 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI } infernals.clear(); } - void AxesCleanup() { - for(uint8 i=0; i<2; ++i) + for (uint8 i=0; i<2; ++i) { Unit *axe = Unit::GetUnit(*m_creature, axes[i]); if (axe && axe->isAlive()) @@ -264,64 +224,53 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI axes[i] = 0; } } - void ClearWeapons() { SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - //damage const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); m_creature->UpdateDamagePhysical(BASE_ATTACK); } - void EnfeebleHealthEffect() { const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); if (!info) return; - std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector targets; - if (!t_list.size()) return; - //begin + 1 , so we don't target the one with the highest threat std::list::iterator itr = t_list.begin(); std::advance(itr, 1); - for(; itr!= t_list.end(); ++itr) //store the threat list in a different container + for (; itr!= t_list.end(); ++itr) //store the threat list in a different container { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //only on alive players if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); } - //cut down to size if we have more than 5 targets while(targets.size() > 5) targets.erase(targets.begin()+rand()%targets.size()); - int i = 0; - for(std::vector::iterator iter = targets.begin(); iter!= targets.end(); ++iter, ++i) + for (std::vector::iterator iter = targets.begin(); iter!= targets.end(); ++iter, ++i) { Unit *target = *iter; if (target) { enfeeble_targets[i] = target->GetGUID(); enfeeble_health[i] = target->GetHealth(); - target->CastSpell(target, SPELL_ENFEEBLE, true, 0, 0, m_creature->GetGUID()); target->SetHealth(1); } } - } - void EnfeebleResetHealth() { - for(uint8 i = 0; i < 5; ++i) + for (uint8 i = 0; i < 5; ++i) { Unit *target = Unit::GetUnit(*m_creature, enfeeble_targets[i]); if (target && target->isAlive()) @@ -330,7 +279,6 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI enfeeble_health[i] = 0; } } - void SummonInfernal(const uint32 diff) { InfernalPoint *point = NULL; @@ -344,9 +292,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI positions.erase(itr); pos.Relocate(point->x, point->y, INFERNAL_Z); } - Creature *Infernal = m_creature->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); - if (Infernal) { Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); @@ -354,64 +300,49 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI if (point) CAST_AI(netherspite_infernalAI, Infernal->AI())->point=point; CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=m_creature->GetGUID(); - infernals.push_back(Infernal->GetGUID()); DoCast(Infernal, SPELL_INFERNAL_RELAY); } - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (EnfeebleResetTimer) if (EnfeebleResetTimer <= diff) //Let's not forget to reset that { EnfeebleResetHealth(); EnfeebleResetTimer=0; }else EnfeebleResetTimer -= diff; - if (m_creature->hasUnitState(UNIT_STAT_STUNNED)) //While shifting to phase 2 malchezaar stuns himself return; - if (m_creature->GetUInt64Value(UNIT_FIELD_TARGET)!=m_creature->getVictim()->GetGUID()) m_creature->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->getVictim()->GetGUID()); - if (phase == 1) { if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 60) { m_creature->InterruptNonMeleeSpells(false); - phase = 2; - //animation DoCast(m_creature, SPELL_EQUIP_AXES); - //text DoScriptText(SAY_AXE_TOSS1, m_creature); - //passive thrash aura m_creature->CastSpell(m_creature, SPELL_THRASH_AURA, true); - //models SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); - //damage const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); m_creature->UpdateDamagePhysical(BASE_ATTACK); - m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); //Sigh, updating only works on main attack , do it manually .... m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); - m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100); } } @@ -420,18 +351,13 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 30) { InfernalTimer = 15000; - phase = 3; - ClearWeapons(); - //remove thrash m_creature->RemoveAurasDueToSpell(SPELL_THRASH_AURA); - DoScriptText(SAY_AXE_TOSS2, m_creature); - Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); - for(uint32 i=0; i<2; ++i) + for (uint32 i=0; i<2; ++i) { Creature *axe = m_creature->SummonCreature(MALCHEZARS_AXE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (axe) @@ -448,25 +374,19 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI } } } - if (ShadowNovaTimer > 35000) ShadowNovaTimer = EnfeebleTimer + 5000; - return; } - if (SunderArmorTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SUNDER_ARMOR); SunderArmorTimer = 10000 + rand()%8000; - }else SunderArmorTimer -= diff; - if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); Cleave_Timer = 6000 + rand()%6000; - }else Cleave_Timer -= diff; } else @@ -474,11 +394,10 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI if (AxesTargetSwitchTimer < diff) { AxesTargetSwitchTimer = 7500 + rand()%12500 ; - Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { Unit *axe = Unit::GetUnit(*m_creature, axes[i]); if (axe) @@ -494,27 +413,23 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI } } } else AxesTargetSwitchTimer -= diff; - if (AmplifyDamageTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AMPLIFY_DAMAGE); AmplifyDamageTimer = 20000 + rand()%10000; }else AmplifyDamageTimer -= diff; } - //Time for global and double timers if (InfernalTimer < diff) { SummonInfernal(diff); InfernalTimer = phase == 3 ? 14500 : 44500; //15 secs in phase 3, 45 otherwise }else InfernalTimer -= diff; - if (ShadowNovaTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWNOVA); ShadowNovaTimer = phase == 3 ? 31000 : -1; }else ShadowNovaTimer -= diff; - if (phase != 2) { if (SWPainTimer < diff) @@ -524,14 +439,11 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI target = m_creature->getVictim(); // the tank else //anyone but the tank target = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (target) DoCast(target, SPELL_SW_PAIN); - SWPainTimer = 20000; }else SWPainTimer -= diff; } - if (phase != 3) { if (EnfeebleTimer < diff) @@ -542,13 +454,11 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI EnfeebleResetTimer = 9000; }else EnfeebleTimer -= diff; } - if (phase==2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); } - void DoMeleeAttacksIfReady() { if (m_creature->IsWithinMeleeRange(m_creature->getVictim()) && !m_creature->IsNonMeleeSpellCasted(false)) @@ -567,38 +477,31 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI } } } - void Cleanup(Creature *infernal, InfernalPoint *point) { - for(std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) + for (std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) if (*itr == infernal->GetGUID()) { infernals.erase(itr); break; } - positions.push_back(point); } }; - void netherspite_infernalAI::Cleanup() { Unit *pMalchezaar = Unit::GetUnit(*m_creature, malchezaar); - if (pMalchezaar && pMalchezaar->isAlive()) CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(m_creature, point); } - CreatureAI* GetAI_netherspite_infernal(Creature* pCreature) { return new netherspite_infernalAI (pCreature); } - CreatureAI* GetAI_boss_malchezaar(Creature* pCreature) { return new boss_malchezaarAI (pCreature); } - void AddSC_boss_malchezaar() { Script *newscript; @@ -606,7 +509,6 @@ void AddSC_boss_malchezaar() newscript->Name = "boss_malchezaar"; newscript->GetAI = &GetAI_boss_malchezaar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "netherspite_infernal"; newscript->GetAI = &GetAI_netherspite_infernal; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp index 5bdd4304d33..c30c7c54500 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp @@ -13,19 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Shade_of_Aran SD%Complete: 95 SDComment: Flame wreath missing cast animation, mods won't triggere. SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "simple_ai.h" #include "def_karazhan.h" #include "GameObject.h" - #define SAY_AGGRO1 -1532073 #define SAY_AGGRO2 -1532074 #define SAY_AGGRO3 -1532075 @@ -42,7 +39,6 @@ EndScriptData */ #define SAY_TIMEOVER -1532086 #define SAY_DEATH -1532087 #define SAY_ATIESH -1532088 //Atiesh is equipped by a raid member - //Spells #define SPELL_FROSTBOLT 29954 #define SPELL_FIREBALL 29953 @@ -61,58 +57,46 @@ EndScriptData */ #define SPELL_DRINK 30024 #define SPELL_POTION 32453 #define SPELL_AOE_PYROBLAST 29978 - //Creature Spells #define SPELL_CIRCULAR_BLIZZARD 29951 //29952 is the REAL circular blizzard that leaves persistant blizzards that last for 10 seconds #define SPELL_WATERBOLT 31012 #define SPELL_SHADOW_PYRO 29978 - //Creatures #define CREATURE_WATER_ELEMENTAL 17167 #define CREATURE_SHADOW_OF_ARAN 18254 #define CREATURE_ARAN_BLIZZARD 17161 - enum SuperSpell { SUPER_FLAME = 0, SUPER_BLIZZARD, SUPER_AE, }; - struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI { boss_aranAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 SecondarySpellTimer; uint32 NormalCastTimer; uint32 SuperCastTimer; uint32 BerserkTimer; uint32 CloseDoorTimer; // Don't close the door right on aggro in case some people are still entering. - uint8 LastSuperSpell; - uint32 FlameWreathTimer; uint32 FlameWreathCheckTime; uint64 FlameWreathTarget[3]; float FWTargPosX[3]; float FWTargPosY[3]; - uint32 CurrentNormalSpell; uint32 ArcaneCooldown; uint32 FireCooldown; uint32 FrostCooldown; - uint32 DrinkInturruptTimer; - bool ElementalsSpawned; bool Drinking; bool DrinkInturrupted; - void Reset() { SecondarySpellTimer = 5000; @@ -120,23 +104,17 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI SuperCastTimer = 35000; BerserkTimer = 720000; CloseDoorTimer = 15000; - LastSuperSpell = rand()%3; - FlameWreathTimer = 0; FlameWreathCheckTime = 0; - CurrentNormalSpell = 0; ArcaneCooldown = 0; FireCooldown = 0; FrostCooldown = 0; - DrinkInturruptTimer = 10000; - ElementalsSpawned = false; Drinking = false; DrinkInturrupted = false; - if (pInstance) { // Not in progress @@ -144,57 +122,47 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); } } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { pInstance->SetData(TYPE_ARAN, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); } } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); - if (pInstance) { pInstance->SetData(TYPE_ARAN, IN_PROGRESS); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); } } - void FlameWreathEffect() { std::vector targets; std::list t_list = m_creature->getThreatManager().getThreatList(); - if (!t_list.size()) return; - //store the threat list in a different container - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //only on alive players if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); } - //cut down to size if we have more than 3 targets while(targets.size() > 3) targets.erase(targets.begin()+rand()%targets.size()); - uint32 i = 0; - for(std::vector::iterator itr = targets.begin(); itr!= targets.end(); ++itr) + for (std::vector::iterator itr = targets.begin(); itr!= targets.end(); ++itr) { if (*itr) { @@ -206,12 +174,10 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CloseDoorTimer) { if (CloseDoorTimer <= diff) @@ -223,7 +189,6 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } }else CloseDoorTimer -= diff; } - //Cooldowns for casts if (ArcaneCooldown) { @@ -231,28 +196,23 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI ArcaneCooldown -= diff; else ArcaneCooldown = 0; } - if (FireCooldown) { if (FireCooldown >= diff) FireCooldown -= diff; else FireCooldown = 0; } - if (FrostCooldown) { if (FrostCooldown >= diff) FrostCooldown -= diff; else FrostCooldown = 0; } - if (!Drinking && m_creature->GetMaxPower(POWER_MANA) && (m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA)) < 20) { Drinking = true; m_creature->InterruptNonMeleeSpells(false); - DoScriptText(SAY_DRINK, m_creature); - if (!DrinkInturrupted) { m_creature->CastSpell(m_creature, SPELL_MASS_POLY, true); @@ -262,7 +222,6 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI DrinkInturruptTimer = 10000; } } - //Drink Inturrupt if (Drinking && DrinkInturrupted) { @@ -272,7 +231,6 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI m_creature->SetPower(POWER_MANA, m_creature->GetMaxPower(POWER_MANA)-32000); m_creature->CastSpell(m_creature, SPELL_POTION, false); } - //Drink Inturrupt Timer if (Drinking && !DrinkInturrupted) if (DrinkInturruptTimer >= diff) @@ -285,11 +243,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI DrinkInturrupted = true; Drinking = false; } - //Don't execute any more code if we are drinking if (Drinking) return; - //Normal casts if (NormalCastTimer < diff) { @@ -299,10 +255,8 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!target) return; - uint32 Spells[3]; uint8 AvailableSpells = 0; - //Check for what spells are not on cooldown if (!ArcaneCooldown) { @@ -319,7 +273,6 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI Spells[AvailableSpells] = SPELL_FROSTBOLT; AvailableSpells++; } - //If no available spells wait 1 second and try again if (AvailableSpells) { @@ -329,12 +282,10 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } NormalCastTimer = 1000; }else NormalCastTimer -= diff; - if (SecondarySpellTimer < diff) { switch (rand()%2) { - case 0: DoCast(m_creature, SPELL_AOE_CS); break; @@ -345,11 +296,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } SecondarySpellTimer = 5000 + (rand()%15000); }else SecondarySpellTimer -= diff; - if (SuperCastTimer < diff) { uint8 Available[2]; - switch (LastSuperSpell) { case SUPER_AE: @@ -365,47 +314,36 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI Available[1] = SUPER_AE; break; } - LastSuperSpell = Available[rand()%2]; - switch (LastSuperSpell) { case SUPER_AE: - if (rand()%2) DoScriptText(SAY_EXPLOSION1, m_creature); else DoScriptText(SAY_EXPLOSION2, m_creature); - m_creature->CastSpell(m_creature, SPELL_BLINK_CENTER, true); m_creature->CastSpell(m_creature, SPELL_PLAYERPULL, true); m_creature->CastSpell(m_creature, SPELL_MASSSLOW, true); m_creature->CastSpell(m_creature, SPELL_AEXPLOSION, false); break; - case SUPER_FLAME: if (rand()%2) DoScriptText(SAY_FLAMEWREATH1, m_creature); else DoScriptText(SAY_FLAMEWREATH2, m_creature); - FlameWreathTimer = 20000; FlameWreathCheckTime = 500; - FlameWreathTarget[0] = 0; FlameWreathTarget[1] = 0; FlameWreathTarget[2] = 0; - FlameWreathEffect(); break; - case SUPER_BLIZZARD: - if (rand()%2) DoScriptText(SAY_BLIZZARD1, m_creature); else DoScriptText(SAY_BLIZZARD2, m_creature); - if (Creature* pSpawn = m_creature->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) { pSpawn->setFaction(m_creature->getFaction()); @@ -413,14 +351,11 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } break; } - SuperCastTimer = 35000 + (rand()%5000); }else SuperCastTimer -= diff; - if (!ElementalsSpawned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 40) { ElementalsSpawned = true; - for (uint32 i = 0; i < 4; ++i) { if (Creature* pUnit = m_creature->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) @@ -429,10 +364,8 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI pUnit->setFaction(m_creature->getFaction()); } } - DoScriptText(SAY_ELEMENTALS, m_creature); } - if (BerserkTimer < diff) { for (uint32 i = 0; i < 5; ++i) @@ -443,26 +376,21 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI pUnit->setFaction(m_creature->getFaction()); } } - DoScriptText(SAY_TIMEOVER, m_creature); - BerserkTimer = 60000; }else BerserkTimer -= diff; - //Flame Wreath check if (FlameWreathTimer) { if (FlameWreathTimer >= diff) FlameWreathTimer -= diff; else FlameWreathTimer = 0; - if (FlameWreathCheckTime < diff) { for (uint32 i = 0; i < 3; ++i) { if (!FlameWreathTarget[i]) continue; - Unit* pUnit = Unit::GetUnit(*m_creature, FlameWreathTarget[i]); if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) { @@ -474,17 +402,14 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI FlameWreathCheckTime = 500; }else FlameWreathCheckTime -= diff; } - if (ArcaneCooldown && FireCooldown && FrostCooldown) DoMeleeAttackIfReady(); } - void DamageTaken(Unit* pAttacker, uint32 &damage) { if (!DrinkInturrupted && Drinking && damage) DrinkInturrupted = true; } - void SpellHit(Unit* pAttacker, const SpellEntry* Spell) { //We only care about inturrupt effects and only if they are durring a spell currently being casted @@ -492,13 +417,10 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI Spell->Effect[1]!=SPELL_EFFECT_INTERRUPT_CAST && Spell->Effect[2]!=SPELL_EFFECT_INTERRUPT_CAST) || !m_creature->IsNonMeleeSpellCasted(false)) return; - //Inturrupt effect m_creature->InterruptNonMeleeSpells(false); - //Normally we would set the cooldown equal to the spell duration //but we do not have access to the DurationStore - switch (CurrentNormalSpell) { case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; @@ -507,25 +429,19 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL water_elementalAI : public ScriptedAI { water_elementalAI(Creature *c) : ScriptedAI(c) {} - uint32 CastTimer; - void Reset() { CastTimer = 2000 + (rand()%3000); } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CastTimer < diff) { DoCast(m_creature->getVictim(), SPELL_WATERBOLT); @@ -533,34 +449,27 @@ struct TRINITY_DLL_DECL water_elementalAI : public ScriptedAI }else CastTimer -= diff; } }; - CreatureAI* GetAI_boss_aran(Creature* pCreature) { return new boss_aranAI (pCreature); } - CreatureAI* GetAI_water_elemental(Creature* pCreature) { return new water_elementalAI (pCreature); } - // CONVERT TO ACID CreatureAI* GetAI_shadow_of_aran(Creature* pCreature) { outstring_log("TSCR: Convert simpleAI script for Creature Entry %u to ACID", pCreature->GetEntry()); SimpleAI* ai = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; ai->Spell[0].Cooldown = 5000; ai->Spell[0].First_Cast = 1000; ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->EnterEvadeMode(); - return ai; } - void AddSC_boss_shade_of_aran() { Script *newscript; @@ -568,12 +477,10 @@ void AddSC_boss_shade_of_aran() newscript->Name = "boss_shade_of_aran"; newscript->GetAI = &GetAI_boss_aran; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadow_of_aran"; newscript->GetAI = &GetAI_shadow_of_aran; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_aran_elemental"; newscript->GetAI = &GetAI_water_elemental; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp index f60fab0bddb..82684f57181 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Terestian_Illhoof SD%Complete: 95 SDComment: Complete! Needs adjustments to use spell though. SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - #define SAY_SLAY1 -1532065 #define SAY_SLAY2 -1532066 #define SAY_DEATH -1532067 @@ -32,7 +29,6 @@ EndScriptData */ #define SAY_SACRIFICE2 -1532070 #define SAY_SUMMON1 -1532071 #define SAY_SUMMON2 -1532072 - #define SPELL_SUMMON_DEMONCHAINS 30120 // Summons demonic chains that maintain the ritual of sacrifice. #define SPELL_DEMON_CHAINS 30206 // Instant - Visual Effect #define SPELL_ENRAGE 23537 // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. @@ -41,38 +37,29 @@ EndScriptData */ #define SPELL_BERSERK 32965 // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. #define SPELL_SUMMON_FIENDISIMP 30184 // Summons a Fiendish Imp. #define SPELL_SUMMON_IMP 30066 // Summons Kil'rek - #define SPELL_FIENDISH_PORTAL 30171 // Opens portal and summons Fiendish Portal, 2 sec cast #define SPELL_FIENDISH_PORTAL_1 30179 // Opens portal and summons Fiendish Portal, instant cast - #define SPELL_FIREBOLT 30050 // Blasts a target for 150 Fire damage. #define SPELL_BROKEN_PACT 30065 // All damage taken increased by 25%. #define SPELL_AMPLIFY_FLAMES 30053 // Increases the Fire damage taken by an enemy by 500 for 25 sec. - #define CREATURE_DEMONCHAINS 17248 #define CREATURE_FIENDISHIMP 17267 #define CREATURE_PORTAL 17265 #define CREATURE_KILREK 17229 - struct TRINITY_DLL_DECL mob_kilrekAI : public ScriptedAI { mob_kilrekAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 TerestianGUID; - uint32 AmplifyTimer; - void Reset() { TerestianGUID = 0; AmplifyTimer = 2000; } - void EnterCombat(Unit *who) { if (!pInstance) @@ -81,7 +68,6 @@ struct TRINITY_DLL_DECL mob_kilrekAI : public ScriptedAI return; } } - void JustDied(Unit* Killer) { if (pInstance) @@ -95,40 +81,31 @@ struct TRINITY_DLL_DECL mob_kilrekAI : public ScriptedAI } }else ERROR_INST_DATA(m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (AmplifyTimer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature->getVictim(),SPELL_AMPLIFY_FLAMES); - AmplifyTimer = 10000 + rand()%10000; }else AmplifyTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_demon_chainAI : public ScriptedAI { mob_demon_chainAI(Creature *c) : ScriptedAI(c) {} - uint64 SacrificeGUID; - void Reset() { SacrificeGUID = 0; } - void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} - void JustDied(Unit *killer) { if (SacrificeGUID) @@ -139,55 +116,44 @@ struct TRINITY_DLL_DECL mob_demon_chainAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_fiendish_portalAI : public PassiveAI { mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(m_creature){} - SummonList summons; - void Reset() { summons.DespawnAll(); } - void JustSummoned(Creature* summon) { summons.Summon(summon); DoZoneInCombat(summon); } - void DespawnAllImp() { summons.DespawnAll(); } }; - struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI { boss_terestianAI(Creature *c) : ScriptedAI(c) { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) PortalGUID[i] = 0; pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint64 PortalGUID[2]; uint8 PortalsCount; - uint32 SacrificeTimer; uint32 ShadowboltTimer; uint32 SummonTimer; uint32 BerserkTimer; - bool SummonedPortals; bool Berserk; - void Reset() { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (PortalGUID[i]) { @@ -196,25 +162,19 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI CAST_AI(mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); pPortal->ForcedDespawn(); } - PortalGUID[i] = 0; } } - PortalsCount = 0; SacrificeTimer = 30000; ShadowboltTimer = 5000; SummonTimer = 10000; BerserkTimer = 600000; - SummonedPortals = false; Berserk = false; - if (pInstance) pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED); - m_creature->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); - if(Minion* Kilrek = m_creature->GetFirstMinion()) { if(!Kilrek->isAlive()) @@ -225,19 +185,16 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI } else DoCast(m_creature, SPELL_SUMMON_IMP, true); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == CREATURE_PORTAL) { PortalGUID[PortalsCount] = pSummoned->GetGUID(); PortalsCount++; - if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) { DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature); @@ -245,36 +202,29 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *killer) { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (PortalGUID[i]) { if (Creature* pPortal = Unit::GetCreature((*m_creature), PortalGUID[i])) pPortal->ForcedDespawn(); - PortalGUID[i] = 0; } } - DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_TERESTIAN, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (SacrificeTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); @@ -282,7 +232,6 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI { DoCast(target, SPELL_SACRIFICE, true); DoCast(target, SPELL_SUMMON_DEMONCHAINS, true); - Creature* Chains = m_creature->FindNearestCreature(CREATURE_DEMONCHAINS, 5000); if (Chains) { @@ -293,21 +242,17 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI } } }else SacrificeTimer -= diff; - if (ShadowboltTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); ShadowboltTimer = 10000; }else ShadowboltTimer -= diff; - if (SummonTimer < diff) { if(!PortalGUID[0]) DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL, false); - if(!PortalGUID[1]) DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL_1, false); - if(PortalGUID[0] && PortalGUID[1]) { if (Creature* pPortal = Unit::GetCreature(*m_creature, PortalGUID[rand()%2])) @@ -315,7 +260,6 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI SummonTimer = 5000; } }else SummonTimer -= diff; - if (!Berserk) { if (BerserkTimer < diff) @@ -324,69 +268,53 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI Berserk = true; }else BerserkTimer -= diff; } - DoMeleeAttackIfReady(); } }; - #define SPELL_FIREBOLT 30050 // Blasts a target for 181-209 Fire damage. - struct TRINITY_DLL_DECL mob_fiendish_impAI : public ScriptedAI { mob_fiendish_impAI(Creature *c) : ScriptedAI(c) {} - uint32 FireboltTimer; - void Reset() { FireboltTimer = 2000; - m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (FireboltTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FIREBOLT); FireboltTimer = 2200; }else FireboltTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_kilrek(Creature* pCreature) { return new mob_kilrekAI (pCreature); } - CreatureAI* GetAI_mob_fiendish_imp(Creature* pCreature) { return new mob_fiendish_impAI (pCreature); } - CreatureAI* GetAI_mob_fiendish_portal(Creature* pCreature) { return new mob_fiendish_portalAI (pCreature); } - CreatureAI* GetAI_boss_terestian_illhoof(Creature* pCreature) { return new boss_terestianAI (pCreature); } - CreatureAI* GetAI_mob_demon_chain(Creature* pCreature) { return new mob_demon_chainAI(pCreature); } - void AddSC_boss_terestian_illhoof() { Script *newscript; @@ -394,22 +322,18 @@ void AddSC_boss_terestian_illhoof() newscript->Name = "boss_terestian_illhoof"; newscript->GetAI = &GetAI_boss_terestian_illhoof; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_fiendish_imp"; newscript->GetAI = &GetAI_mob_fiendish_imp; newscript->RegisterSelf(); - newscript = new Script; newscript->Name= "mob_fiendish_portal"; newscript->GetAI = &GetAI_mob_fiendish_portal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_kilrek"; newscript->GetAI = &GetAI_mob_kilrek; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_demon_chain"; newscript->GetAI = &GetAI_mob_demon_chain; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/bosses_opera.cpp index 51827bd3fb3..c402bb2bfee 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/bosses_opera.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/bosses_opera.cpp @@ -13,83 +13,65 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Bosses_Opera SD%Complete: 90 SDComment: Oz, Hood, and RAJ event implemented. RAJ event requires more testing. SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - /***********************************/ /*** OPERA WIZARD OF OZ EVENT *****/ /*********************************/ - #define SAY_DOROTHEE_DEATH -1532025 #define SAY_DOROTHEE_SUMMON -1532026 #define SAY_DOROTHEE_TITO_DEATH -1532027 #define SAY_DOROTHEE_AGGRO -1532028 - #define SAY_ROAR_AGGRO -1532029 #define SAY_ROAR_DEATH -1532030 #define SAY_ROAR_SLAY -1532031 - #define SAY_STRAWMAN_AGGRO -1532032 #define SAY_STRAWMAN_DEATH -1532033 #define SAY_STRAWMAN_SLAY -1532034 - #define SAY_TINHEAD_AGGRO -1532035 #define SAY_TINHEAD_DEATH -1532036 #define SAY_TINHEAD_SLAY -1532037 #define EMOTE_RUST -1532038 - #define SAY_CRONE_AGGRO -1532039 #define SAY_CRONE_AGGRO2 -1532040 #define SAY_CRONE_DEATH -1532041 #define SAY_CRONE_SLAY -1532042 - /**** Spells ****/ // Dorothee #define SPELL_WATERBOLT 31012 #define SPELL_SCREAM 31013 #define SPELL_SUMMONTITO 31014 - // Tito #define SPELL_YIPPING 31015 - // Strawman #define SPELL_BRAIN_BASH 31046 #define SPELL_BRAIN_WIPE 31069 #define SPELL_BURNING_STRAW 31075 - // Tinhead #define SPELL_CLEAVE 31043 #define SPELL_RUST 31086 - // Roar #define SPELL_MANGLE 31041 #define SPELL_SHRED 31042 #define SPELL_FRIGHTENED_SCREAM 31013 - // Crone #define SPELL_CHAIN_LIGHTNING 32337 - // Cyclone #define SPELL_KNOCKBACK 32334 #define SPELL_CYCLONE_VISUAL 32332 - /** Creature Entries **/ #define CREATURE_TITO 17548 #define CREATURE_CYCLONE 18412 #define CREATURE_CRONE 18168 - void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) { pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, SPECIAL); // Increment DeathCount - if (pInstance->GetData(DATA_OPERA_OZ_DEATHCOUNT) == 4) { if (Creature* pCrone = pCreature->SummonCreature(CREATURE_CRONE, -10891.96, -1755.95, pCreature->GetPositionZ(), 4.64, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) @@ -99,73 +81,55 @@ void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) } } }; - struct TRINITY_DLL_DECL boss_dorotheeAI : public ScriptedAI { boss_dorotheeAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AggroTimer; - uint32 WaterBoltTimer; uint32 FearTimer; uint32 SummonTitoTimer; - bool SummonedTito; bool TitoDied; - void Reset() { AggroTimer = 500; - WaterBoltTimer = 5000; FearTimer = 15000; SummonTitoTimer = 47500; - SummonedTito = false; TitoDied = false; } - void EnterCombat(Unit* who) { DoScriptText(SAY_DOROTHEE_AGGRO, m_creature); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void SummonTito(); // See below - void JustDied(Unit* killer) { DoScriptText(SAY_DOROTHEE_DEATH, m_creature); - if (pInstance) SummonCroneIfReady(pInstance, m_creature); } - void AttackStart(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void UpdateAI(const uint32 diff) { if (AggroTimer) @@ -176,48 +140,38 @@ struct TRINITY_DLL_DECL boss_dorotheeAI : public ScriptedAI AggroTimer = 0; }else AggroTimer -= diff; } - if (!UpdateVictim()) return; - if (WaterBoltTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT); WaterBoltTimer = TitoDied ? 1500 : 5000; }else WaterBoltTimer -= diff; - if (FearTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SCREAM); FearTimer = 30000; }else FearTimer -= diff; - if (!SummonedTito) { if (SummonTitoTimer < diff) SummonTito(); else SummonTitoTimer -= diff; } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI { mob_titoAI(Creature* c) : ScriptedAI(c) {} - uint64 DorotheeGUID; uint32 YipTimer; - void Reset() { DorotheeGUID = 0; YipTimer = 10000; } - void EnterCombat(Unit* who) {} - void JustDied(Unit* killer) { if (DorotheeGUID) @@ -230,22 +184,18 @@ struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (YipTimer < diff) { DoCast(m_creature->getVictim(), SPELL_YIPPING); YipTimer = 10000; }else YipTimer -= diff; - DoMeleeAttackIfReady(); } }; - void boss_dorotheeAI::SummonTito() { if (Creature* pTito = m_creature->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) @@ -257,53 +207,42 @@ void boss_dorotheeAI::SummonTito() TitoDied = false; } } - struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI { boss_strawmanAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AggroTimer; uint32 BrainBashTimer; uint32 BrainWipeTimer; - void Reset() { AggroTimer = 13000; BrainBashTimer = 5000; BrainWipeTimer = 7000; } - void AttackStart(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void EnterCombat(Unit* who) { DoScriptText(SAY_STRAWMAN_AGGRO, m_creature); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void SpellHit(Unit* caster, const SpellEntry *Spell) { if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) @@ -312,24 +251,19 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI if (not direct damage(aoe,dot)) return; */ - DoCast(m_creature, SPELL_BURNING_STRAW, true); } } - void JustDied(Unit* killer) { DoScriptText(SAY_STRAWMAN_DEATH, m_creature); - if (pInstance) SummonCroneIfReady(pInstance, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(SAY_STRAWMAN_SLAY, m_creature); } - void UpdateAI(const uint32 diff) { if (AggroTimer) @@ -340,89 +274,69 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI AggroTimer = 0; }else AggroTimer -= diff; } - if (!UpdateVictim()) return; - if (BrainBashTimer < diff) { DoCast(m_creature->getVictim(), SPELL_BRAIN_BASH); BrainBashTimer = 15000; }else BrainBashTimer -= diff; - if (BrainWipeTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_BRAIN_WIPE); BrainWipeTimer = 20000; }else BrainWipeTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI { boss_tinheadAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AggroTimer; uint32 CleaveTimer; uint32 RustTimer; - uint8 RustCount; - void Reset() { AggroTimer = 15000; CleaveTimer = 5000; RustTimer = 30000; - RustCount = 0; } - void EnterCombat(Unit* who) { DoScriptText(SAY_TINHEAD_AGGRO, m_creature); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void AttackStart(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit* killer) { DoScriptText(SAY_TINHEAD_DEATH, m_creature); - if (pInstance) SummonCroneIfReady(pInstance, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(SAY_TINHEAD_SLAY, m_creature); } - void UpdateAI(const uint32 diff) { if (AggroTimer) @@ -433,16 +347,13 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI AggroTimer = 0; }else AggroTimer -= diff; } - if (!UpdateVictim()) return; - if (CleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); CleaveTimer = 5000; }else CleaveTimer -= diff; - if (RustCount < 8) { if (RustTimer < diff) @@ -453,25 +364,20 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI RustTimer = 6000; }else RustTimer -= diff; } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI { boss_roarAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AggroTimer; uint32 MangleTimer; uint32 ShredTimer; uint32 ScreamTimer; - void Reset() { AggroTimer = 20000; @@ -479,46 +385,36 @@ struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI ShredTimer = 10000; ScreamTimer = 15000; } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void AttackStart(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void EnterCombat(Unit* who) { DoScriptText(SAY_ROAR_AGGRO, m_creature); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void JustDied(Unit* killer) { DoScriptText(SAY_ROAR_DEATH, m_creature); - if (pInstance) SummonCroneIfReady(pInstance, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(SAY_ROAR_SLAY, m_creature); } - void UpdateAI(const uint32 diff) { if (AggroTimer) @@ -529,85 +425,68 @@ struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI AggroTimer = 0; }else AggroTimer -= diff; } - if (!UpdateVictim()) return; - if (MangleTimer < diff) { DoCast(m_creature->getVictim(), SPELL_MANGLE); MangleTimer = 5000 + rand()%3000; }else MangleTimer -= diff; - if (ShredTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SHRED); ShredTimer = 10000 + rand()%5000; }else ShredTimer -= diff; - if (ScreamTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FRIGHTENED_SCREAM); ScreamTimer = 20000 + rand()%10000; }else ScreamTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI { boss_croneAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 CycloneTimer; uint32 ChainLightningTimer; - void Reset() { CycloneTimer = 30000; ChainLightningTimer = 10000; } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void EnterCombat(Unit* who) { DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), m_creature); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - void JustDied(Unit* killer) { DoScriptText(SAY_CRONE_DEATH, m_creature); - if (pInstance) { pInstance->SetData(TYPE_OPERA, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (CycloneTimer < diff) { Creature* Cyclone = DoSpawnCreature(CREATURE_CYCLONE, rand()%10, rand()%10, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); @@ -615,39 +494,30 @@ struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_VISUAL, true); CycloneTimer = 30000; }else CycloneTimer -= diff; - if (ChainLightningTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING); ChainLightningTimer = 15000; }else ChainLightningTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_cycloneAI : public ScriptedAI { mob_cycloneAI(Creature* c) : ScriptedAI(c) {} - uint32 MoveTimer; - void Reset() { MoveTimer = 1000; } - void EnterCombat(Unit* who) {} - void MoveInLineOfSight(Unit* who) { } - void UpdateAI(const uint32 diff) { if (!m_creature->HasAura(SPELL_KNOCKBACK)) DoCast(m_creature, SPELL_KNOCKBACK, true); - if (MoveTimer < diff) { Position pos; @@ -657,145 +527,112 @@ struct TRINITY_DLL_DECL mob_cycloneAI : public ScriptedAI }else MoveTimer -= diff; } }; - CreatureAI* GetAI_boss_dorothee(Creature* pCreature) { return new boss_dorotheeAI(pCreature); } - CreatureAI* GetAI_boss_strawman(Creature* pCreature) { return new boss_strawmanAI(pCreature); } - CreatureAI* GetAI_boss_tinhead(Creature* pCreature) { return new boss_tinheadAI(pCreature); } - CreatureAI* GetAI_boss_roar(Creature* pCreature) { return new boss_roarAI(pCreature); } - CreatureAI* GetAI_boss_crone(Creature* pCreature) { return new boss_croneAI(pCreature); } - CreatureAI* GetAI_mob_tito(Creature* pCreature) { return new mob_titoAI(pCreature); } - CreatureAI* GetAI_mob_cyclone(Creature* pCreature) { return new mob_cycloneAI(pCreature); } - /**************************************/ /**** Opera Red Riding Hood Event ****/ /************************************/ - /**** Yells for the Wolf ****/ #define SAY_WOLF_AGGRO -1532043 #define SAY_WOLF_SLAY -1532044 #define SAY_WOLF_HOOD -1532045 #define SOUND_WOLF_DEATH 9275 //Only sound on death, no text. - /**** Spells For The Wolf ****/ #define SPELL_LITTLE_RED_RIDING_HOOD 30768 #define SPELL_TERRIFYING_HOWL 30752 #define SPELL_WIDE_SWIPE 30761 - #define GOSSIP_GRANDMA "What phat lewtz you have grandmother?" - /**** The Wolf's Entry ****/ #define CREATURE_BIG_BAD_WOLF 17521 - bool GossipHello_npc_grandmother(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GRANDMA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(8990, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_grandmother(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) { if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) pBigBadWolf->AI()->AttackStart(pPlayer); - pCreature->ForcedDespawn(); } - return true; } - struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI { boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 ChaseTimer; uint32 FearTimer; uint32 SwipeTimer; - uint64 HoodGUID; float TempThreat; - bool IsChasing; - void Reset() { ChaseTimer = 30000; FearTimer = 25000 + rand()%10000; SwipeTimer = 5000; - HoodGUID = 0; TempThreat = 0; - IsChasing = false; } - void EnterCombat(Unit* who) { DoScriptText(SAY_WOLF_AGGRO, m_creature); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void JustDied(Unit* killer) { DoPlaySoundToSet(m_creature, SOUND_WOLF_DEATH); - if (pInstance) { pInstance->SetData(TYPE_OPERA, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); - if (ChaseTimer < diff) { if (!IsChasing) @@ -804,7 +641,6 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI if (target && target->GetTypeId() == TYPEID_PLAYER) { DoScriptText(SAY_WOLF_HOOD, m_creature); - DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true); TempThreat = DoGetThreat(target); if (TempThreat) @@ -818,7 +654,6 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI else { IsChasing = false; - if (Unit* target = Unit::GetUnit((*m_creature), HoodGUID)) { HoodGUID = 0; @@ -827,38 +662,30 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI m_creature->AddThreat(target, TempThreat); TempThreat = 0; } - ChaseTimer = 40000; } }else ChaseTimer -= diff; - if (IsChasing) return; - if (FearTimer < diff) { DoCast(m_creature->getVictim(), SPELL_TERRIFYING_HOWL); FearTimer = 25000 + rand()%10000; }else FearTimer -= diff; - if (SwipeTimer < diff) { DoCast(m_creature->getVictim(), SPELL_WIDE_SWIPE); SwipeTimer = 25000 + rand()%5000; }else SwipeTimer -= diff; - } }; - CreatureAI* GetAI_boss_bigbadwolf(Creature* pCreature) { return new boss_bigbadwolfAI(pCreature); } - /**********************************************/ /******** Opera Romeo and Juliet Event *******/ /********************************************/ - /**** Speech *****/ #define SAY_JULIANNE_AGGRO -1532046 #define SAY_JULIANNE_ENTER -1532047 @@ -866,42 +693,35 @@ CreatureAI* GetAI_boss_bigbadwolf(Creature* pCreature) #define SAY_JULIANNE_DEATH02 -1532049 #define SAY_JULIANNE_RESURRECT -1532050 #define SAY_JULIANNE_SLAY -1532051 - #define SAY_ROMULO_AGGRO -1532052 #define SAY_ROMULO_DEATH -1532053 #define SAY_ROMULO_ENTER -1532054 #define SAY_ROMULO_RESURRECT -1532055 #define SAY_ROMULO_SLAY -1532056 - /***** Spells For Julianne *****/ #define SPELL_BLINDING_PASSION 30890 #define SPELL_DEVOTION 30887 #define SPELL_ETERNAL_AFFECTION 30878 #define SPELL_POWERFUL_ATTRACTION 30889 #define SPELL_DRINK_POISON 30907 - /***** Spells For Romulo ****/ #define SPELL_BACKWARD_LUNGE 30815 #define SPELL_DARING 30841 #define SPELL_DEADLY_SWATHE 30817 #define SPELL_POISON_THRUST 30822 - /**** Other Misc. Spells ****/ #define SPELL_UNDYING_LOVE 30951 #define SPELL_RES_VISUAL 24171 - /*** Misc. Information ****/ #define CREATURE_ROMULO 17533 #define ROMULO_X -10900 #define ROMULO_Y -1758 - enum RAJPhase { PHASE_JULIANNE = 0, PHASE_ROMULO = 1, PHASE_BOTH = 2, }; - void PretendToDie(Creature* pCreature) { pCreature->InterruptNonMeleeSpells(true); @@ -912,7 +732,6 @@ void PretendToDie(Creature* pCreature) pCreature->GetMotionMaster()->MoveIdle(); pCreature->SetStandState(UNIT_STAND_STATE_DEAD); }; - void Resurrect(Creature* target) { target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -927,7 +746,6 @@ void Resurrect(Creature* target) else target->GetMotionMaster()->Initialize(); }; - struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI { boss_julianneAI(Creature* c) : ScriptedAI(c) @@ -937,16 +755,11 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI AggroYellTimer = 10000; IsFakingDeath = false; } - ScriptedInstance* pInstance; - uint32 EntryYellTimer; uint32 AggroYellTimer; - uint64 RomuloGUID; - uint32 Phase; - uint32 BlindingPassionTimer; uint32 DevotionTimer; uint32 EternalAffectionTimer; @@ -955,16 +768,13 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI uint32 ResurrectTimer; uint32 DrinkPoisonTimer; uint32 ResurrectSelfTimer; - bool IsFakingDeath; bool SummonedRomulo; bool RomuloDead; - void Reset() { RomuloGUID = 0; Phase = PHASE_JULIANNE; - BlindingPassionTimer = 30000; DevotionTimer = 15000; EternalAffectionTimer = 25000; @@ -972,40 +782,31 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI SummonRomuloTimer = 10000; DrinkPoisonTimer = 0; ResurrectSelfTimer = 0; - if (IsFakingDeath) { Resurrect(m_creature); IsFakingDeath = false; } - SummonedRomulo = false; RomuloDead = false; } - void EnterCombat(Unit* who) {} - void AttackStart(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void SpellHit(Unit* caster, const SpellEntry *Spell) { if (Spell->Id == SPELL_DRINK_POISON) @@ -1014,13 +815,10 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI DrinkPoisonTimer = 2500; } } - void DamageTaken(Unit* done_by, uint32 &damage); - void JustDied(Unit* killer) { DoScriptText(SAY_JULIANNE_DEATH02, m_creature); - if (pInstance) { pInstance->SetData(TYPE_OPERA, DONE); @@ -1030,15 +828,12 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } } - void KilledUnit(Unit* victim) { DoScriptText(SAY_JULIANNE_SLAY, m_creature); } - void UpdateAI(const uint32 diff); }; - struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI { boss_romuloAI(Creature* c) : ScriptedAI(c) @@ -1047,12 +842,9 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI EntryYellTimer = 8000; AggroYellTimer = 15000; } - ScriptedInstance* pInstance; - uint64 JulianneGUID; uint32 Phase; - uint32 EntryYellTimer; uint32 AggroYellTimer; uint32 BackwardLungeTimer; @@ -1060,32 +852,25 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI uint32 DeadlySwatheTimer; uint32 PoisonThrustTimer; uint32 ResurrectTimer; - bool IsFakingDeath; bool JulianneDead; - void Reset() { JulianneGUID = 0; Phase = PHASE_ROMULO; - BackwardLungeTimer = 15000; DaringTimer = 20000; DeadlySwatheTimer = 25000; PoisonThrustTimer = 10000; ResurrectTimer = 10000; - IsFakingDeath = false; JulianneDead = false; } - void JustReachedHome() { m_creature->ForcedDespawn(); } - void DamageTaken(Unit* done_by, uint32 &damage); - void EnterCombat(Unit* who) { DoScriptText(SAY_ROMULO_AGGRO, m_creature); @@ -1099,68 +884,53 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI } } } - void MoveInLineOfSight(Unit* who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit* killer) { DoScriptText(SAY_ROMULO_DEATH, m_creature); - if (pInstance) { pInstance->SetData(TYPE_OPERA, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } } - void KilledUnit(Unit* victim) { DoScriptText(SAY_ROMULO_SLAY, m_creature); } - void UpdateAI(const uint32 diff); }; - void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage) { if (damage < m_creature->GetHealth()) return; - //anything below only used if incoming damage will kill - if (Phase == PHASE_JULIANNE) { damage = 0; - //this means already drinking, so return if (IsFakingDeath) return; - m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature, SPELL_DRINK_POISON); - IsFakingDeath = true; //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)); return; } - if (Phase == PHASE_ROMULO) { error_log("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); damage = 0; return; } - if (Phase == PHASE_BOTH) { //if this is true then we have to kill romulo too @@ -1175,10 +945,8 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage) Romulo->DeleteThreatList(); Romulo->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - return; } - //if not already returned, then romulo is alive and we can pretend die if (Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID))) { @@ -1192,31 +960,25 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage) } error_log("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen."); } - void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage) { if (damage < m_creature->GetHealth()) return; - //anything below only used if incoming damage will kill - if (Phase == PHASE_ROMULO) { DoScriptText(SAY_ROMULO_DEATH, m_creature); PretendToDie(m_creature); IsFakingDeath = true; Phase = PHASE_BOTH; - if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID))) { CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true; CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; } - damage = 0; return; } - if (Phase == PHASE_BOTH) { if (JulianneDead) @@ -1232,7 +994,6 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage) } return; } - if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID))) { PretendToDie(m_creature); @@ -1243,10 +1004,8 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage) return; } } - error_log("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); } - void boss_julianneAI::UpdateAI(const uint32 diff) { if (EntryYellTimer) @@ -1257,7 +1016,6 @@ void boss_julianneAI::UpdateAI(const uint32 diff) EntryYellTimer = 0; }else EntryYellTimer -= diff; } - if (AggroYellTimer) { if (AggroYellTimer <= diff) @@ -1268,7 +1026,6 @@ void boss_julianneAI::UpdateAI(const uint32 diff) AggroYellTimer = 0; }else AggroYellTimer -= diff; } - if (DrinkPoisonTimer) { //will do this 2secs after spell hit. this is time to display visual as expected @@ -1280,7 +1037,6 @@ void boss_julianneAI::UpdateAI(const uint32 diff) DrinkPoisonTimer = 0; }else DrinkPoisonTimer -= diff; } - if (Phase == PHASE_ROMULO && !SummonedRomulo) { if (SummonRomuloTimer < diff) @@ -1291,13 +1047,11 @@ void boss_julianneAI::UpdateAI(const uint32 diff) CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = m_creature->GetGUID(); CAST_AI(boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; DoZoneInCombat(pRomulo); - pRomulo->setFaction(16); } SummonedRomulo = true; }else SummonRomuloTimer -= diff; } - if (ResurrectSelfTimer) { if (ResurrectSelfTimer <= diff) @@ -1305,18 +1059,14 @@ void boss_julianneAI::UpdateAI(const uint32 diff) Resurrect(m_creature); Phase = PHASE_BOTH; IsFakingDeath = false; - if (m_creature->getVictim()) AttackStart(m_creature->getVictim()); - ResurrectSelfTimer = 0; ResurrectTimer = 1000; }else ResurrectSelfTimer -= diff; } - if (!UpdateVictim() || IsFakingDeath) return; - if (RomuloDead) { if (ResurrectTimer < diff) @@ -1332,25 +1082,21 @@ void boss_julianneAI::UpdateAI(const uint32 diff) } }else ResurrectTimer -= diff; } - if (BlindingPassionTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_BLINDING_PASSION); BlindingPassionTimer = 30000 + rand()%15000; }else BlindingPassionTimer -= diff; - if (DevotionTimer < diff) { DoCast(m_creature, SPELL_DEVOTION); DevotionTimer = 15000 + rand()%30000; }else DevotionTimer -= diff; - if (PowerfulAttractionTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_POWERFUL_ATTRACTION); PowerfulAttractionTimer = 5000 + rand()%25000; }else PowerfulAttractionTimer -= diff; - if (EternalAffectionTimer < diff) { if (rand()%2 == 1 && SummonedRomulo) @@ -1359,18 +1105,14 @@ void boss_julianneAI::UpdateAI(const uint32 diff) if (Romulo && Romulo->isAlive() && !RomuloDead) DoCast(Romulo, SPELL_ETERNAL_AFFECTION); }else DoCast(m_creature, SPELL_ETERNAL_AFFECTION); - EternalAffectionTimer = 45000 + rand()%15000; }else EternalAffectionTimer -= diff; - DoMeleeAttackIfReady(); } - void boss_romuloAI::UpdateAI(const uint32 diff) { if (!UpdateVictim() || IsFakingDeath) return; - if (JulianneDead) { if (ResurrectTimer < diff) @@ -1386,7 +1128,6 @@ void boss_romuloAI::UpdateAI(const uint32 diff) } }else ResurrectTimer -= diff; } - if (BackwardLungeTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); @@ -1396,96 +1137,78 @@ void boss_romuloAI::UpdateAI(const uint32 diff) BackwardLungeTimer = 15000 + rand()%15000; } }else BackwardLungeTimer -= diff; - if (DaringTimer < diff) { DoCast(m_creature, SPELL_DARING); DaringTimer = 20000 + rand()%20000; }else DaringTimer -= diff; - if (DeadlySwatheTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEADLY_SWATHE); DeadlySwatheTimer = 15000 + rand()%10000; }else DeadlySwatheTimer -= diff; - if (PoisonThrustTimer < diff) { DoCast(m_creature->getVictim(), SPELL_POISON_THRUST); PoisonThrustTimer = 10000 + rand()%10000; }else PoisonThrustTimer -= diff; - DoMeleeAttackIfReady(); } - CreatureAI* GetAI_boss_julianne(Creature* pCreature) { return new boss_julianneAI(pCreature); } - CreatureAI* GetAI_boss_romulo(Creature* pCreature) { return new boss_romuloAI(pCreature); } - void AddSC_bosses_opera() { Script* newscript; - // Oz newscript = new Script; newscript->GetAI = &GetAI_boss_dorothee; newscript->Name = "boss_dorothee"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_strawman; newscript->Name = "boss_strawman"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_tinhead; newscript->Name = "boss_tinhead"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_roar; newscript->Name = "boss_roar"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_crone; newscript->Name = "boss_crone"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_tito; newscript->Name = "mob_tito"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_cyclone; newscript->Name = "mob_cyclone"; newscript->RegisterSelf(); - // Hood newscript = new Script; newscript->pGossipHello = &GossipHello_npc_grandmother; newscript->pGossipSelect = &GossipSelect_npc_grandmother; newscript->Name = "npc_grandmother"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_bigbadwolf; newscript->Name = "boss_bigbadwolf"; newscript->RegisterSelf(); - // Romeo And Juliet newscript = new Script; newscript->GetAI = &GetAI_boss_julianne; newscript->Name = "boss_julianne"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_romulo; newscript->Name = "boss_romulo"; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/def_karazhan.h b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/def_karazhan.h index 1c4c1f37eb0..b79aef32226 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/def_karazhan.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/def_karazhan.h @@ -2,10 +2,8 @@ * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_KARAZHAN_H #define DEF_KARAZHAN_H - enum eEnums { TYPE_ATTUMEN = 1, @@ -20,10 +18,8 @@ enum eEnums TYPE_CHESS = 10, TYPE_MALCHEZZAR = 11, TYPE_NIGHTBANE = 12, - DATA_OPERA_PERFORMANCE = 13, DATA_OPERA_OZ_DEATHCOUNT = 14, - DATA_KILREK = 15, DATA_TERESTIAN = 16, DATA_MOROES = 17, @@ -35,20 +31,17 @@ enum eEnums DATA_GO_NETHER_DOOR = 23, DATA_GO_GAME_DOOR = 24, DATA_GO_GAME_EXIT_DOOR = 25, - DATA_IMAGE_OF_MEDIVH = 26, DATA_MASTERS_TERRACE_DOOR_1 = 27, DATA_MASTERS_TERRACE_DOOR_2 = 28, DATA_GO_SIDE_ENTRANCE_DOOR = 29 }; - enum OperaEvents { EVENT_OZ = 1, EVENT_HOOD = 2, EVENT_RAJ = 3 }; - #define ERROR_INST_DATA(a) error_log("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry()); #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp index 2ee3f3958cf..0d8a7cdb251 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Karazhan SD%Complete: 70 SDComment: Instance Script for Karazhan to help in various encounters. TODO: GameObject visibility for Opera event. SDCategory: Karazhan EndScriptData */ - #include "precompiled.h" #include "def_karazhan.h" - #define MAX_ENCOUNTER 12 - /* 0 - Attumen + Midnight (optional) 1 - Moroes @@ -40,17 +36,13 @@ EndScriptData */ 10 - Prince Malchezzar 11 - Nightbane */ - struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance { instance_karazhan(Map* pMap) : ScriptedInstance(pMap) {Initialize();} - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string strSaveData; - uint32 m_uiOperaEvent; uint32 m_uiOzDeathCount; - uint64 m_uiCurtainGUID; uint64 m_uiStageDoorLeftGUID; uint64 m_uiStageDoorRightGUID; @@ -66,23 +58,18 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 MastersTerraceDoor[2]; uint64 ImageGUID; uint64 DustCoveredChest; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. m_uiOperaEvent = urand(1,3); m_uiOzDeathCount = 0; - m_uiCurtainGUID = 0; m_uiStageDoorLeftGUID = 0; m_uiStageDoorRightGUID = 0; - m_uiKilrekGUID = 0; m_uiTerestianGUID = 0; m_uiMoroesGUID = 0; - m_uiLibraryDoor = 0; m_uiMassiveDoor = 0; m_uiSideEntranceDoor = 0; @@ -94,16 +81,13 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance ImageGUID = 0; DustCoveredChest = 0; } - bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch (pCreature->GetEntry()) @@ -113,7 +97,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case 15687: m_uiMoroesGUID = pCreature->GetGUID(); break; } } - void SetData(uint32 type, uint32 uiData) { switch (type) @@ -149,23 +132,18 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance m_uiOzDeathCount = 0; break; } - if (uiData == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; - strSaveData = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - void SetData64(uint32 identifier, uint64 data) { switch(identifier) @@ -173,7 +151,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -205,26 +182,21 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance break; case 185119: DustCoveredChest = pGo->GetGUID(); break; } - switch(m_uiOperaEvent) { //TODO: Set Object visibilities for Opera based on performance case EVENT_OZ: break; - case EVENT_HOOD: break; - case EVENT_RAJ: break; } } - std::string GetSaveData() { return strSaveData; } - uint32 GetData(uint32 uiData) { switch (uiData) @@ -245,10 +217,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_OPERA_OZ_DEATHCOUNT: return m_uiOzDeathCount; case DATA_IMAGE_OF_MEDIVH: return ImageGUID; } - return 0; } - uint64 GetData64(uint32 uiData) { switch (uiData) @@ -268,10 +238,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; } - return 0; } - void Load(const char* chrIn) { if (!chrIn) @@ -279,25 +247,21 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(chrIn); std::istringstream loadStream(chrIn); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_karazhan(Map* pMap) { return new instance_karazhan(pMap); } - void AddSC_instance_karazhan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp index f392c50ca13..a315ca3287c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp @@ -13,49 +13,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Karazhan SD%Complete: 100 SDComment: Support for Barnes (Opera controller) and Berthold (Doorman), Support for Quest 9645. SDCategory: Karazhan EndScriptData */ - /* ContentData npc_barnes npc_berthold npc_image_of_medivh EndContentData */ - #include "precompiled.h" #include "def_karazhan.h" #include "escort_ai.h" - /*###### # npc_barnesAI ######*/ - #define GOSSIP_READY "I'm not an actor." - #define SAY_READY "Splendid, I'm going to get the audience ready. Break a leg!" #define SAY_OZ_INTRO1 "Finally, everything is in place. Are you ready for your big stage debut?" #define OZ_GOSSIP1 "I'm not an actor." #define SAY_OZ_INTRO2 "Don't worry, you'll be fine. You look like a natural!" #define OZ_GOSSIP2 "Ok, I'll give it a try, then." - #define SAY_RAJ_INTRO1 "The romantic plays are really tough, but you'll do better this time. You have TALENT. Ready?" #define RAJ_GOSSIP1 "I've never been more ready." - #define OZ_GM_GOSSIP1 "[GM] Change event to EVENT_OZ" #define OZ_GM_GOSSIP2 "[GM] Change event to EVENT_HOOD" #define OZ_GM_GOSSIP3 "[GM] Change event to EVENT_RAJ" - struct Dialogue { int32 textid; uint32 timer; }; - static Dialogue OzDialogue[]= { {-1532103, 6000}, @@ -63,7 +53,6 @@ static Dialogue OzDialogue[]= {-1532105, 9000}, {-1532106, 15000} }; - static Dialogue HoodDialogue[]= { {-1532107, 6000}, @@ -71,7 +60,6 @@ static Dialogue HoodDialogue[]= {-1532109, 14000}, {-1532110, 15000} }; - static Dialogue RAJDialogue[]= { {-1532111, 5000}, @@ -79,7 +67,6 @@ static Dialogue RAJDialogue[]= {-1532113, 14000}, {-1532114, 14000} }; - // Entries and spawn locations for creatures in Oz event float Spawns[6][2]= { @@ -90,16 +77,12 @@ float Spawns[6][2]= {17603, -10892}, // Grandmother {17534, -10900}, // Julianne }; - #define CREATURE_SPOTLIGHT 19525 - #define SPELL_SPOTLIGHT 25824 #define SPELL_TUXEDO 32616 - #define SPAWN_Z 90.5 #define SPAWN_Y -1758 #define SPAWN_O 4.738 - struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI { npc_barnesAI(Creature* c) : npc_escortAI(c) @@ -108,54 +91,39 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI m_uiEventId = 0; pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 m_uiSpotlightGUID; - uint32 TalkCount; uint32 TalkTimer; uint32 WipeTimer; uint32 m_uiEventId; - bool PerformanceReady; bool RaidWiped; - void Reset() { m_uiSpotlightGUID = 0; - TalkCount = 0; TalkTimer = 2000; WipeTimer = 5000; - PerformanceReady = false; - if (pInstance) m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE); } - void StartEvent() { if (!pInstance) return; - pInstance->SetData(TYPE_OPERA, IN_PROGRESS); - //resets count for this event, in case earlier failed if (m_uiEventId == EVENT_OZ) pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS); - Start(false, false); } - void EnterCombat(Unit* who) {} - void WaypointReached(uint32 i) { if (!pInstance) return; - switch(i) { case 0: @@ -165,7 +133,6 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI case 4: TalkCount = 0; SetEscortPaused(true); - if (Creature* pSpotlight = m_creature->SummonCreature(CREATURE_SPOTLIGHT, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000)) @@ -185,11 +152,9 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI break; } } - void Talk(uint32 count) { int32 text = 0; - switch(m_uiEventId) { case EVENT_OZ: @@ -198,14 +163,12 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI if (OzDialogue[count].timer) TalkTimer = OzDialogue[count].timer; break; - case EVENT_HOOD: if (HoodDialogue[count].textid) text = HoodDialogue[count].textid; if (HoodDialogue[count].timer) TalkTimer = HoodDialogue[count].timer; break; - case EVENT_RAJ: if (RAJDialogue[count].textid) text = RAJDialogue[count].textid; @@ -213,17 +176,14 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI TalkTimer = RAJDialogue[count].timer; break; } - if (text) DoScriptText(text, m_creature); } - void PrepareEncounter() { debug_log("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); uint8 index = 0; uint8 count = 0; - switch(m_uiEventId) { case EVENT_OZ: @@ -239,12 +199,10 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI count = index+1; break; } - - for(; index < count; ++index) + for (; index < count; ++index) { uint32 entry = ((uint32)Spawns[index][0]); float PosX = Spawns[index][1]; - if (Creature* pCreature = m_creature->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) { // In case database has bad flags @@ -252,14 +210,11 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } } - RaidWiped = false; } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (HasEscortState(STATE_ESCORT_PAUSED)) { if (TalkTimer < diff) @@ -268,18 +223,15 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI { if (Creature* pSpotlight = Unit::GetCreature(*m_creature, m_uiSpotlightGUID)) pSpotlight->ForcedDespawn(); - SetEscortPaused(false); return; } - Talk(TalkCount); ++TalkCount; } else TalkTimer -= diff; } - if (PerformanceReady) { if (!RaidWiped) @@ -288,13 +240,11 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI { Map* pMap = m_creature->GetMap(); if (!pMap->IsDungeon()) return; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); if (PlayerList.isEmpty()) return; - RaidWiped = true; - for(Map::PlayerList::const_iterator i = PlayerList.begin();i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive() && !i->getSource()->isGameMaster()) { @@ -302,27 +252,22 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI break; } } - if (RaidWiped) { RaidWiped = true; EnterEvadeMode(); return; } - WipeTimer = 15000; }else WipeTimer -= diff; } - } } }; - CreatureAI* GetAI_npc_barnesAI(Creature* pCreature) { return new npc_barnesAI(pCreature); } - bool GossipHello_npc_barnes(Player* pPlayer, Creature* pCreature) { if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) @@ -331,34 +276,28 @@ bool GossipHello_npc_barnes(Player* pPlayer, Creature* pCreature) if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->isGameMaster()) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); } - if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI,pCreature->AI())) { if (!pBarnesAI->RaidWiped) pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID()); else pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID()); - return true; } } } - pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_barnes(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI, pCreature->AI()); - switch(uiAction) { case GOSSIP_ACTION_INFO_DEF+1: @@ -385,21 +324,16 @@ bool GossipSelect_npc_barnes(Player* pPlayer, Creature* pCreature, uint32 uiSend outstring_log("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID()); break; } - return true; } - /*### # npc_berthold ####*/ - enum eBerthold { SPELL_TELEPORT = 39567 }; - #define GOSSIP_ITEM_TELEPORT "Teleport me to the Guardian's Library" - bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature) { if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) @@ -408,24 +342,19 @@ bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature) if (pInstance->GetData(TYPE_ARAN) == DONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_berthold(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true); - pPlayer->CLOSE_GOSSIP_MENU(); return true; } - /*### # npc_image_of_medivh ####*/ - #define SAY_DIALOG_MEDIVH_1 "You've got my attention, dragon. You'll find I'm not as easily scared as the villagers below." #define SAY_DIALOG_ARCANAGOS_2 "Your dabbling in the arcane has gone too far, Medivh. You've attracted the attention of powers beyond your understanding. You must leave Karazhan at once!" #define SAY_DIALOG_MEDIVH_3 "You dare challenge me at my own dwelling? Your arrogance is astounding, even for a dragon!" @@ -435,38 +364,29 @@ bool GossipSelect_npc_berthold(Player* pPlayer, Creature* pCreature, uint32 uiSe #define EMOTE_DIALOG_MEDIVH_7 "begins to cast a spell of great power, weaving his own essence into the magic." #define SAY_DIALOG_ARCANAGOS_8 "What have you done, wizard? This cannot be! I'm burning from... within!" #define SAY_DIALOG_MEDIVH_9 "He should not have angered me. I must go... recover my strength now..." - #define MOB_ARCANAGOS 17652 #define SPELL_FIRE_BALL 30967 #define SPELL_UBER_FIREBALL 30971 #define SPELL_CONFLAGRATION_BLAST 30977 #define SPELL_MANA_SHIELD 31635 - static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94}; static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83}; - struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI { npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint64 ArcanagosGUID; - uint32 YellTimer; uint32 Step; uint32 FireMedivhTimer; uint32 FireArcanagosTimer; - bool EventStarted; - void Reset() { ArcanagosGUID = 0; - if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) { pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, m_creature->GetGUID()); @@ -479,7 +399,6 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI } } void EnterCombat(Unit* who){} - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) @@ -491,7 +410,6 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI m_creature->SetOrientation(MedivPos[3]); } } - void StartEvent() { Step = 1; @@ -507,7 +425,6 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI YellTimer = 10000; } - uint32 NextStep(uint32 Step) { Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID); @@ -566,7 +483,6 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI case 14: m_creature->SetVisibility(VISIBILITY_OFF); m_creature->ClearInCombat(); - if (pMap->IsDungeon()) { InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers(); @@ -585,12 +501,9 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI return 5000; default : return 9999999; } - } - void UpdateAI(const uint32 diff) { - if (YellTimer < diff) { if (EventStarted) @@ -598,51 +511,42 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI YellTimer = NextStep(Step++); } }else YellTimer -= diff; - if (Step >= 7 && Step <= 12) { Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID); - if (FireArcanagosTimer < diff) { if (arca) arca->CastSpell(m_creature, SPELL_FIRE_BALL, false); FireArcanagosTimer = 6000; }else FireArcanagosTimer -= diff; - if (FireMedivhTimer < diff) { if (arca) DoCast(arca, SPELL_FIRE_BALL); FireMedivhTimer = 5000; }else FireMedivhTimer -= diff; - } } }; - CreatureAI* GetAI_npc_image_of_medivh(Creature* pCreature) { return new npc_image_of_medivhAI(pCreature); } - void AddSC_karazhan() { Script* newscript; - newscript = new Script; newscript->GetAI = &GetAI_npc_barnesAI; newscript->Name = "npc_barnes"; newscript->pGossipHello = &GossipHello_npc_barnes; newscript->pGossipSelect = &GossipSelect_npc_barnes; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_berthold"; newscript->pGossipHello = &GossipHello_npc_berthold; newscript->pGossipSelect = &GossipSelect_npc_berthold; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_image_of_medivh"; newscript->GetAI = &GetAI_npc_image_of_medivh; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp index 80e1d3ffceb..c379a6ab590 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp @@ -13,46 +13,35 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Loch_Modan SD%Complete: 100 SDComment: Quest support: 3181 SDCategory: Loch Modan EndScriptData */ - /* ContentData npc_mountaineer_pebblebitty EndContentData */ - #include "precompiled.h" - /*###### ## npc_mountaineer_pebblebitty ######*/ - #define GOSSIP_MP "Open the gate please, i need to get to Searing Gorge" - #define GOSSIP_MP1 "But i need to get there, now open the gate!" #define GOSSIP_MP2 "Ok, so what is this other way?" #define GOSSIP_MP3 "Doesn't matter, i'm invulnerable." #define GOSSIP_MP4 "Yes..." #define GOSSIP_MP5 "Ok, i'll try to remember that." #define GOSSIP_MP6 "A key? Ok!" - bool GossipHello_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (!pPlayer->GetQuestRewardStatus(3181) == 1) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -87,11 +76,9 @@ bool GossipSelect_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreatu } return true; } - void AddSC_loch_modan() { Script *newscript; - newscript = new Script; newscript->Name = "npc_mountaineer_pebblebitty"; newscript->pGossipHello = &GossipHello_npc_mountaineer_pebblebitty; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp index 3fc8e2dc4d1..721dd8f2fc5 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Felblood_Kaelthas SD%Complete: 80 SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially follow targets. SDCategory: Magisters' Terrace EndScriptData */ - #include "precompiled.h" #include "def_magisters_terrace.h" #include "WorldPacket.h" - #define SAY_AGGRO -1585023 //This yell should be done when the room is cleared. For now, set it as a movelineofsight yell. #define SAY_PHOENIX -1585024 #define SAY_FLAMESTRIKE -1585025 @@ -32,25 +29,19 @@ EndScriptData */ #define SAY_TIRED -1585027 #define SAY_RECAST_GRAVITY -1585028 #define SAY_DEATH -1585029 - /*** Spells ***/ - // Phase 1 spells #define SPELL_FIREBALL_NORMAL 44189 // Deals 2700-3300 damage at current target #define SPELL_FIREBALL_HEROIC 46164 // 4950-6050 - #define SPELL_PHOENIX 44194 // Summons a phoenix (Doesn't work?) #define SPELL_PHOENIX_BURN 44197 // A spell Phoenix uses to damage everything around #define SPELL_REBIRTH_DMG 44196 // DMG if a Phoenix rebirth happen - #define SPELL_FLAMESTRIKE1_NORMAL 44190 // Damage part #define SPELL_FLAMESTRIKE1_HEROIC 46163 // Heroic damage part #define SPELL_FLAMESTRIKE2 44191 // Flamestrike indicator before the damage #define SPELL_FLAMESTRIKE3 44192 // Summons the trigger + animation (projectile) - #define SPELL_SHOCK_BARRIER 46165 // Heroic only; 10k damage shield, followed by Pyroblast #define SPELL_PYROBLAST 36819 // Heroic only; 45-55k fire damage - // Phase 2 spells #define SPELL_GRAVITY_LAPSE_INITIAL 44224 // Cast at the beginning of every Gravity Lapse #define SPELL_GRAVITY_LAPSE_CHANNEL 44251 // Channeled; blue beam animation to every enemy in range @@ -59,12 +50,10 @@ EndScriptData */ #define SPELL_GRAVITY_LAPSE_DOT 44226 // Knocks up in the air and applies a 300 DPS DoT. #define SPELL_ARCANE_SPHERE_PASSIVE 44263 // Passive auras on Arcane Spheres #define SPELL_POWER_FEEDBACK 44233 // Stuns him, making him take 50% more damage for 10 seconds. Cast after Gravity Lapse - /*** Creatures ***/ #define CREATURE_PHOENIX 24674 #define CREATURE_PHOENIX_EGG 24675 #define CREATURE_ARCANE_SPHERE 24708 - /** Locations **/ float KaelLocations[3][2]= { @@ -72,9 +61,7 @@ float KaelLocations[3][2]= {140.823883, 195.403046}, {156.574188, 195.650482}, }; - #define LOCATION_Z -16.727455 - struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) @@ -82,17 +69,13 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI pInstance = c->GetInstanceData(); Heroic = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; - uint32 FireballTimer; uint32 PhoenixTimer; uint32 FlameStrikeTimer; uint32 CombatPulseTimer; - //Heroic only uint32 PyroblastTimer; - uint32 GravityLapseTimer; uint32 GravityLapsePhase; // 0 = No Gravity Lapse @@ -100,16 +83,13 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI // 2 = Teleported people to self // 3 = Knocked people up in the air // 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs. - bool FirstGravityLapse; bool Heroic; bool HasTaunted; - uint8 Phase; // 0 = Not started // 1 = Fireball; Summon Phoenix; Flamestrike // 2 = Gravity Lapses - void Reset() { // TODO: Timers @@ -117,17 +97,12 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI PhoenixTimer = 10000; FlameStrikeTimer = 25000; CombatPulseTimer = 0; - PyroblastTimer = 60000; - GravityLapseTimer = 0; GravityLapsePhase = 0; - FirstGravityLapse = true; HasTaunted = false; - Phase = 0; - if (pInstance) { pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); @@ -136,33 +111,26 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI // Small door opened after event are expected to be closed by default } } - void JustDied(Unit *killer) { DoScriptText(SAY_DEATH, m_creature); - if (!pInstance) return; - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); // Open the encounter door } - void DamageTaken(Unit* done_by, uint32 &damage) { if (damage > m_creature->GetHealth()) RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. } - void EnterCombat(Unit *who) { if (!pInstance) return; - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false); //Close the encounter door, open it in JustDied/Reset } - void MoveInLineOfSight(Unit *who) { if (!HasTaunted && m_creature->IsWithinDistInMap(who, 40.0)) @@ -170,18 +138,15 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI DoScriptText(SAY_AGGRO, m_creature); HasTaunted = true; } - ScriptedAI::MoveInLineOfSight(who); } - void SetThreatList(Creature* SummonedUnit) { if (!SummonedUnit) return; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); - for(i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); if (pUnit && pUnit->isAlive()) @@ -191,7 +156,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } } } - void TeleportPlayersToSelf() { float x = KaelLocations[0][0]; @@ -207,7 +171,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } DoCast(m_creature, SPELL_TELEPORT_CENTER, true); } - void CastGravityLapseKnockUp() { std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); @@ -219,7 +182,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, m_creature->GetGUID()); } } - void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... { std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); @@ -239,7 +201,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } } } - void RemoveGravityLapse() { std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); @@ -250,7 +211,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - WorldPacket data(12); data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); data.append(pUnit->GetPackGUID()); @@ -259,13 +219,11 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - switch(Phase) { case 0: @@ -282,22 +240,17 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI PyroblastTimer = 60000; }else PyroblastTimer -= diff; } - if (FireballTimer < diff) { DoCast(m_creature->getVictim(), Heroic ? SPELL_FIREBALL_HEROIC : SPELL_FIREBALL_NORMAL); FireballTimer = 2000 + rand()%4000; }else FireballTimer -= diff; - if (PhoenixTimer < diff) { - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1); - uint32 random = rand()%2 + 1; float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; - Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if (Phoenix) { @@ -305,12 +258,9 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI SetThreatList(Phoenix); Phoenix->AI()->AttackStart(target); } - DoScriptText(SAY_PHOENIX, m_creature); - PhoenixTimer = 60000; }else PhoenixTimer -= diff; - if (FlameStrikeTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -322,7 +272,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } FlameStrikeTimer = 15000 + rand()%10000; }else FlameStrikeTimer -= diff; - // Below 50% if (m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth()) { @@ -334,11 +283,9 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI GravityLapsePhase = 0; Phase = 1; } - DoMeleeAttackIfReady(); } break; - case 1: { if (GravityLapseTimer < diff) @@ -350,7 +297,6 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { DoScriptText(SAY_GRAVITY_LAPSE, m_creature); FirstGravityLapse = false; - if (pInstance) { pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true); @@ -360,35 +306,29 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { DoScriptText(SAY_RECAST_GRAVITY, m_creature); } - DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; - case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; - case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; - case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; - - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Orb && target) { @@ -396,12 +336,9 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI Orb->AddThreat(target, 1.0f); Orb->AI()->AttackStart(target); } - } - DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL); break; - case 4: m_creature->InterruptNonMeleeSpells(false); DoScriptText(SAY_TIRED, m_creature); @@ -417,27 +354,21 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_felkael_flamestrikeAI : public ScriptedAI { mob_felkael_flamestrikeAI(Creature *c) : ScriptedAI(c) { Heroic = c->GetMap()->IsHeroic(); } - uint32 FlameStrikeTimer; bool Heroic; - void Reset() { FlameStrikeTimer = 5000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(14); - DoCast(m_creature, SPELL_FLAMESTRIKE2, true); } - void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} void UpdateAI(const uint32 diff) @@ -449,20 +380,17 @@ struct TRINITY_DLL_DECL mob_felkael_flamestrikeAI : public ScriptedAI } else FlameStrikeTimer -= diff; } }; - struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI { mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; uint32 BurnTimer; uint32 Death_Timer; bool Rebirth; bool FakeDeath; - void Reset() { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); @@ -473,20 +401,16 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI Rebirth = false; FakeDeath = false; } - void EnterCombat(Unit* who) {} - void DamageTaken(Unit* pKiller, uint32 &damage) { if (damage < m_creature->GetHealth()) return; - //Prevent glitch if in fake death if (FakeDeath) { damage = 0; return; - } //Don't really die in all phases of Kael'Thas if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0) @@ -494,7 +418,6 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI //prevent death damage = 0; FakeDeath = true; - m_creature->InterruptNonMeleeSpells(false); m_creature->SetHealth(0); m_creature->StopMoving(); @@ -508,19 +431,14 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); - } - } - void JustDied(Unit* slayer) { m_creature->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } - void UpdateAI(const uint32 diff) { - //If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg. if (FakeDeath) { @@ -529,10 +447,8 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI DoCast(m_creature, SPELL_REBIRTH_DMG); Rebirth = true; } - if (Rebirth) { - if (Death_Timer < diff) { m_creature->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); @@ -542,12 +458,9 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI }else Death_Timer -= diff; } - } - if (!UpdateVictim()) return; - if (BurnTimer < diff) { //spell Burn should possible do this, but it doesn't, so do this for now. @@ -555,26 +468,19 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI m_creature->DealDamage(m_creature, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false); BurnTimer += 2000; } BurnTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public ScriptedAI { mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {} - uint32 HatchTimer; - void Reset() { HatchTimer = 10000; - } - void EnterCombat(Unit* who) {} void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (HatchTimer < diff) @@ -582,40 +488,31 @@ struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public ScriptedAI m_creature->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); m_creature->Kill(m_creature); } else HatchTimer -= diff; - } }; - struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI { mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 DespawnTimer; uint32 ChangeTargetTimer; - void Reset() { DespawnTimer = 30000; ChangeTargetTimer = urand(6000,12000); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->setFaction(14); DoCast(m_creature, SPELL_ARCANE_SPHERE_PASSIVE, true); } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { if (DespawnTimer < diff) m_creature->Kill(m_creature); else DespawnTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - if (ChangeTargetTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -624,61 +521,49 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI m_creature->TauntApply(target); AttackStart(target); } - ChangeTargetTimer = urand(5000,15000); } else ChangeTargetTimer -= diff; } }; - CreatureAI* GetAI_boss_felblood_kaelthas(Creature* c) { return new boss_felblood_kaelthasAI(c); } - CreatureAI* GetAI_mob_arcane_sphere(Creature* c) { return new mob_arcane_sphereAI(c); } - CreatureAI* GetAI_mob_felkael_phoenix(Creature* c) { return new mob_felkael_phoenixAI(c); } - CreatureAI* GetAI_mob_felkael_phoenix_egg(Creature* c) { return new mob_felkael_phoenix_eggAI(c); } - CreatureAI* GetAI_mob_felkael_flamestrike(Creature* c) { return new mob_felkael_flamestrikeAI(c); } - void AddSC_boss_felblood_kaelthas() { Script *newscript; - newscript = new Script; newscript->Name = "boss_felblood_kaelthas"; newscript->GetAI = &GetAI_boss_felblood_kaelthas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_arcane_sphere"; newscript->GetAI = &GetAI_mob_arcane_sphere; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_felkael_phoenix"; newscript->GetAI = &GetAI_mob_felkael_phoenix; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_felkael_phoenix_egg"; newscript->GetAI = &GetAI_mob_felkael_phoenix_egg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_felkael_flamestrike"; newscript->GetAI = &GetAI_mob_felkael_flamestrike; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp index 546f42cae19..ebf73da0f63 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Priestess_Delrissa SD%Complete: 65 SDComment: No Heroic support yet. Needs further testing. Several scripts for pets disabled, not seem to require any special script. SDCategory: Magister's Terrace EndScriptData */ - #include "precompiled.h" #include "def_magisters_terrace.h" - struct Speech { int32 id; }; - static Speech LackeyDeath[]= { {-1585013}, @@ -36,7 +32,6 @@ static Speech LackeyDeath[]= {-1585015}, {-1585016}, }; - static Speech PlayerDeath[]= { {-1585017}, @@ -45,12 +40,10 @@ static Speech PlayerDeath[]= {-1585020}, {-1585021}, }; - enum eEnums { SAY_AGGRO = -1585012, SAY_DEATH = -1585022, - SPELL_DISPEL_MAGIC = 27609, SPELL_FLASH_HEAL = 17843, SPELL_SW_PAIN_NORMAL = 14032, @@ -58,13 +51,10 @@ enum eEnums SPELL_SHIELD = 44291, SPELL_RENEW_NORMAL = 44174, SPELL_RENEW_HEROIC = 46192, - MAX_ACTIVE_LACKEY = 4 }; - const float fOrientation = 4.98; const float fZLocation = -19.921; - float LackeyLocations[4][2]= { {123.77, 17.6007}, @@ -72,7 +62,6 @@ float LackeyLocations[4][2]= {121.563, 15.6213}, {129.988, 17.2355}, }; - const uint32 m_auiAddEntries[] = { 24557, //Kagani Nightstrike @@ -84,7 +73,6 @@ const uint32 m_auiAddEntries[] = 24553, //Apoko 24556, //Zelfan }; - struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI { boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) @@ -94,48 +82,38 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); LackeyEntryList.clear(); } - ScriptedInstance* pInstance; bool Heroic; - std::vector LackeyEntryList; uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; - uint8 PlayersKilled; - uint32 HealTimer; uint32 RenewTimer; uint32 ShieldTimer; uint32 SWPainTimer; uint32 DispelTimer; uint32 ResetTimer; - void Reset() { PlayersKilled = 0; - HealTimer = 15000; RenewTimer = 10000; ShieldTimer = 2000; SWPainTimer = 5000; DispelTimer = 7500; ResetTimer = 5000; - InitializeLackeys(); } - //this mean she at some point evaded void JustReachedHome() { if (pInstance) pInstance->SetData(DATA_DELRISSA_EVENT, FAIL); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - - for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[i])) { @@ -146,48 +124,39 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI } } } - if (pInstance) pInstance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); } - void InitializeLackeys() { //can be called if Creature are dead, so avoid if (!m_creature->isAlive()) return; - uint8 j = 0; - //it's empty, so first time if (LackeyEntryList.empty()) { //pre-allocate size for speed LackeyEntryList.resize((sizeof(m_auiAddEntries) / sizeof(uint32))); - //fill vector array with entries from Creature array - for(uint8 i = 0; i < LackeyEntryList.size(); ++i) + for (uint8 i = 0; i < LackeyEntryList.size(); ++i) LackeyEntryList[i] = m_auiAddEntries[i]; - //remove random entries while(LackeyEntryList.size() > MAX_ACTIVE_LACKEY) LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); - //summon all the remaining in vector - for(std::vector::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + for (std::vector::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) { if (Creature* pAdd = m_creature->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) m_auiLackeyGUID[j] = pAdd->GetGUID(); - ++j; } } else { - for(std::vector::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + for (std::vector::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) { Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[j]); - //object already removed, not exist if (!pAdd) { @@ -198,25 +167,19 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI } } } - void KilledUnit(Unit* victim) { if (victim->GetTypeId() != TYPEID_PLAYER) return; - DoScriptText(PlayerDeath[PlayersKilled].id, m_creature); - if (PlayersKilled < 4) ++PlayersKilled; } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (!pInstance) return; - if (pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY) pInstance->SetData(DATA_DELRISSA_EVENT, DONE); else @@ -225,12 +188,10 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ResetTimer < diff) { float x, y, z, o; @@ -242,12 +203,11 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI } ResetTimer = 5000; }else ResetTimer -= diff; - if (HealTimer < diff) { uint32 health = m_creature->GetHealth(); Unit* target = m_creature; - for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[i])) { @@ -255,15 +215,12 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI target = pAdd; } } - DoCast(target, SPELL_FLASH_HEAL); HealTimer = 15000; }else HealTimer -= diff; - if (RenewTimer < diff) { Unit* target = m_creature; - if (rand()%2 == 1) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) @@ -275,11 +232,9 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI DoCast(target,Heroic ? SPELL_RENEW_HEROIC : SPELL_RENEW_NORMAL); RenewTimer = 5000; }else RenewTimer -= diff; - if (ShieldTimer < diff) { Unit* target = m_creature; - if (rand()%2 == 1) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) @@ -288,22 +243,18 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI target = pAdd; } } - DoCast(target, SPELL_SHIELD); ShieldTimer = 7500; }else ShieldTimer -= diff; - if (DispelTimer < diff) { Unit* target = NULL; bool friendly = false; - if (rand()%2 == 1) target = SelectUnit(SELECT_TARGET_RANDOM, 0); else { friendly = true; - if (rand()%2 == 1) target = m_creature; else @@ -315,35 +266,27 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI } } } - if (target) DoCast(target, SPELL_DISPEL_MAGIC); - DispelTimer = 12000; }else DispelTimer -= diff; - if (SWPainTimer < diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, Heroic ? SPELL_SW_PAIN_HEROIC : SPELL_SW_PAIN_NORMAL); - SWPainTimer = 10000; }else SWPainTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_priestess_delrissa(Creature* pCreature) { return new boss_priestess_delrissaAI(pCreature); } - enum eHealingPotion { SPELL_HEALING_POTION = 15503 }; - //all 8 possible lackey use this common struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI { @@ -353,24 +296,18 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } - ScriptedInstance* pInstance; - uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; uint32 ResetThreatTimer; - bool UsedPotion; - void Reset() { UsedPotion = false; - // These guys does not follow normal threat system rules // For later development, some alternative threat system should be made // We do not know what this system is based upon, but one theory is class (healers=high threat, dps=medium, etc) // We reset their threat frequently as an alternative until such a system exist ResetThreatTimer = 5000 + rand()%15000; - // in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her) if (Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_DELRISSA) : 0)) { @@ -378,15 +315,13 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI pDelrissa->Respawn(); } } - void EnterCombat(Unit* pWho) { if (!pWho) return; - if (pInstance) { - for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUIDs[i])) { @@ -397,7 +332,6 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI } } } - if (Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA))) { if (pDelrissa->isAlive() && !pDelrissa->getVictim()) @@ -408,26 +342,19 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI } } } - void JustDied(Unit* killer) { if (!pInstance) return; - Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)); uint32 uiLackeyDeathCount = pInstance->GetData(DATA_DELRISSA_DEATH_COUNT); - if (!pDelrissa) return; - //should delrissa really yell if dead? DoScriptText(LackeyDeath[uiLackeyDeathCount].id, pDelrissa); - pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, SPECIAL); - //increase local var, since we now may have four dead ++uiLackeyDeathCount; - if (uiLackeyDeathCount == MAX_ACTIVE_LACKEY) { //time to make her lootable and complete event if she died before lackeys @@ -435,33 +362,27 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI { if (!pDelrissa->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) pDelrissa->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_DELRISSA_EVENT, DONE); } } } - void KilledUnit(Unit* victim) { if (!pInstance) return; - if (Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)))) Delrissa->AI()->KilledUnit(victim); } - void AcquireGUIDs() { if (!pInstance) return; - if (Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)))) { - for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; } } - void UpdateAI(const uint32 diff) { if (!UsedPotion && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)) @@ -469,7 +390,6 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI DoCast(m_creature, SPELL_HEALING_POTION); UsedPotion = true; } - if (ResetThreatTimer < diff) { DoResetThreat(); @@ -477,7 +397,6 @@ struct TRINITY_DLL_DECL boss_priestess_lackey_commonAI : public ScriptedAI }else ResetThreatTimer -= diff; } }; - enum eRogueSpells { SPELL_KIDNEY_SHOT = 27615, @@ -487,19 +406,16 @@ enum eRogueSpells SPELL_BACKSTAB = 15657, SPELL_EVISCERATE = 27611 }; - struct TRINITY_DLL_DECL boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { //Rogue boss_kagani_nightstrikeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Gouge_Timer; uint32 Kick_Timer; uint32 Vanish_Timer; uint32 Eviscerate_Timer; uint32 Wait_Timer; bool InVanish; - void Reset() { Gouge_Timer = 5500; @@ -509,33 +425,24 @@ struct TRINITY_DLL_DECL boss_kagani_nightstrikeAI : public boss_priestess_lackey Wait_Timer = 5000; InVanish = false; m_creature->SetVisibility(VISIBILITY_ON); - boss_priestess_lackey_commonAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Vanish_Timer < diff) { DoCast(m_creature, SPELL_VANISH); - Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0); - DoResetThreat(); - if (pUnit) m_creature->AddThreat(pUnit, 1000.0f); - InVanish = true; Vanish_Timer = 30000; Wait_Timer = 10000; }else Vanish_Timer -= diff; - if (InVanish) { if (Wait_Timer < diff) @@ -546,35 +453,29 @@ struct TRINITY_DLL_DECL boss_kagani_nightstrikeAI : public boss_priestess_lackey InVanish = false; }else Wait_Timer -= diff; } - if (Gouge_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_GOUGE); Gouge_Timer = 5500; }else Gouge_Timer -= diff; - if (Kick_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_KICK); Kick_Timer = 7000; }else Kick_Timer -= diff; - if (Eviscerate_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_EVISCERATE); Eviscerate_Timer = 4000; }else Eviscerate_Timer -= diff; - if (!InVanish) DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_kagani_nightstrike(Creature* pCreature) { return new boss_kagani_nightstrikeAI(pCreature); } - enum eWarlockSpells { SPELL_IMMOLATE = 44267, @@ -585,18 +486,15 @@ enum eWarlockSpells SPELL_IMP_FIREBALL = 44164, SPELL_SUMMON_IMP = 44163 }; - struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { //Warlock boss_ellris_duskhallowAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Immolate_Timer; uint32 Shadow_Bolt_Timer; uint32 Seed_of_Corruption_Timer; uint32 Curse_of_Agony_Timer; uint32 Fear_Timer; - void Reset() { Immolate_Timer = 6000; @@ -604,117 +502,91 @@ struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_lackey_ Seed_of_Corruption_Timer = 2000; Curse_of_Agony_Timer = 1000; Fear_Timer = 10000; - boss_priestess_lackey_commonAI::Reset(); } - void Aggro(Unit* pWho) { DoCast(m_creature,SPELL_SUMMON_IMP); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Immolate_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_IMMOLATE); Immolate_Timer = 6000; }else Immolate_Timer -= diff; - if (Shadow_Bolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOW_BOLT); Shadow_Bolt_Timer = 5000; }else Shadow_Bolt_Timer -= diff; - if (Seed_of_Corruption_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); - Seed_of_Corruption_Timer = 10000; }else Seed_of_Corruption_Timer -= diff; - if (Curse_of_Agony_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_CURSE_OF_AGONY); - Curse_of_Agony_Timer = 13000; }else Curse_of_Agony_Timer -= diff; - if (Fear_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_FEAR); - Fear_Timer = 10000; }else Fear_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_ellris_duskhallow(Creature* pCreature) { return new boss_ellris_duskhallowAI(pCreature); } - enum eKickDown { SPELL_KNOCKDOWN = 11428, SPELL_SNAP_KICK = 46182 }; - struct TRINITY_DLL_DECL boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { //Monk boss_eramas_brightblazeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Knockdown_Timer; uint32 Snap_Kick_Timer; - void Reset() { Knockdown_Timer = 6000; Snap_Kick_Timer = 4500; - boss_priestess_lackey_commonAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Knockdown_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN); Knockdown_Timer = 6000; }else Knockdown_Timer -= diff; - if (Snap_Kick_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SNAP_KICK); Snap_Kick_Timer = 4500; }else Snap_Kick_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_eramas_brightblaze(Creature* pCreature) { return new boss_eramas_brightblazeAI(pCreature); } - enum eMageSpells { SPELL_POLYMORPH = 13323, @@ -725,14 +597,11 @@ enum eMageSpells SPELL_FROSTBOLT = 15043, SPELL_BLINK = 14514 }; - struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_lackey_commonAI { //Mage boss_yazzaiAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - bool HasIceBlocked; - uint32 Polymorph_Timer; uint32 Ice_Block_Timer; uint32 Wait_Timer; @@ -741,11 +610,9 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_lackey_commonAI uint32 Cone_of_Cold_Timer; uint32 Frostbolt_Timer; uint32 Blink_Timer; - void Reset() { HasIceBlocked = false; - Polymorph_Timer = 1000; Ice_Block_Timer = 20000; Wait_Timer = 10000; @@ -754,17 +621,13 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_lackey_commonAI Cone_of_Cold_Timer = 10000; Frostbolt_Timer = 3000; Blink_Timer = 8000; - boss_priestess_lackey_commonAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Polymorph_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -773,44 +636,37 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_lackey_commonAI Polymorph_Timer = 20000; } }else Polymorph_Timer -= diff; - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 35) && !HasIceBlocked) { DoCast(m_creature, SPELL_ICE_BLOCK); HasIceBlocked = true; } - if (Blizzard_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_BLIZZARD); - Blizzard_Timer = 8000; }else Blizzard_Timer -= diff; - if (Ice_Lance_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ICE_LANCE); Ice_Lance_Timer = 12000; }else Ice_Lance_Timer -= diff; - if (Cone_of_Cold_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CONE_OF_COLD); Cone_of_Cold_Timer = 10000; }else Cone_of_Cold_Timer -= diff; - if (Frostbolt_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FROSTBOLT); Frostbolt_Timer = 8000; }else Frostbolt_Timer -= diff; - if (Blink_Timer < diff) { bool InMeleeRange = false; std::list& t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { @@ -822,23 +678,18 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_lackey_commonAI } } } - //if anybody is in melee range than escape by blink if (InMeleeRange) DoCast(m_creature, SPELL_BLINK); - Blink_Timer = 8000; }else Blink_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_yazzai(Creature* pCreature) { return new boss_yazzaiAI(pCreature); } - enum eWarriorSpells { SPELL_INTERCEPT_STUN = 27577, @@ -849,19 +700,16 @@ enum eWarriorSpells SPELL_BATTLE_SHOUT = 27578, SPELL_MORTAL_STRIKE = 44268 }; - struct TRINITY_DLL_DECL boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { //Warrior boss_warlord_salarisAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Intercept_Stun_Timer; uint32 Disarm_Timer; uint32 Piercing_Howl_Timer; uint32 Frightening_Shout_Timer; uint32 Hamstring_Timer; uint32 Mortal_Strike_Timer; - void Reset() { Intercept_Stun_Timer = 500; @@ -870,27 +718,22 @@ struct TRINITY_DLL_DECL boss_warlord_salarisAI : public boss_priestess_lackey_co Frightening_Shout_Timer = 18000; Hamstring_Timer = 4500; Mortal_Strike_Timer = 8000; - boss_priestess_lackey_commonAI::Reset(); } - void EnterCombat(Unit* who) { DoCast(m_creature, SPELL_BATTLE_SHOUT); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Intercept_Stun_Timer < diff) { bool InMeleeRange = false; std::list& t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { @@ -902,56 +745,46 @@ struct TRINITY_DLL_DECL boss_warlord_salarisAI : public boss_priestess_lackey_co } } } - //if nobody is in melee range than try to use Intercept if (!InMeleeRange) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_INTERCEPT_STUN); } - Intercept_Stun_Timer = 10000; }else Intercept_Stun_Timer -= diff; - if (Disarm_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DISARM); Disarm_Timer = 6000; }else Disarm_Timer -= diff; - if (Hamstring_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_HAMSTRING); Hamstring_Timer = 4500; }else Hamstring_Timer -= diff; - if (Mortal_Strike_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE); Mortal_Strike_Timer = 4500; }else Mortal_Strike_Timer -= diff; - if (Piercing_Howl_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_PIERCING_HOWL); Piercing_Howl_Timer = 10000; }else Piercing_Howl_Timer -= diff; - if (Frightening_Shout_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FRIGHTENING_SHOUT); Frightening_Shout_Timer = 18000; }else Frightening_Shout_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_warlord_salaris(Creature* pCreature) { return new boss_warlord_salarisAI(pCreature); } - enum eHunterSpells { SPELL_AIMED_SHOT = 44271, @@ -960,24 +793,19 @@ enum eHunterSpells SPELL_MULTI_SHOT = 31942, SPELL_WING_CLIP = 44286, SPELL_FREEZING_TRAP = 44136, - NPC_SLIVER = 24552 }; - struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI { //Hunter boss_garaxxasAI(Creature *c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } - uint64 m_uiPetGUID; - uint32 Aimed_Shot_Timer; uint32 Shoot_Timer; uint32 Concussive_Shot_Timer; uint32 Multi_Shot_Timer; uint32 Wing_Clip_Timer; uint32 Freezing_Trap_Timer; - void Reset() { Aimed_Shot_Timer = 6000; @@ -986,26 +814,20 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI Multi_Shot_Timer = 10000; Wing_Clip_Timer = 4000; Freezing_Trap_Timer = 15000; - Unit* pPet = Unit::GetUnit(*m_creature,m_uiPetGUID); if (!pPet) m_creature->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - boss_priestess_lackey_commonAI::Reset(); } - void JustSummoned(Creature* pSummoned) { m_uiPetGUID = pSummoned->GetGUID(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { if (Wing_Clip_Timer < diff) @@ -1013,12 +835,10 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI DoCast(m_creature->getVictim(), SPELL_WING_CLIP); Wing_Clip_Timer = 4000; }else Wing_Clip_Timer -= diff; - if (Freezing_Trap_Timer < diff) { //attempt find go summoned from spell (casted by m_creature) GameObject* pGo = m_creature->GetGameObject(SPELL_FREEZING_TRAP); - //if we have a pGo, we need to wait (only one trap at a time) if (pGo) Freezing_Trap_Timer = 2500; @@ -1029,7 +849,6 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI Freezing_Trap_Timer = 15000; } }else Freezing_Trap_Timer -= diff; - DoMeleeAttackIfReady(); } else @@ -1039,19 +858,16 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI DoCast(m_creature->getVictim(), SPELL_CONCUSSIVE_SHOT); Concussive_Shot_Timer = 8000; }else Concussive_Shot_Timer -= diff; - if (Multi_Shot_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MULTI_SHOT); Multi_Shot_Timer = 10000; }else Multi_Shot_Timer -= diff; - if (Aimed_Shot_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_AIMED_SHOT); Aimed_Shot_Timer = 6000; }else Aimed_Shot_Timer -= diff; - if (Shoot_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SHOOT); @@ -1060,12 +876,10 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_lackey_commonAI } } }; - CreatureAI* GetAI_garaxxas(Creature* pCreature) { return new boss_garaxxasAI(pCreature); } - enum Spells { SPELL_WINDFURY_TOTEM = 27621, @@ -1076,19 +890,16 @@ enum Spells SPELL_FIRE_NOVA_TOTEM = 44257, SPELL_EARTHBIND_TOTEM = 15786 }; - struct TRINITY_DLL_DECL boss_apokoAI : public boss_priestess_lackey_commonAI { //Shaman boss_apokoAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Totem_Timer; uint8 Totem_Amount; uint32 War_Stomp_Timer; uint32 Purge_Timer; uint32 Healing_Wave_Timer; uint32 Frost_Shock_Timer; - void Reset() { Totem_Timer = 2000; @@ -1097,44 +908,35 @@ struct TRINITY_DLL_DECL boss_apokoAI : public boss_priestess_lackey_commonAI Purge_Timer = 8000; Healing_Wave_Timer = 5000; Frost_Shock_Timer = 7000; - boss_priestess_lackey_commonAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Totem_Timer < diff) { DoCast(m_creature, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM)); ++Totem_Amount; Totem_Timer = Totem_Amount*2000; } else Totem_Timer -= diff; - if (War_Stomp_Timer < diff) { DoCast(m_creature, SPELL_WAR_STOMP); War_Stomp_Timer = 10000; } else War_Stomp_Timer -= diff; - if (Purge_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_PURGE); - Purge_Timer = 15000; } else Purge_Timer -= diff; - if (Frost_Shock_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FROST_SHOCK); Frost_Shock_Timer = 7000; } else Frost_Shock_Timer -= diff; - if (Healing_Wave_Timer < diff) { // std::vector::iterator itr = Group.begin() + rand()%Group.size(); @@ -1149,16 +951,13 @@ struct TRINITY_DLL_DECL boss_apokoAI : public boss_priestess_lackey_commonAI // } // } } else Healing_Wave_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_apoko(Creature* pCreature) { return new boss_apokoAI(pCreature); } - enum eEngineerSpells { SPELL_GOBLIN_DRAGON_GUN = 44272, @@ -1168,18 +967,15 @@ enum eEngineerSpells SPELL_FEL_IRON_BOMB = 46024, SPELL_SHEEP_EXPLOSION = 44279 }; - struct TRINITY_DLL_DECL boss_zelfanAI : public boss_priestess_lackey_commonAI { //Engineer boss_zelfanAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - uint32 Goblin_Dragon_Gun_Timer; uint32 Rocket_Launch_Timer; uint32 Recombobulate_Timer; uint32 High_Explosive_Sheep_Timer; uint32 Fel_Iron_Bomb_Timer; - void Reset() { Goblin_Dragon_Gun_Timer = 20000; @@ -1187,38 +983,31 @@ struct TRINITY_DLL_DECL boss_zelfanAI : public boss_priestess_lackey_commonAI Recombobulate_Timer = 4000; High_Explosive_Sheep_Timer = 10000; Fel_Iron_Bomb_Timer = 15000; - boss_priestess_lackey_commonAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Goblin_Dragon_Gun_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN); Goblin_Dragon_Gun_Timer = 10000; }else Goblin_Dragon_Gun_Timer -= diff; - if (Rocket_Launch_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ROCKET_LAUNCH); Rocket_Launch_Timer = 9000; }else Rocket_Launch_Timer -= diff; - if (Fel_Iron_Bomb_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FEL_IRON_BOMB); Fel_Iron_Bomb_Timer = 15000; }else Fel_Iron_Bomb_Timer -= diff; - if (Recombobulate_Timer < diff) { - for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUIDs[i])) { @@ -1231,22 +1020,18 @@ struct TRINITY_DLL_DECL boss_zelfanAI : public boss_priestess_lackey_commonAI } Recombobulate_Timer = 2000; }else Recombobulate_Timer -= diff; - if (High_Explosive_Sheep_Timer < diff) { DoCast(m_creature, SPELL_HIGH_EXPLOSIVE_SHEEP); High_Explosive_Sheep_Timer = 65000; }else High_Explosive_Sheep_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_zelfan(Creature* pCreature) { return new boss_zelfanAI(pCreature); } - //struct TRINITY_DLL_DECL mob_high_explosive_sheepAI : public ScriptedAI //{ // mob_high_explosive_sheepAI(Creature *c) : ScriptedAI(c) {} @@ -1271,61 +1056,49 @@ CreatureAI* GetAI_zelfan(Creature* pCreature) // Explosion_Timer -= diff; // } //}; - //CreatureAI* GetAI_mob_high_explosive_sheep(Creature* pCreature) //{ // return new mob_high_explosive_sheepAI (pCreature); //}; - void AddSC_boss_priestess_delrissa() { Script *newscript; - newscript = new Script; newscript->Name = "boss_priestess_delrissa"; newscript->GetAI = &GetAI_boss_priestess_delrissa; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_kagani_nightstrike"; newscript->GetAI = &GetAI_boss_kagani_nightstrike; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_ellris_duskhallow"; newscript->GetAI = &GetAI_ellris_duskhallow; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_eramas_brightblaze"; newscript->GetAI = &GetAI_eramas_brightblaze; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_yazzai"; newscript->GetAI = &GetAI_yazzai; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_warlord_salaris"; newscript->GetAI = &GetAI_warlord_salaris; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_garaxxas"; newscript->GetAI = &GetAI_garaxxas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_apoko"; newscript->GetAI = &GetAI_apoko; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_zelfan"; newscript->GetAI = &GetAI_zelfan; newscript->RegisterSelf(); - /*newscript = new Script; newscript->Name = "mob_high_explosive_sheep"; newscript->GetAI = &GetAI_mob_high_explosive_sheep; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp index 080e2ad6f68..22e1ad968d0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Selin_Fireheart SD%Complete: 90 SDComment: Heroic and Normal Support. Needs further testing. SDCategory: Magister's Terrace EndScriptData */ - #include "precompiled.h" #include "def_magisters_terrace.h" - #define SAY_AGGRO -1585000 #define SAY_ENERGY -1585001 #define SAY_EMPOWERED -1585002 @@ -31,36 +28,29 @@ EndScriptData */ #define SAY_KILL_2 -1585004 #define SAY_DEATH -1585005 #define EMOTE_CRYSTAL -1585006 - //Crystal effect spells #define SPELL_FEL_CRYSTAL_COSMETIC 44374 #define SPELL_FEL_CRYSTAL_DUMMY 44329 #define SPELL_FEL_CRYSTAL_VISUAL 44355 #define SPELL_MANA_RAGE 44320 // This spell triggers 44321, which changes scale and regens mana Requires an entry in spell_script_target - //Selin's spells #define SPELL_DRAIN_LIFE 44294 #define SPELL_FEL_EXPLOSION 44314 - #define SPELL_DRAIN_MANA 46153 // Heroic only - #define CRYSTALS_NUMBER 5 #define DATA_CRYSTALS 6 - #define CREATURE_FEL_CRYSTAL 24722 - struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - Crystals.clear(); //GUIDs per instance is static, so we only need to load them once. if (pInstance) { uint32 size = pInstance->GetData(DATA_FEL_CRYSTAL_SIZE); - for(uint8 i = 0; i < size; ++i) + for (uint8 i = 0; i < size; ++i) { uint64 guid = pInstance->GetData64(DATA_FEL_CRYSTAL); debug_log("TSCR: Selin: Adding Fel Crystal %u to list", guid); @@ -69,29 +59,23 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI } Heroic = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool Heroic; - std::list Crystals; - uint32 DrainLifeTimer; uint32 DrainManaTimer; uint32 FelExplosionTimer; uint32 DrainCrystalTimer; uint32 EmpowerTimer; - bool IsDraining; bool DrainingCrystal; - uint64 CrystalGUID; // This will help us create a pointer to the crystal we are draining. We store GUIDs, never units in case unit is deleted/offline (offline if player of course). - void Reset() { if (pInstance) { - //for(uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for(std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { //Unit* pUnit = Unit::GetUnit(*m_creature, FelCrystals[i]); Unit* pUnit = Unit::GetUnit(*m_creature, *itr); @@ -99,42 +83,36 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { if (!pUnit->isAlive()) CAST_CRE(pUnit)->Respawn(); // Let MaNGOS handle setting death state, etc. - // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) // Small door opened after event are expected to be closed by default // Set Inst data for encounter pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); }else error_log(ERROR_INST_DATA); - DrainLifeTimer = 3000 + rand()%4000; DrainManaTimer = DrainLifeTimer + 5000; FelExplosionTimer = 2100; DrainCrystalTimer = 10000 + rand()%5000; DrainCrystalTimer = 20000 + rand()%5000; EmpowerTimer = 10000; - IsDraining = false; DrainingCrystal = false; CrystalGUID = 0; } - void SelectNearestCrystal() { if (Crystals.empty()) return; - float ShortestDistance = 0; CrystalGUID = 0; Unit* pCrystal = NULL; Unit* CrystalChosen = NULL; - //for(uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for(std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { pCrystal = NULL; //pCrystal = Unit::GetUnit(*m_creature, FelCrystals[i]); @@ -153,25 +131,20 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { DoScriptText(SAY_ENERGY, m_creature); DoScriptText(EMOTE_CRYSTAL, m_creature); - CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); - float x, y, z; // coords that we move to, close to the crystal. CrystalChosen->GetClosePoint(x, y, z, m_creature->GetObjectSize(), CONTACT_DISTANCE); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->GetMotionMaster()->MovePoint(1, x, y, z); DrainingCrystal = true; } } - void ShatterRemainingCrystals() { if (Crystals.empty()) return; - - //for(uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for(std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { //Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i])); Creature* pCrystal = Unit::GetCreature(*m_creature, *itr); @@ -179,21 +152,17 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI pCrystal->Kill(pCrystal); } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); //Close the encounter door, open it in JustDied/Reset } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void MovementInform(uint32 type, uint32 id) { if (type == POINT_MOTION_TYPE && id == 1) @@ -215,25 +184,20 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI } } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (!pInstance) return; - pInstance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in ShatterRemainingCrystals(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!DrainingCrystal) { uint32 maxPowerMana = m_creature->GetMaxPower(POWER_MANA); @@ -244,7 +208,6 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); DrainLifeTimer = 10000; } else DrainLifeTimer -= diff; - // Heroic only if (Heroic) { @@ -255,7 +218,6 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI } else DrainManaTimer -= diff; } } - if (FelExplosionTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -264,7 +226,6 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI FelExplosionTimer = 2000; } } else FelExplosionTimer -= diff; - // If below 10% mana, start recharging maxPowerMana = m_creature->GetMaxPower(POWER_MANA); if (maxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) @@ -276,7 +237,6 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI else DrainCrystalTimer = 20000 + rand()%5000; } else DrainCrystalTimer -= diff; } - }else { if (IsDraining) @@ -285,41 +245,32 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { IsDraining = false; DrainingCrystal = false; - DoScriptText(SAY_EMPOWERED, m_creature); - Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); if (CrystalChosen && CrystalChosen->isAlive()) // Use Deal Damage to kill it, not setDeathState. CrystalChosen->Kill(CrystalChosen); - CrystalGUID = 0; - m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } else EmpowerTimer -= diff; } } - DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. } }; - CreatureAI* GetAI_boss_selin_fireheart(Creature* pCreature) { return new boss_selin_fireheartAI (pCreature); }; - struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI { mob_fel_crystalAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) {} - void JustDied(Unit* killer) { if (ScriptedInstance* pInstance = m_creature->GetInstanceData()) @@ -343,21 +294,17 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI } else error_log(ERROR_INST_DATA); } }; - CreatureAI* GetAI_mob_fel_crystal(Creature* pCreature) { return new mob_fel_crystalAI (pCreature); }; - void AddSC_boss_selin_fireheart() { Script *newscript; - newscript = new Script; newscript->Name = "boss_selin_fireheart"; newscript->GetAI = &GetAI_boss_selin_fireheart; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_fel_crystal"; newscript->GetAI = &GetAI_mob_fel_crystal; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp index 82b5980ca44..a90f435aa9c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Vexallus SD%Complete: 90 SDComment: Heroic and Normal support. Needs further testing. SDCategory: Magister's Terrace EndScriptData */ - #include "precompiled.h" #include "def_magisters_terrace.h" - enum eEnums { SAY_AGGRO = -1585007, @@ -31,32 +28,25 @@ enum eEnums SAY_OVERLOAD = -1585009, SAY_KILL = -1585010, EMOTE_DISCHARGE_ENERGY = -1585011, - //is this text for real? //#define SAY_DEATH "What...happen...ed." - //Pure energy spell info SPELL_ENERGY_BOLT = 46156, SPELL_ENERGY_FEEDBACK = 44335, - //Vexallus spell info SPELL_CHAIN_LIGHTNING = 44318, SPELL_H_CHAIN_LIGHTNING = 46380, //heroic spell SPELL_OVERLOAD = 44353, SPELL_ARCANE_SHOCK = 44319, SPELL_H_ARCANE_SHOCK = 46381, //heroic spell - SPELL_SUMMON_PURE_ENERGY = 44322, //mod scale -10 H_SPELL_SUMMON_PURE_ENERGY1 = 46154, //mod scale -5 H_SPELL_SUMMON_PURE_ENERGY2 = 46159, //mod scale -5 - //Creatures NPC_PURE_ENERGY = 24745, - INTERVAL_MODIFIER = 15, INTERVAL_SWITCH = 6 }; - struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI { boss_vexallusAI(Creature *c) : ScriptedAI(c) @@ -64,16 +54,13 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI pInstance = c->GetInstanceData(); Heroic = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool Heroic; - uint32 ChainLightningTimer; uint32 ArcaneShockTimer; uint32 OverloadTimer; uint32 IntervalHealthAmount; bool Enraged; - void Reset() { ChainLightningTimer = 8000; @@ -81,44 +68,35 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI OverloadTimer = 1200; IntervalHealthAmount = 1; Enraged = false; - if (pInstance) pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); } - void JustSummoned(Creature *summoned) { if (Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 0)) summoned->GetMotionMaster()->MoveFollow(temp,0,0); - //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,m_creature->GetGUID()); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!Enraged) { //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% @@ -132,10 +110,8 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI } else ++IntervalHealthAmount; - DoScriptText(SAY_ENERGY, m_creature); DoScriptText(EMOTE_DISCHARGE_ENERGY, m_creature); - if (Heroic) { m_creature->CastSpell(m_creature,H_SPELL_SUMMON_PURE_ENERGY1,false); @@ -143,28 +119,22 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI } else m_creature->CastSpell(m_creature,SPELL_SUMMON_PURE_ENERGY,false); - //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in Mangos m_creature->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Heroic) m_creature->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); } - if (ChainLightningTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, Heroic ? SPELL_H_CHAIN_LIGHTNING : SPELL_CHAIN_LIGHTNING); - ChainLightningTimer = 8000; }else ChainLightningTimer -= diff; - if (ArcaneShockTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) if (target) DoCast(target, Heroic ? SPELL_H_ARCANE_SHOCK : SPELL_ARCANE_SHOCK); - ArcaneShockTimer = 8000; }else ArcaneShockTimer -= diff; } @@ -173,26 +143,20 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI if (OverloadTimer < diff) { DoCast(m_creature->getVictim(), SPELL_OVERLOAD); - OverloadTimer = 2000; }else OverloadTimer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_vexallus(Creature* pCreature) { return new boss_vexallusAI (pCreature); }; - struct TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI { mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void JustDied(Unit* slayer) { if (Unit *temp = m_creature->GetOwner()) @@ -201,26 +165,21 @@ struct TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID()); } } - void EnterCombat(Unit *who) { } void MoveInLineOfSight(Unit *who) { } void AttackStart(Unit *who) { } }; - CreatureAI* GetAI_mob_pure_energy(Creature* pCreature) { return new mob_pure_energyAI (pCreature); }; - void AddSC_boss_vexallus() { Script *newscript; - newscript = new Script; newscript->Name = "boss_vexallus"; newscript->GetAI = &GetAI_boss_vexallus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_pure_energy"; newscript->GetAI = &GetAI_mob_pure_energy; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/def_magisters_terrace.h b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/def_magisters_terrace.h index d6419ea409c..ac7aee1f887 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/def_magisters_terrace.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/def_magisters_terrace.h @@ -1,31 +1,24 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_MAGISTERS_TERRACE_H #define DEF_MAGISTERS_TERRACE_H - #define DATA_SELIN_EVENT 1 #define DATA_VEXALLUS_EVENT 2 #define DATA_DELRISSA_EVENT 3 #define DATA_KAELTHAS_EVENT 4 - #define DATA_SELIN 5 #define DATA_FEL_CRYSTAL 6 #define DATA_FEL_CRYSTAL_SIZE 7 - #define DATA_VEXALLUS_DOOR 8 #define DATA_SELIN_DOOR 9 #define DATA_DELRISSA 10 #define DATA_DELRISSA_DOOR 11 #define DATA_SELIN_ENCOUNTER_DOOR 12 - #define DATA_KAEL_DOOR 13 #define DATA_KAEL_STATUE_LEFT 14 #define DATA_KAEL_STATUE_RIGHT 15 - #define DATA_DELRISSA_DEATH_COUNT 16 - #define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/instance_magisters_terrace.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/instance_magisters_terrace.cpp index 4b7a68b9a61..7874123a4f4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/instance_magisters_terrace.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/instance_magisters_terrace.cpp @@ -13,36 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Magisters_Terrace SD%Complete: 60 SDComment: Designed only for Selin Fireheart SDCategory: Magister's Terrace EndScriptData */ - #include "precompiled.h" #include "def_magisters_terrace.h" - #define MAX_ENCOUNTER 4 - /* 0 - Selin Fireheart 1 - Vexallus 2 - Priestess Delrissa 3 - Kael'thas Sunstrider */ - struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance { instance_magisters_terrace(Map* pMap) : ScriptedInstance(pMap) {Initialize();} - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 DelrissaDeathCount; - std::list FelCrystals; std::list::iterator CrystalItr; - uint64 SelinGUID; uint64 DelrissaGUID; uint64 VexallusDoorGUID; @@ -51,17 +43,12 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance uint64 DelrissaDoorGUID; uint64 KaelDoorGUID; uint64 KaelStatue[2]; - bool InitializedItr; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - FelCrystals.clear(); - DelrissaDeathCount = 0; - SelinGUID = 0; DelrissaGUID = 0; VexallusDoorGUID = 0; @@ -71,18 +58,15 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance KaelDoorGUID = 0; KaelStatue[0] = 0; KaelStatue[1] = 0; - InitializedItr = false; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; return false; } - uint32 GetData(uint32 identifier) { switch(identifier) @@ -96,7 +80,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance } return 0; } - void SetData(uint32 identifier, uint32 data) { switch(identifier) @@ -115,7 +98,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance m_auiEncounter[2] = data; break; case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; - case DATA_DELRISSA_DEATH_COUNT: if (data == SPECIAL) ++DelrissaDeathCount; @@ -124,7 +106,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -134,7 +115,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance case 24722: FelCrystals.push_back(pCreature->GetGUID()); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -150,7 +130,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance case 188166: KaelStatue[1] = pGo->GetGUID(); break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -164,7 +143,6 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance case DATA_KAEL_DOOR: return KaelDoorGUID; case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; - case DATA_FEL_CRYSTAL: { if (FelCrystals.empty()) @@ -172,13 +150,11 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance error_log("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); return 0; } - if (!InitializedItr) { CrystalItr = FelCrystals.begin(); InitializedItr = true; } - uint64 guid = *CrystalItr; ++CrystalItr; return guid; @@ -187,16 +163,13 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_magisters_terrace(Map* pMap) { return new instance_magisters_terrace(pMap); } - void AddSC_instance_magisters_terrace() { Script *newscript; - newscript = new Script; newscript->Name = "instance_magisters_terrace"; newscript->GetInstanceData = &GetInstanceData_instance_magisters_terrace; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp index b23d5e72186..542569c8392 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Magisters_Terrace SD%Complete: 100 SDComment: Quest support: 11490(post-event) SDCategory: Magisters Terrace EndScriptData */ - /* ContentData npc_kalecgos EndContentData */ - #include "precompiled.h" - /*###### ## npc_kalecgos ######*/ - enum eEnums { SPELL_TRANSFORM_TO_KAEL = 44670, @@ -38,57 +33,43 @@ enum eEnums NPC_KAEL = 24848, //human form entry POINT_ID_LAND = 1 }; - const float afKaelLandPoint[] = {225.045, -276.236, -5.434}; - #define GOSSIP_ITEM_KAEL_1 "Who are you?" #define GOSSIP_ITEM_KAEL_2 "What can we do to assist you?" #define GOSSIP_ITEM_KAEL_3 "What brings you to the Sunwell?" #define GOSSIP_ITEM_KAEL_4 "You're not alone here?" #define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?" - // This is friendly keal that appear after used Orb. // If we assume DB handle summon, summon appear somewhere outside the platform where Orb is struct TRINITY_DLL_DECL npc_kalecgosAI : public ScriptedAI { npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 m_uiTransformTimer; - void Reset() { m_uiTransformTimer = 0; - // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here if (m_creature->GetEntry() != NPC_KAEL) m_creature->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]); } - void MovementInform(uint32 uiType, uint32 uiPointId) { if (uiType != POINT_MOTION_TYPE) return; - if (uiPointId == POINT_ID_LAND) m_uiTransformTimer = MINUTE*IN_MILISECONDS; } - // some targeting issues with the spell, so use this workaround as temporary solution void DoWorkaroundForQuestCredit() { Map* pMap = m_creature->GetMap(); - if (!pMap || pMap->IsHeroic()) return; - Map::PlayerList const &lList = pMap->GetPlayers(); - if (lList.isEmpty()) return; - SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT); - - for(Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) + for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) { if (Player* pPlayer = i->getSource()) { @@ -97,7 +78,6 @@ struct TRINITY_DLL_DECL npc_kalecgosAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { if (m_uiTransformTimer) @@ -106,33 +86,26 @@ struct TRINITY_DLL_DECL npc_kalecgosAI : public ScriptedAI { m_creature->CastSpell(m_creature,SPELL_ORB_KILL_CREDIT,false); DoWorkaroundForQuestCredit(); - // Transform and update entry, now ready for quest/read gossip m_creature->CastSpell(m_creature,SPELL_TRANSFORM_TO_KAEL,false); m_creature->UpdateEntry(NPC_KAEL); - m_uiTransformTimer = 0; }else m_uiTransformTimer -= uiDiff; } } }; - CreatureAI* GetAI_npc_kalecgos(Creature* pCreature) { return new npc_kalecgosAI(pCreature); } - bool GossipHello_npc_kalecgos(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_kalecgos(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -157,14 +130,11 @@ bool GossipSelect_npc_kalecgos(Player* pPlayer, Creature* pCreature, uint32 uiSe pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID()); break; } - return true; } - void AddSC_magisters_terrace() { Script *newscript; - newscript = new Script; newscript->Name = "npc_kalecgos"; newscript->GetAI = &GetAI_npc_kalecgos; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_baron_geddon.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_baron_geddon.cpp index 1a6ead66319..c32f85e2797 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_baron_geddon.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_baron_geddon.cpp @@ -13,47 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Baron_Geddon SD%Complete: 100 SDComment: SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define EMOTE_SERVICE -1409000 - #define SPELL_INFERNO 19695 #define SPELL_IGNITEMANA 19659 #define SPELL_LIVINGBOMB 20475 #define SPELL_ARMAGEDDOM 20479 - struct TRINITY_DLL_DECL boss_baron_geddonAI : public ScriptedAI { boss_baron_geddonAI(Creature *c) : ScriptedAI(c) {} - uint32 Inferno_Timer; uint32 IgniteMana_Timer; uint32 LivingBomb_Timer; - void Reset() { Inferno_Timer = 45000; //These times are probably wrong IgniteMana_Timer = 30000; LivingBomb_Timer = 35000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <2% hp cast Armageddom if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2) { @@ -62,32 +52,26 @@ struct TRINITY_DLL_DECL boss_baron_geddonAI : public ScriptedAI DoScriptText(EMOTE_SERVICE, m_creature); return; } - //Inferno_Timer if (Inferno_Timer < diff) { DoCast(m_creature,SPELL_INFERNO); Inferno_Timer = 45000; }else Inferno_Timer -= diff; - //IgniteMana_Timer if (IgniteMana_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_IGNITEMANA); - IgniteMana_Timer = 30000; }else IgniteMana_Timer -= diff; - //LivingBomb_Timer if (LivingBomb_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_LIVINGBOMB); - LivingBomb_Timer = 35000; }else LivingBomb_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -95,7 +79,6 @@ CreatureAI* GetAI_boss_baron_geddon(Creature* pCreature) { return new boss_baron_geddonAI (pCreature); } - void AddSC_boss_baron_geddon() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_garr.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_garr.cpp index bfdc20a251a..89336c33166 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_garr.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_garr.cpp @@ -13,98 +13,78 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Garr SD%Complete: 50 SDComment: Adds NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - // Garr spells #define SPELL_ANTIMAGICPULSE 19492 #define SPELL_MAGMASHACKLES 19496 #define SPELL_ENRAGE 19516 //Stacking enrage (stacks to 10 times) - //Add spells #define SPELL_ERUPTION 19497 #define SPELL_IMMOLATE 20294 - struct TRINITY_DLL_DECL boss_garrAI : public ScriptedAI { boss_garrAI(Creature *c) : ScriptedAI(c) {} - uint32 AntiMagicPulse_Timer; uint32 MagmaShackles_Timer; uint32 CheckAdds_Timer; uint64 Add[8]; bool Enraged[8]; - void Reset() { AntiMagicPulse_Timer = 25000; //These times are probably wrong MagmaShackles_Timer = 15000; CheckAdds_Timer = 2000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //AntiMagicPulse_Timer if (AntiMagicPulse_Timer < diff) { DoCast(m_creature,SPELL_ANTIMAGICPULSE); AntiMagicPulse_Timer = 10000 + rand()%5000; }else AntiMagicPulse_Timer -= diff; - //MagmaShackles_Timer if (MagmaShackles_Timer < diff) { DoCast(m_creature,SPELL_MAGMASHACKLES); MagmaShackles_Timer = 8000 + rand()%4000; }else MagmaShackles_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_fireswornAI : public ScriptedAI { mob_fireswornAI(Creature *c) : ScriptedAI(c) {} - uint32 Immolate_Timer; - void Reset() { Immolate_Timer = 4000; //These times are probably wrong } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Immolate_Timer if (Immolate_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_IMMOLATE); - Immolate_Timer = 5000 + rand()%5000; }else Immolate_Timer -= diff; - //Cast Erruption and let them die if (m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.10) { @@ -112,7 +92,6 @@ struct TRINITY_DLL_DECL mob_fireswornAI : public ScriptedAI m_creature->setDeathState(JUST_DIED); m_creature->RemoveCorpse(); } - DoMeleeAttackIfReady(); } }; @@ -120,21 +99,17 @@ CreatureAI* GetAI_boss_garr(Creature* pCreature) { return new boss_garrAI (pCreature); } - CreatureAI* GetAI_mob_firesworn(Creature* pCreature) { return new mob_fireswornAI (pCreature); } - void AddSC_boss_garr() { Script *newscript; - newscript = new Script; newscript->Name = "boss_garr"; newscript->GetAI = &GetAI_boss_garr; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_firesworn"; newscript->GetAI = &GetAI_mob_firesworn; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp index d33e9a92ba3..43df768573f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp @@ -13,42 +13,33 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gehennas SD%Complete: 90 SDComment: Adds MC NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWBOLT 19728 #define SPELL_RAINOFFIRE 19717 #define SPELL_GEHENNASCURSE 19716 - struct TRINITY_DLL_DECL boss_gehennasAI : public ScriptedAI { boss_gehennasAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowBolt_Timer; uint32 RainOfFire_Timer; uint32 GehennasCurse_Timer; - void Reset() { ShadowBolt_Timer = 6000; RainOfFire_Timer = 10000; GehennasCurse_Timer = 12000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { @@ -56,23 +47,19 @@ struct TRINITY_DLL_DECL boss_gehennasAI : public ScriptedAI DoCast(bTarget,SPELL_SHADOWBOLT); ShadowBolt_Timer = 7000; }else ShadowBolt_Timer -= diff; - //RainOfFire_Timer if (RainOfFire_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_RAINOFFIRE); - RainOfFire_Timer = 4000 + rand()%8000; }else RainOfFire_Timer -= diff; - //GehennasCurse_Timer if (GehennasCurse_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_GEHENNASCURSE); GehennasCurse_Timer = 22000 + rand()%8000; }else GehennasCurse_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -80,7 +67,6 @@ CreatureAI* GetAI_boss_gehennas(Creature* pCreature) { return new boss_gehennasAI (pCreature); } - void AddSC_boss_gehennas() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_golemagg.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_golemagg.cpp index 3fedad28827..1f9375bb82b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_golemagg.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_golemagg.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Golemagg SD%Complete: 90 SDComment: Timers need to be confirmed, Golemagg's Trust need to be checked SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" #include "def_molten_core.h" - enum eEnums { SPELL_MAGMASPLASH = 13879, @@ -31,65 +28,53 @@ enum eEnums SPELL_EARTHQUAKE = 19798, SPELL_ENRAGE = 19953, SPELL_GOLEMAGG_TRUST = 20553, - // Core Rager EMOTE_LOWHP = -1409002, SPELL_MANGLE = 19820 }; - struct TRINITY_DLL_DECL boss_golemaggAI : public ScriptedAI { boss_golemaggAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 m_uiPyroblastTimer; uint32 m_uiEarthquakeTimer; uint32 m_uiBuffTimer; bool m_bEnraged; - void Reset() { m_uiPyroblastTimer = 7*IN_MILISECONDS; // These timers are probably wrong m_uiEarthquakeTimer = 3*IN_MILISECONDS; m_uiBuffTimer = 2.5*IN_MILISECONDS; m_bEnraged = false; - m_creature->CastSpell(m_creature, SPELL_MAGMASPLASH, true); } - void JustDied(Unit* pKiller) { if (m_pInstance) m_pInstance->SetData(DATA_GOLEMAGG_DEATH, 0); } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //Pyroblast if (m_uiPyroblastTimer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_PYROBLAST); - m_uiPyroblastTimer = 7*IN_MILISECONDS; } else m_uiPyroblastTimer -= uiDiff; - // Enrage if (!m_bEnraged && m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*10) { DoCast(m_creature, SPELL_ENRAGE); m_bEnraged = true; } - // Earthquake if (m_bEnraged) { @@ -101,7 +86,6 @@ struct TRINITY_DLL_DECL boss_golemaggAI : public ScriptedAI else m_uiEarthquakeTimer -= uiDiff; } - /* // Golemagg's Trust if (m_uiBuffTimer < uiDiff) @@ -112,27 +96,21 @@ struct TRINITY_DLL_DECL boss_golemaggAI : public ScriptedAI else m_uiBuffTimer -= uiDiff; */ - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_core_ragerAI : public ScriptedAI { mob_core_ragerAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 m_uiMangleTimer; - void Reset() { m_uiMangleTimer = 7*IN_MILISECONDS; // These times are probably wrong } - void DamageTaken(Unit* pDoneBy, uint32& uiDamage) { if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*50) @@ -152,12 +130,10 @@ struct TRINITY_DLL_DECL mob_core_ragerAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - // Mangle if (m_uiMangleTimer < uiDiff) { @@ -166,30 +142,24 @@ struct TRINITY_DLL_DECL mob_core_ragerAI : public ScriptedAI } else m_uiMangleTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_golemagg(Creature* pCreature) { return new boss_golemaggAI (pCreature); } - CreatureAI* GetAI_mob_core_rager(Creature* pCreature) { return new mob_core_ragerAI (pCreature); } - void AddSC_boss_golemagg() { Script* newscript; - newscript = new Script; newscript->Name = "boss_golemagg"; newscript->GetAI = &GetAI_boss_golemagg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_core_rager"; newscript->GetAI = &GetAI_mob_core_rager; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_lucifron.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_lucifron.cpp index 509faaa6fd4..a6ffcb657c0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_lucifron.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_lucifron.cpp @@ -13,65 +13,53 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Lucifron SD%Complete: 100 SDComment: SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define SPELL_IMPENDINGDOOM 19702 #define SPELL_LUCIFRONCURSE 19703 #define SPELL_SHADOWSHOCK 20603 - struct TRINITY_DLL_DECL boss_lucifronAI : public ScriptedAI { boss_lucifronAI(Creature *c) : ScriptedAI(c) {} - uint32 ImpendingDoom_Timer; uint32 LucifronCurse_Timer; uint32 ShadowShock_Timer; - void Reset() { ImpendingDoom_Timer = 10000; //Initial cast after 10 seconds so the debuffs alternate LucifronCurse_Timer = 20000; //Initial cast after 20 seconds ShadowShock_Timer = 6000; //6 seconds } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Impending doom timer if (ImpendingDoom_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_IMPENDINGDOOM); ImpendingDoom_Timer = 20000; }else ImpendingDoom_Timer -= diff; - //Lucifron's curse timer if (LucifronCurse_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_LUCIFRONCURSE); LucifronCurse_Timer = 15000; }else LucifronCurse_Timer -= diff; - //Shadowshock if (ShadowShock_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWSHOCK); ShadowShock_Timer = 6000; }else ShadowShock_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -79,7 +67,6 @@ CreatureAI* GetAI_boss_lucifron(Creature* pCreature) { return new boss_lucifronAI (pCreature); } - void AddSC_boss_lucifron() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_magmadar.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_magmadar.cpp index ce6348f005e..c43e9eaada7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_magmadar.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_magmadar.cpp @@ -13,50 +13,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Magmadar SD%Complete: 75 SDComment: Conflag on ground nyi, fear causes issues without VMAPs SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define EMOTE_FRENZY -1409001 - #define SPELL_FRENZY 19451 #define SPELL_MAGMASPIT 19449 //This is actually a buff he gives himself #define SPELL_PANIC 19408 #define SPELL_LAVABOMB 19411 //This calls a dummy server side effect that isn't implemented yet #define SPELL_LAVABOMB_ALT 19428 //This is the spell that the lava bomb casts - struct TRINITY_DLL_DECL boss_magmadarAI : public ScriptedAI { boss_magmadarAI(Creature *c) : ScriptedAI(c) {} - uint32 Frenzy_Timer; uint32 Panic_Timer; uint32 Lavabomb_Timer; - void Reset() { Frenzy_Timer = 30000; Panic_Timer = 20000; Lavabomb_Timer = 12000; - m_creature->CastSpell(m_creature,SPELL_MAGMASPIT,true); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Frenzy_Timer if (Frenzy_Timer < diff) { @@ -64,23 +53,19 @@ struct TRINITY_DLL_DECL boss_magmadarAI : public ScriptedAI DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 15000; }else Frenzy_Timer -= diff; - //Panic_Timer if (Panic_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_PANIC); Panic_Timer = 35000; }else Panic_Timer -= diff; - //Lavabomb_Timer if (Lavabomb_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_LAVABOMB_ALT); - Lavabomb_Timer = 12000; }else Lavabomb_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -88,7 +73,6 @@ CreatureAI* GetAI_boss_magmadar(Creature* pCreature) { return new boss_magmadarAI (pCreature); } - void AddSC_boss_magmadar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp index 905edf27ea8..6d9c06af2b3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp @@ -13,108 +13,86 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Majordomo_Executus SD%Complete: 30 SDComment: Correct spawning and Event NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1409003 #define SAY_SPAWN -1409004 #define SAY_SLAY -1409005 #define SAY_SPECIAL -1409006 #define SAY_DEFEAT -1409007 - #define SAY_SUMMON_MAJ -1409008 #define SAY_ARRIVAL1_RAG -1409009 #define SAY_ARRIVAL2_MAJ -1409010 #define SAY_ARRIVAL3_RAG -1409011 #define SAY_ARRIVAL5_RAG -1409012 - #define SPAWN_RAG_X 838.51 #define SPAWN_RAG_Y -829.84 #define SPAWN_RAG_Z -232.00 #define SPAWN_RAG_O 1.70 - #define SPELL_MAGIC_REFLECTION 20619 #define SPELL_DAMAGE_REFLECTION 21075 - #define SPELL_BLASTWAVE 20229 #define SPELL_AEGIS 20620 //This is self casted whenever we are below 50% #define SPELL_TELEPORT 20618 #define SPELL_SUMMON_RAGNAROS 19774 - #define ENTRY_FLAMEWALKER_HEALER 11663 #define ENTRY_FLAMEWALKER_ELITE 11664 - struct TRINITY_DLL_DECL boss_majordomoAI : public ScriptedAI { boss_majordomoAI(Creature *c) : ScriptedAI(c) {} - uint32 MagicReflection_Timer; uint32 DamageReflection_Timer; uint32 Blastwave_Timer; - void Reset() { MagicReflection_Timer = 30000; //Damage reflection first so we alternate DamageReflection_Timer = 15000; Blastwave_Timer = 10000; } - void KilledUnit(Unit* victim) { if (rand()%5) return; - DoScriptText(SAY_SLAY, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Cast Ageis if less than 50% hp if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50) { DoCast(m_creature,SPELL_AEGIS); } - //MagicReflection_Timer // if (MagicReflection_Timer < diff) // { // DoCast(m_creature, SPELL_MAGICREFLECTION); - //60 seconds until we should cast this agian // MagicReflection_Timer = 30000; // }else MagicReflection_Timer -= diff; - //DamageReflection_Timer // if (DamageReflection_Timer < diff) // { // DoCast(m_creature, SPELL_DAMAGEREFLECTION); - //60 seconds until we should cast this agian // DamageReflection_Timer = 30000; // }else DamageReflection_Timer -= diff; - //Blastwave_Timer if (Blastwave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLASTWAVE); Blastwave_Timer = 10000; }else Blastwave_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -122,7 +100,6 @@ CreatureAI* GetAI_boss_majordomo(Creature* pCreature) { return new boss_majordomoAI (pCreature); } - void AddSC_boss_majordomo() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_ragnaros.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_ragnaros.cpp index 9376250e3e8..3e97982f047 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_ragnaros.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_ragnaros.cpp @@ -13,83 +13,67 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ragnaros SD%Complete: 75 SDComment: Intro Dialog and event NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define SAY_REINFORCEMENTS1 -1409013 #define SAY_REINFORCEMENTS2 -1409014 #define SAY_HAND -1409015 #define SAY_WRATH -1409016 #define SAY_KILL -1409017 #define SAY_MAGMABURST -1409018 - #define SPELL_HANDOFRAGNAROS 19780 #define SPELL_WRATHOFRAGNAROS 20566 #define SPELL_LAVABURST 21158 - #define SPELL_MAGMABURST 20565 //Ranged attack - #define SPELL_SONSOFFLAME_DUMMY 21108 //Server side effect #define SPELL_RAGSUBMERGE 21107 //Stealth aura #define SPELL_RAGEMERGE 20568 #define SPELL_MELTWEAPON 21388 #define SPELL_ELEMENTALFIRE 20564 #define SPELL_ERRUPTION 17731 - #define ADD_1X 848.740356 #define ADD_1Y -816.103455 #define ADD_1Z -229.74327 #define ADD_1O 2.615287 - #define ADD_2X 852.560791 #define ADD_2Y -849.861511 #define ADD_2Z -228.560974 #define ADD_2O 2.836073 - #define ADD_3X 808.710632 #define ADD_3Y -852.845764 #define ADD_3Z -227.914963 #define ADD_3O 0.964207 - #define ADD_4X 786.597107 #define ADD_4Y -821.132874 #define ADD_4Z -226.350128 #define ADD_4O 0.949377 - #define ADD_5X 796.219116 #define ADD_5Y -800.948059 #define ADD_5Z -226.010361 #define ADD_5O 0.560603 - #define ADD_6X 821.602539 #define ADD_6Y -782.744109 #define ADD_6Z -226.023575 #define ADD_6O 6.157440 - #define ADD_7X 844.924744 #define ADD_7Y -769.453735 #define ADD_7Z -225.521698 #define ADD_7O 4.4539958 - #define ADD_8X 839.823364 #define ADD_8Y -810.869385 #define ADD_8Z -229.683182 #define ADD_8O 4.693108 - struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI { boss_ragnarosAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); } - uint32 WrathOfRagnaros_Timer; uint32 HandOfRagnaros_Timer; uint32 LavaBurst_Timer; @@ -103,7 +87,6 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI bool HasSubmergedOnce; bool WasBanished; bool HasAura; - void Reset() { WrathOfRagnaros_Timer = 30000; @@ -117,23 +100,18 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI HasYelledMagmaBurst = false; HasSubmergedOnce = false; WasBanished = false; - m_creature->CastSpell(m_creature,SPELL_MELTWEAPON,true); HasAura = true; } - void KilledUnit(Unit* victim) { if (rand()%5) return; - DoScriptText(SAY_KILL, m_creature); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (WasBanished && Attack_Timer < diff) @@ -149,78 +127,64 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI //Do nothing while banished return; } - //Return since we have no target if (!UpdateVictim()) return; - //WrathOfRagnaros_Timer if (WrathOfRagnaros_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_WRATHOFRAGNAROS); - if (rand()%2 == 0) { DoScriptText(SAY_WRATH, m_creature); } - WrathOfRagnaros_Timer = 30000; }else WrathOfRagnaros_Timer -= diff; - //HandOfRagnaros_Timer if (HandOfRagnaros_Timer < diff) { DoCast(m_creature,SPELL_HANDOFRAGNAROS); - if (rand()%2==0) { DoScriptText(SAY_HAND, m_creature); } - HandOfRagnaros_Timer = 25000; }else HandOfRagnaros_Timer -= diff; - //LavaBurst_Timer if (LavaBurst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_LAVABURST); LavaBurst_Timer = 10000; }else LavaBurst_Timer -= diff; - //Erruption_Timer if (LavaBurst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ERRUPTION); Erruption_Timer = 20000 + rand()%25000; }else Erruption_Timer -= diff; - //ElementalFire_Timer if (ElementalFire_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ELEMENTALFIRE); ElementalFire_Timer = 10000 + rand()%4000; }else ElementalFire_Timer -= diff; - //Submerge_Timer if (!WasBanished && Submerge_Timer < diff) { //Creature spawning and ragnaros becomming unattackable //is not very well supported in the core //so added normaly spawning and banish workaround and attack again after 90 secs. - m_creature->InterruptNonMeleeSpells(false); //Root self DoCast(m_creature,23973); m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); - if (!HasSubmergedOnce) { DoScriptText(SAY_REINFORCEMENTS1, m_creature); - // summon 10 elementals - for(uint8 i = 0; i < 9; ++i) + for (uint8 i = 0; i < 9; ++i) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) { @@ -228,18 +192,15 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI pSummoned->AI()->AttackStart(pTarget); } } - HasSubmergedOnce = true; WasBanished = true; DoCast(m_creature,SPELL_RAGSUBMERGE); Attack_Timer = 90000; - } else { DoScriptText(SAY_REINFORCEMENTS2, m_creature); - - for(uint8 i = 0; i < 9; ++i) + for (uint8 i = 0; i < 9; ++i) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) { @@ -247,15 +208,12 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI pSummoned->AI()->AttackStart(pTarget); } } - WasBanished = true; DoCast(m_creature,SPELL_RAGSUBMERGE); Attack_Timer = 90000; } - Submerge_Timer = 180000; }else Submerge_Timer -= diff; - //If we are within range melee the target if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { @@ -272,14 +230,12 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public ScriptedAI if (MagmaBurst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MAGMABURST); - if (!HasYelledMagmaBurst) { //Say our dialog DoScriptText(SAY_MAGMABURST, m_creature); HasYelledMagmaBurst = true; } - MagmaBurst_Timer = 2500; }else MagmaBurst_Timer -= diff; } @@ -289,7 +245,6 @@ CreatureAI* GetAI_boss_ragnaros(Creature* pCreature) { return new boss_ragnarosAI (pCreature); } - void AddSC_boss_ragnaros() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_shazzrah.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_shazzrah.cpp index 772a7452214..efb042d6711 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_shazzrah.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_shazzrah.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Shazzrah SD%Complete: 75 SDComment: Teleport NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" - #define SPELL_ARCANEEXPLOSION 19712 #define SPELL_SHAZZRAHCURSE 19713 #define SPELL_DEADENMAGIC 19714 #define SPELL_COUNTERSPELL 19715 - struct TRINITY_DLL_DECL boss_shazzrahAI : public ScriptedAI { boss_shazzrahAI(Creature *c) : ScriptedAI(c) {} - uint32 ArcaneExplosion_Timer; uint32 ShazzrahCurse_Timer; uint32 DeadenMagic_Timer; uint32 Countspell_Timer; uint32 Blink_Timer; - void Reset() { ArcaneExplosion_Timer = 6000; //These times are probably wrong @@ -46,47 +40,39 @@ struct TRINITY_DLL_DECL boss_shazzrahAI : public ScriptedAI Countspell_Timer = 15000; Blink_Timer = 30000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ARCANEEXPLOSION); ArcaneExplosion_Timer = 5000 + rand()%4000; }else ArcaneExplosion_Timer -= diff; - //ShazzrahCurse_Timer if (ShazzrahCurse_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_SHAZZRAHCURSE); - ShazzrahCurse_Timer = 25000 + rand()%5000; }else ShazzrahCurse_Timer -= diff; - //DeadenMagic_Timer if (DeadenMagic_Timer < diff) { DoCast(m_creature,SPELL_DEADENMAGIC); DeadenMagic_Timer = 35000; }else DeadenMagic_Timer -= diff; - //Countspell_Timer if (Countspell_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_COUNTERSPELL); Countspell_Timer = 16000 + rand()%4000; }else Countspell_Timer -= diff; - //Blink_Timer if (Blink_Timer < diff) { @@ -94,17 +80,14 @@ struct TRINITY_DLL_DECL boss_shazzrahAI : public ScriptedAI // Blink is not working cause of LoS System we need to do this hardcoded. Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) { DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); DoCast(target,SPELL_ARCANEEXPLOSION); DoResetThreat(); } - Blink_Timer = 45000; }else Blink_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -112,7 +95,6 @@ CreatureAI* GetAI_boss_shazzrah(Creature* pCreature) { return new boss_shazzrahAI (pCreature); } - void AddSC_boss_shazzrah() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_sulfuron_harbinger.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_sulfuron_harbinger.cpp index a01fb32c46c..a0aaa76c0be 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_sulfuron_harbinger.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_sulfuron_harbinger.cpp @@ -13,38 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Sulfuron_Harbringer SD%Complete: 80 SDComment: Adds NYI SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" #include "def_molten_core.h" - #define SPELL_DARKSTRIKE 19777 #define SPELL_DEMORALIZINGSHOUT 19778 #define SPELL_INSPIRE 19779 #define SPELL_KNOCKDOWN 19780 #define SPELL_FLAMESPEAR 19781 - //Adds Spells #define SPELL_HEAL 19775 #define SPELL_SHADOWWORDPAIN 19776 #define SPELL_IMMOLATE 20294 - struct TRINITY_DLL_DECL boss_sulfuronAI : public ScriptedAI { boss_sulfuronAI(Creature *c) : ScriptedAI(c) {} - uint32 Darkstrike_Timer; uint32 DemoralizingShout_Timer; uint32 Inspire_Timer; uint32 Knockdown_Timer; uint32 Flamespear_Timer; - void Reset() { Darkstrike_Timer=10000; //These times are probably wrong @@ -53,23 +46,19 @@ struct TRINITY_DLL_DECL boss_sulfuronAI : public ScriptedAI Knockdown_Timer = 6000; Flamespear_Timer = 2000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //DemoralizingShout_Timer if (DemoralizingShout_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DEMORALIZINGSHOUT); DemoralizingShout_Timer = 15000 + rand()%5000; }else DemoralizingShout_Timer -= diff; - //Inspire_Timer if (Inspire_Timer < diff) { @@ -81,122 +70,96 @@ struct TRINITY_DLL_DECL boss_sulfuronAI : public ScriptedAI advance(i, (rand()%pList.size())); target = (*i); } - if (target) DoCast(target,SPELL_INSPIRE); - DoCast(m_creature,SPELL_INSPIRE); - Inspire_Timer = 20000 + rand()%6000; }else Inspire_Timer -= diff; - //Knockdown_Timer if (Knockdown_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN); Knockdown_Timer = 12000 + rand()%3000; }else Knockdown_Timer -= diff; - //Flamespear_Timer if (Flamespear_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_FLAMESPEAR); - Flamespear_Timer = 12000 + rand()%4000; }else Flamespear_Timer -= diff; - //DarkStrike_Timer if (Darkstrike_Timer < diff) { DoCast(m_creature, SPELL_DARKSTRIKE); Darkstrike_Timer = 15000 + rand()%3000; }else Darkstrike_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_flamewaker_priestAI : public ScriptedAI { mob_flamewaker_priestAI(Creature *c) : ScriptedAI(c) {} - uint32 Heal_Timer; uint32 ShadowWordPain_Timer; uint32 Immolate_Timer; - void Reset() { Heal_Timer = 15000+rand()%15000; ShadowWordPain_Timer = 2000; Immolate_Timer = 8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Casting Heal to Sulfuron or other Guards. if (Heal_Timer < diff) { Unit* pUnit = DoSelectLowestHpFriendly(60.0f, 1); if (!pUnit) return; - DoCast(pUnit, SPELL_HEAL); - Heal_Timer = 15000+rand()%5000; }else Heal_Timer -= diff; - //ShadowWordPain_Timer if (ShadowWordPain_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 18000+rand()%8000; }else ShadowWordPain_Timer -= diff; - //Immolate_Timer if (Immolate_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_IMMOLATE); - Immolate_Timer = 15000+rand()%10000; }else Immolate_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_sulfuron(Creature* pCreature) { return new boss_sulfuronAI (pCreature); } - CreatureAI* GetAI_mob_flamewaker_priest(Creature* pCreature) { return new mob_flamewaker_priestAI (pCreature); } - void AddSC_boss_sulfuron() { Script *newscript; - newscript = new Script; newscript->Name = "boss_sulfuron"; newscript->GetAI = &GetAI_boss_sulfuron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_flamewaker_priest"; newscript->GetAI = &GetAI_mob_flamewaker_priest; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/def_molten_core.h b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/def_molten_core.h index 5874d8b9408..40bbcb1226e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/def_molten_core.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/def_molten_core.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_MOLTEN_CORE_H #define DEF_MOLTEN_CORE_H - #define DATA_FLAMEWAKERPRIEST 1 #define DATA_GARRISDEAD 2 #define DATA_GEDDONISDEAD 3 diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/instance_molten_core.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/instance_molten_core.cpp index 6e7df410a98..e5c0a0351e2 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/instance_molten_core.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/instance_molten_core.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Molten_Core SD%Complete: 0 SDComment: Place Holder SDCategory: Molten Core EndScriptData */ - #include "precompiled.h" #include "def_molten_core.h" - #define MAX_ENCOUNTER 9 - #define ID_LUCIFRON 12118 #define ID_MAGMADAR 11982 #define ID_GEHENNAS 12259 @@ -37,23 +33,17 @@ EndScriptData */ #define ID_DOMO 12018 #define ID_RAGNAROS 11502 #define ID_FLAMEWAKERPRIEST 11662 - struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance { instance_molten_core(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn, m_uiFirelordCacheGUID;; - //If all Bosses are dead. bool IsBossDied[9]; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Lucifron = 0; Magmadar = 0; Gehennas = 0; @@ -65,7 +55,6 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance Domo = 0; Ragnaros = 0; FlamewakerPriest = 0; - RuneKoro = 0; RuneZeth = 0; RuneMazj = 0; @@ -73,9 +62,7 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance RuneBlaz = 0; RuneKress = 0; RuneMohn = 0; - m_uiFirelordCacheGUID = 0; - IsBossDied[0] = false; IsBossDied[1] = false; IsBossDied[2] = false; @@ -83,17 +70,14 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance IsBossDied[4] = false; IsBossDied[5] = false; IsBossDied[6] = false; - IsBossDied[7] = false; IsBossDied[8] = false; } - bool IsEncounterInProgress() const { return false; }; - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -125,7 +109,6 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch (pCreature->GetEntry()) @@ -133,49 +116,38 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance case ID_LUCIFRON: Lucifron = pCreature->GetGUID(); break; - case ID_MAGMADAR: Magmadar = pCreature->GetGUID(); break; - case ID_GEHENNAS: Gehennas = pCreature->GetGUID(); break; - case ID_GARR: Garr = pCreature->GetGUID(); break; - case ID_GEDDON: Geddon = pCreature->GetGUID(); break; - case ID_SHAZZRAH: Shazzrah = pCreature->GetGUID(); break; - case ID_SULFURON: Sulfuron = pCreature->GetGUID(); break; - case ID_GOLEMAGG: Golemagg = pCreature->GetGUID(); break; - case ID_DOMO: Domo = pCreature->GetGUID(); break; - case ID_RAGNAROS: Ragnaros = pCreature->GetGUID(); break; - case ID_FLAMEWAKERPRIEST: FlamewakerPriest = pCreature->GetGUID(); break; } } - uint64 GetData64 (uint32 identifier) { switch(identifier) @@ -184,14 +156,11 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance return Sulfuron; case DATA_GOLEMAGG: return Golemagg; - case DATA_FLAMEWAKERPRIEST: return FlamewakerPriest; } - return 0; } - uint32 GetData(uint32 type) { switch(type) @@ -200,63 +169,51 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance if (IsBossDied[0]) return 1; break; - case DATA_MAGMADARISDEAD: if (IsBossDied[1]) return 1; break; - case DATA_GEHENNASISDEAD: if (IsBossDied[2]) return 1; break; - case DATA_GARRISDEAD: if (IsBossDied[3]) return 1; break; - case DATA_GEDDONISDEAD: if (IsBossDied[4]) return 1; break; - case DATA_SHAZZRAHISDEAD: if (IsBossDied[5]) return 1; break; - case DATA_SULFURONISDEAD: if (IsBossDied[6]) return 1; break; - case DATA_GOLEMAGGISDEAD: if (IsBossDied[7]) return 1; break; - case DATA_MAJORDOMOISDEAD: if (IsBossDied[8]) return 1; break; } - return 0; } - void SetData(uint32 type, uint32 data) { if (type == DATA_GOLEMAGG_DEATH) IsBossDied[7] = true; } }; - InstanceData* GetInstance_instance_molten_core(Map* pMap) { return new instance_molten_core (pMap); } - void AddSC_instance_molten_core() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/molten_core.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/molten_core.cpp index 833f67f5fc7..a6be8e4f346 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/molten_core.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/molten_core.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Molten_Core SD%Complete: 100 SDComment: SDCategory: Molten Core EndScriptData */ - /* ContentData mob_ancient_core_hound EndContentData */ - #include "precompiled.h" #include "simple_ai.h" - #define SPELL_CONE_OF_FIRE 19630 #define SPELL_BITE 19771 - //Random Debuff (each hound has only one of these) #define SPELL_GROUND_STOMP 19364 #define SPELL_ANCIENT_DREAD 19365 @@ -38,41 +33,32 @@ EndContentData */ #define SPELL_WITHERING_HEAT 19367 #define SPELL_ANCIENT_DESPAIR 19369 #define SPELL_ANCIENT_HYSTERIA 19372 - CreatureAI* GetAI_mob_ancient_core_hound(Creature* pCreature) { SimpleAI *ai = new SimpleAI(pCreature); - ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; ai->Spell[0].Cooldown = 7000; ai->Spell[0].First_Cast = 10000; ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - uint32 RandDebuff = RAND(SPELL_GROUND_STOMP,SPELL_ANCIENT_DREAD,SPELL_CAUTERIZING_FLAMES, SPELL_WITHERING_HEAT,SPELL_ANCIENT_DESPAIR,SPELL_ANCIENT_HYSTERIA); - ai->Spell[1].Enabled = true; ai->Spell[1].Spell_Id = RandDebuff; ai->Spell[1].Cooldown = 24000; ai->Spell[1].First_Cast = 15000; ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->Spell[2].Enabled = true; ai->Spell[2].Spell_Id = SPELL_BITE; ai->Spell[2].Cooldown = 6000; ai->Spell[2].First_Cast = 4000; ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->EnterEvadeMode(); - return ai; } - void AddSC_molten_core() { Script *newscript; - newscript = new Script; newscript->Name = "mob_ancient_core_hound"; newscript->GetAI = &GetAI_mob_ancient_core_hound; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp index 449ed462a44..4fd9d5ef933 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp @@ -15,48 +15,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "Vehicle.h" #include "ObjectMgr.h" #include "escort_ai.h" - /*###### ##Quest 12848 ######*/ - #define GCD_CAST 1 - enum eDeathKnightSpells { SPELL_SOUL_PRISON_CHAIN_SELF = 54612, SPELL_SOUL_PRISON_CHAIN = 54613, SPELL_DK_INITIATE_VISUAL = 51519, - SPELL_ICY_TOUCH = 52372, SPELL_PLAGUE_STRIKE = 52373, SPELL_BLOOD_STRIKE = 52374, SPELL_DEATH_COIL = 52375 }; - #define EVENT_ICY_TOUCH 1 #define EVENT_PLAGUE_STRIKE 2 #define EVENT_BLOOD_STRIKE 3 #define EVENT_DEATH_COIL 4 - //used by 29519,29520,29565,29566,29567 but signed for 29519 int32 say_event_start[8] = { -1609000,-1609001,-1609002,-1609003, -1609004,-1609005,-1609006,-1609007 }; - int32 say_event_attack[9] = { -1609008,-1609009,-1609010,-1609011,-1609012, -1609013,-1609014,-1609015,-1609016 }; - uint32 acherus_soul_prison[12] = { 191577, @@ -72,7 +63,6 @@ uint32 acherus_soul_prison[12] = 191589, 191590 }; - uint32 acherus_unworthy_initiate[5] = { 29519, @@ -81,7 +71,6 @@ uint32 acherus_unworthy_initiate[5] = 29566, 29567 }; - enum UnworthyInitiatePhase { PHASE_CHAINED, @@ -90,7 +79,6 @@ enum UnworthyInitiatePhase PHASE_TO_ATTACK, PHASE_ATTACKING, }; - struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI { npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) @@ -101,15 +89,12 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI if (info->equipmentId) const_cast(me->GetCreatureInfo())->equipmentId = info->equipmentId; } - uint64 playerGUID; UnworthyInitiatePhase phase; uint32 wait_timer; float anchorX, anchorY; uint64 anchorGUID; - EventMap events; - void Reset() { anchorGUID = 0; @@ -120,7 +105,6 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); me->LoadEquipment(0, true); } - void EnterCombat(Unit *who) { events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); @@ -128,63 +112,48 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == 1) { wait_timer = 5000; me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true); - if(Player* starter = Unit::GetPlayer(playerGUID)) DoScriptText(say_event_attack[rand()%9], me, starter); - phase = PHASE_TO_ATTACK; } } - void EventStart(Creature* anchor, Player* target) { wait_timer = 5000; phase = PHASE_TO_EQUIP; - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); - float z; anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f); - playerGUID = target->GetGUID(); DoScriptText(say_event_start[rand()%8], me, target); } - void UpdateAI(const uint32 diff); }; - CreatureAI* GetAI_npc_unworthy_initiate(Creature* pCreature) { return new npc_unworthy_initiateAI(pCreature); } - struct TRINITY_DLL_DECL npc_unworthy_initiate_anchorAI : public PassiveAI { npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} - uint64 prisonerGUID; - void SetGUID(const uint64 &guid, int32 id) { if (!prisonerGUID) prisonerGUID = guid; } - uint64 GetGUID(int32 id) { return prisonerGUID; } }; - void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) { switch(phase) @@ -200,11 +169,9 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) } else error_log("npc_unworthy_initiateAI: unable to find anchor!"); - float dist = 99.0f; GameObject *prison = NULL; - - for(uint8 i = 0; i < 12; ++i) + for (uint8 i = 0; i < 12; ++i) { if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30)) { @@ -215,7 +182,6 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) } } } - if (prison) prison->ResetDoorOrButton(); else @@ -246,7 +212,6 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); phase = PHASE_ATTACKING; - if (Player* target = Unit::GetPlayer(playerGUID)) me->AI()->AttackStart(target); wait_timer = 0; @@ -256,9 +221,7 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) case PHASE_ATTACKING: if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -285,32 +248,25 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) break; } } - DoMeleeAttackIfReady(); } } - CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature* pCreature) { return new npc_unworthy_initiate_anchorAI(pCreature); } - bool GOHello_go_acherus_soul_prison(Player* pPlayer, GameObject* pGo) { if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) if (uint64 prisonerGUID = anchor->AI()->GetGUID()) if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) CAST_AI(npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, pPlayer); - return false; } - /*###### ## npc_death_knight_initiate ######*/ - #define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!" - enum eDuelEnums { SAY_DUEL_A = -1609080, @@ -322,46 +278,37 @@ enum eDuelEnums SAY_DUEL_G = -1609086, SAY_DUEL_H = -1609087, SAY_DUEL_I = -1609088, - SPELL_DUEL = 52996, //SPELL_DUEL_TRIGGERED = 52990, SPELL_DUEL_VICTORY = 52994, SPELL_DUEL_FLAG = 52991, - QUEST_DEATH_CHALLENGE = 12733, FACTION_HOSTILE = 2068 }; - int32 m_auiRandomSay[] = { SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I }; - struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI { npc_death_knight_initiateAI(Creature* pCreature) : CombatAI(pCreature) { m_bIsDuelInProgress = false; } - bool lose; uint64 m_uiDuelerGUID; uint32 m_uiDuelTimer; bool m_bIsDuelInProgress; - void Reset() { lose = false; me->RestoreFaction(); CombatAI::Reset(); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - m_uiDuelerGUID = 0; m_uiDuelTimer = 5000; m_bIsDuelInProgress = false; } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL) @@ -370,7 +317,6 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI m_bIsDuelInProgress = true; } } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) @@ -380,7 +326,6 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI else if (uiDamage >= m_creature->GetHealth()) { uiDamage = 0; - if (!lose) { pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); @@ -393,7 +338,6 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI } } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) @@ -403,7 +347,6 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI if (m_uiDuelTimer < uiDiff) { m_creature->setFaction(FACTION_HOSTILE); - if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiDuelerGUID)) AttackStart(pUnit); } @@ -412,7 +355,6 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI } return; } - if (m_bIsDuelInProgress) { if (lose) @@ -430,76 +372,59 @@ struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public CombatAI return; } } - // TODO: spells - CombatAI::UpdateAI(uiDiff); } }; - CreatureAI* GetAI_npc_death_knight_initiate(Creature* pCreature) { return new npc_death_knight_initiateAI(pCreature); } - bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) { if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) return true; - if (pPlayer->isInCombat() || pCreature->isInCombat()) return true; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(),pCreature->GetGUID()); } return true; } - bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) { pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->isInCombat() || pCreature->isInCombat()) return true; - if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) { if (pInitiateAI->m_bIsDuelInProgress) return true; } - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); - pPlayer->CastSpell(pCreature, SPELL_DUEL, false); pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); } return true; } - /*###### ## npc_dark_rider_of_acherus ######*/ - #define DESPAWN_HORSE 52267 #define SAY_DARK_RIDER "The realm of shadows awaits..." - struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI { npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} - uint32 PhaseTimer; uint32 Phase; bool Intro; Unit *Target; - void Reset() { PhaseTimer = 4000; @@ -507,12 +432,10 @@ struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI Intro = false; Target = NULL; } - void UpdateAI(const uint32 diff) { if (!Intro) return; - if (PhaseTimer < diff) { switch(Phase) @@ -539,14 +462,11 @@ struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI break; } }else PhaseTimer -= diff; - } - void InitDespawnHorse(Unit *who) { if (!who) return; - Target = who; m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->SetSpeed(MOVE_RUN, 0.4f); @@ -554,18 +474,14 @@ struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Target->GetGUID()); Intro = true; } - }; - CreatureAI* GetAI_npc_dark_rider_of_acherus(Creature* pCreature) { return new npc_dark_rider_of_acherusAI(pCreature); } - /*###### ## npc_salanar_the_horseman ######*/ - enum eSalanar { REALM_OF_SHADOWS = 52693, @@ -574,11 +490,9 @@ enum eSalanar CALL_DARK_RIDER = 52266, SPELL_EFFECT_OVERTAKE = 52349 }; - struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI { npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == DELIVER_STOLEN_HORSE) @@ -597,11 +511,9 @@ struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI } } } - void MoveInLineOfSight(Unit *who) { ScriptedAI::MoveInLineOfSight(who); - if (who->GetTypeId() == TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f)) { if (Unit *charmer = who->GetCharmer()) @@ -616,7 +528,6 @@ struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI CAST_CRE(who)->ForcedDespawn(); //CAST_CRE(who)->Respawn(true); } - if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); } @@ -624,25 +535,20 @@ struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_salanar_the_horseman(Creature* pCreature) { return new npc_salanar_the_horsemanAI(pCreature); } - /*###### ## npc_ros_dark_rider ######*/ - struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI { npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit *who) { me->ExitVehicle(); } - void Reset() { Creature* deathcharger = me->FindNearestCreature(28782, 30); @@ -653,7 +559,6 @@ struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0)) me->EnterVehicle(deathcharger); } - void JustDied(Unit *killer) { Creature* deathcharger = me->FindNearestCreature(28782, 30); @@ -666,12 +571,10 @@ struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_ros_dark_rider(Creature* pCreature) { return new npc_ros_dark_riderAI(pCreature); } - // correct way: 52312 52314 52555 ... enum SG { @@ -681,11 +584,9 @@ enum SG struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI { npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit *who) { ScriptedAI::MoveInLineOfSight(who); - if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) { if (Unit *owner = who->GetOwner()) @@ -701,7 +602,6 @@ struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI // stand next to Gothik and be commanded into the pit // and dig into the ground. CAST_CRE(who)->ForcedDespawn(); - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) owner->RemoveAllMinionsByEntry(GHOULS); } @@ -709,12 +609,10 @@ struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_dkc1_gothik(Creature* pCreature) { return new npc_dkc1_gothikAI(pCreature); } - struct TRINITY_DLL_DECL npc_scarlet_ghoulAI : public ScriptedAI { npc_scarlet_ghoulAI(Creature *c) : ScriptedAI(c) @@ -725,15 +623,13 @@ struct TRINITY_DLL_DECL npc_scarlet_ghoulAI : public ScriptedAI //m_creature->MonsterSay("Mommy?",LANG_UNIVERSAL,0); m_creature->SetReactState(REACT_DEFENSIVE); } - void FindMinions(Unit *owner) { std::list MinionList; owner->GetAllMinionsByEntry(MinionList,GHOULS); - if (!MinionList.empty()) { - for(std::list::iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) + for (std::list::iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) { if (CAST_CRE(*itr)->GetOwner()->GetGUID() == m_creature->GetOwner()->GetGUID()) { @@ -745,7 +641,6 @@ struct TRINITY_DLL_DECL npc_scarlet_ghoulAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat()) @@ -765,10 +660,8 @@ struct TRINITY_DLL_DECL npc_scarlet_ghoulAI : public ScriptedAI } } } - if (!UpdateVictim()) return; - //ScriptedAI::UpdateAI(diff); //Check if we have a current target if (m_creature->getVictim()->GetEntry() == GHOSTS) @@ -785,19 +678,15 @@ struct TRINITY_DLL_DECL npc_scarlet_ghoulAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_scarlet_ghoul(Creature* pCreature) { return new npc_scarlet_ghoulAI(pCreature); } - /*#### ## npc_scarlet_miner_cart ####*/ - #define SPELL_CART_CHECK 54173 #define SPELL_CART_DRAG 52465 - struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI { npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) @@ -805,14 +694,11 @@ struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse } - uint64 minerGUID; - void SetGUID(const uint64 &guid, int32 id) { minerGUID = guid; } - void DoAction(const int32 param) { if(Creature *miner = Unit::GetCreature(*me, minerGUID)) @@ -824,7 +710,6 @@ struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); } } - void PassengerBoarded(Unit *who, int8 seatId, bool apply) { if(!apply) @@ -832,37 +717,30 @@ struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI miner->DisappearAndDie(); } }; - CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) { return new npc_scarlet_miner_cartAI(_Creature); } - /*#### ## npc_scarlet_miner ####*/ - #define SAY_SCARLET_MINER1 "Where'd this come from? I better get this down to the ships before the foreman sees it!" #define SAY_SCARLET_MINER2 "Now I can have a rest!" - struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI { npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) { me->SetReactState(REACT_PASSIVE); } - uint32 IntroTimer; uint32 IntroPhase; uint64 carGUID; - void Reset() { carGUID = 0; IntroTimer = 0; IntroPhase = 0; } - void InitWaypoint() { AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); @@ -877,7 +755,6 @@ struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI AddWaypoint(10, 2217.265625, -6028.959473, 7.675705 ); AddWaypoint(11, 2202.595947, -6061.325684, 5.882018 ); AddWaypoint(12, 2188.974609, -6080.866699, 3.370027 ); - if(rand()%2) { AddWaypoint(13, 2176.483887, -6110.407227, 1.855181 ); @@ -895,7 +772,6 @@ struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); } } - void InitCartQuest(Player *who) { carGUID = who->GetVehicleBase()->GetGUID(); @@ -903,7 +779,6 @@ struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI Start(false, false, who->GetGUID()); SetDespawnAtFar(false); } - void WaypointReached(uint32 i) { switch (i) @@ -936,7 +811,6 @@ struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI break; } } - void UpdateAI(const uint32 diff) { if (IntroPhase) @@ -961,18 +835,14 @@ struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_scarlet_miner(Creature *_Creature) { return new npc_scarlet_minerAI(_Creature); } - /*###### ## go_inconspicuous_mine_car ######*/ - #define SPELL_CART_SUMM 52463 - bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* pGO) { if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) @@ -993,29 +863,23 @@ bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* pGO) } return true; } - // npc 28912 quest 17217 boss 29001 mob 29007 go 191092 - void AddSC_the_scarlet_enclave_c1() { Script *newscript; - // 12848 The Endless Hunger newscript = new Script; newscript->Name = "npc_unworthy_initiate"; newscript->GetAI = &GetAI_npc_unworthy_initiate; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_unworthy_initiate_anchor"; newscript->GetAI = &GetAI_npc_unworthy_initiate_anchor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_acherus_soul_prison"; newscript->pGOHello = &GOHello_go_acherus_soul_prison; newscript->RegisterSelf(); - // Death's Challenge newscript = new Script; newscript->Name = "npc_death_knight_initiate"; @@ -1023,52 +887,43 @@ void AddSC_the_scarlet_enclave_c1() newscript->pGossipHello = &GossipHello_npc_death_knight_initiate; newscript->pGossipSelect = &GossipSelect_npc_death_knight_initiate; newscript->RegisterSelf(); - // 12680 Grand Theft Palomino newscript = new Script; newscript->Name = "npc_salanar_the_horseman"; newscript->GetAI = &GetAI_npc_salanar_the_horseman; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_dark_rider_of_acherus"; newscript->GetAI = &GetAI_npc_dark_rider_of_acherus; newscript->RegisterSelf(); - // 12687 Into the Realm of Shadows newscript = new Script; newscript->Name = "npc_ros_dark_rider"; newscript->GetAI = &GetAI_npc_ros_dark_rider; newscript->RegisterSelf(); - // 12698 The Gift That Keeps On Giving newscript = new Script; newscript->Name = "npc_dkc1_gothik"; newscript->GetAI = &GetAI_npc_dkc1_gothik; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_scarlet_ghoul"; newscript->GetAI = &GetAI_npc_scarlet_ghoul; newscript->RegisterSelf(); - // Massacre At Light's Point newscript = new Script; newscript->Name = "npc_scarlet_miner"; newscript->GetAI = &GetAI_npc_scarlet_miner; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_scarlet_miner_cart"; newscript->GetAI = &GetAI_npc_scarlet_miner_cart; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_inconspicuous_mine_car"; newscript->pGOHello = &GOHello_go_inconspicuous_mine_car; newscript->RegisterSelf(); } - /* DELETE FROM `script_texts` WHERE `entry` IN(-1609301, -1609302); INSERT INTO `script_texts` (`entry`,`content_default`,`type`,`language`,`emote`,`comment`) VALUES diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp index a592b0cc9b0..b9f8ed31bf8 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "escort_ai.h" - //How to win friends and influence enemies // texts signed for creature 28939 but used for 28939,28940,28610 enum win_friends @@ -44,15 +42,12 @@ enum win_friends SAY_PERSUADED6 = -1609519, SPELL_PERSUASIVE_STRIKE = 52781 }; - struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI { npc_crusade_persuadedAI(Creature *pCreature) : ScriptedAI(pCreature) {} - uint32 uiSpeech_timer; uint32 uiSpeech_counter; uint64 uiPlayerGUID; - void Reset() { uiSpeech_timer = 0; @@ -61,7 +56,6 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI me->SetReactState(REACT_AGGRESSIVE); me->RestoreFaction(); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) @@ -76,17 +70,14 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI me->GetMotionMaster()->MoveIdle(); me->SetReactState(REACT_PASSIVE); DoCastAOE(58111, true); - DoScriptText(RAND(SAY_PERSUADE1,SAY_PERSUADE2,SAY_PERSUADE3, SAY_PERSUADE4,SAY_PERSUADE5,SAY_PERSUADE6, SAY_PERSUADE7), caster); - DoScriptText(RAND(SAY_CRUSADER1,SAY_CRUSADER2,SAY_CRUSADER3, SAY_CRUSADER4,SAY_CRUSADER5,SAY_CRUSADER6), me); } } } - void UpdateAI(const uint32 diff) { if (uiSpeech_counter) @@ -99,7 +90,6 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI EnterEvadeMode(); return; } - switch(uiSpeech_counter) { case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; @@ -115,30 +105,23 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI pPlayer->GroupEventHappens(12720, me); return; } - ++uiSpeech_counter; DoCastAOE(58111, true); }else uiSpeech_timer -= diff; - return; } - if(!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_crusade_persuaded(Creature* pCreature) { return new npc_crusade_persuadedAI (pCreature); } - /*###### ## npc_koltira_deathweaver ######*/ - enum eKoltira { SAY_BREAKOUT1 = -1609561, @@ -151,32 +134,25 @@ enum eKoltira SAY_BREAKOUT8 = -1609568, SAY_BREAKOUT9 = -1609569, SAY_BREAKOUT10 = -1609570, - SPELL_KOLTIRA_TRANSFORM = 52899, SPELL_ANTI_MAGIC_ZONE = 52894, - QUEST_BREAKOUT = 12727, - NPC_CRIMSON_ACOLYTE = 29007, NPC_HIGH_INQUISITOR_VALROTH = 29001, NPC_KOLTIRA_ALT = 28447, - //not sure about this id //NPC_DEATH_KNIGHT_MOUNT = 29201, MODEL_DEATH_KNIGHT_MOUNT = 25278 }; - struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI { npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) { me->SetReactState(REACT_DEFENSIVE); } - uint32 m_uiWave; uint32 m_uiWave_Timer; uint64 m_uiValrothGUID; - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) @@ -189,7 +165,6 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI me->RemoveAura(SPELL_ANTI_MAGIC_ZONE); } } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -224,31 +199,25 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI break; } } - void JustSummoned(Creature* pSummoned) { if (Player* pPlayer = GetPlayerForEscort()) { pSummoned->AI()->AttackStart(pPlayer); } - if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) m_uiValrothGUID = pSummoned->GetGUID(); - pSummoned->AddThreat(me, 0.0f); pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - void SummonAcolyte(uint32 uiAmount) { - for(uint32 i = 0; i < uiAmount; ++i) + for (uint32 i = 0; i < uiAmount; ++i) me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); } - void UpdateAI(const uint32 uiDiff) { npc_escortAI::UpdateAI(uiDiff); - if (HasEscortState(STATE_ESCORT_PAUSED)) { if (m_uiWave_Timer < uiDiff) @@ -278,7 +247,6 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI case 4: { Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID); - if (!pTemp || !pTemp->isAlive()) { DoScriptText(SAY_BREAKOUT8, me); @@ -302,7 +270,6 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI SetEscortPaused(false); break; } - ++m_uiWave; } else @@ -310,24 +277,20 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_koltira_deathweaver(Creature* pCreature) { return new npc_koltira_deathweaverAI(pCreature); } - bool QuestAccept_npc_koltira_deathweaver(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_BREAKOUT) { pCreature->SetStandState(UNIT_STAND_STATE_STAND); - if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaverAI,pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID()); } return true; } - //Scarlet courier enum ScarletCourierEnum { @@ -337,37 +300,30 @@ enum ScarletCourierEnum GO_INCONSPICUOUS_TREE = 191144, NPC_SCARLET_COURIER = 29076 }; - struct TRINITY_DLL_DECL mob_scarlet_courierAI : public ScriptedAI { mob_scarlet_courierAI(Creature *pCreature) : ScriptedAI(pCreature) {} - uint32 uiStage; uint32 uiStage_timer; - void Reset() { me->Mount(14338); // not sure about this id uiStage = 1; uiStage_timer = 3000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_TREE2, me); me->Unmount(); uiStage = 0; } - void MovementInform(uint32 type, uint32 id) { if(type != POINT_MOTION_TYPE) return; - if(id == 1) uiStage = 2; } - void UpdateAI(const uint32 diff) { if(uiStage && !me->isInCombat()) @@ -396,21 +352,16 @@ struct TRINITY_DLL_DECL mob_scarlet_courierAI : public ScriptedAI uiStage = 0; }else uiStage_timer -= diff; } - if(!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_scarlet_courier(Creature* pCreature) { return new mob_scarlet_courierAI (pCreature); } - //Koltira & Valroth- Breakout - enum valroth { SAY_VALROTH1 = -1609581, @@ -424,28 +375,23 @@ enum valroth SPELL_VALROTH_SMITE = 52926, SPELL_SUMMON_VALROTH_REMAINS = 52929 }; - struct TRINITY_DLL_DECL mob_high_inquisitor_valrothAI : public ScriptedAI { mob_high_inquisitor_valrothAI(Creature *pCreature) : ScriptedAI(pCreature) {} - uint32 uiRenew_timer; uint32 uiInquisitor_Penance_timer; uint32 uiValroth_Smite_timer; - void Reset() { uiRenew_timer = 1000; uiInquisitor_Penance_timer = 2000; uiValroth_Smite_timer = 1000; } - void EnterCombat(Unit* who) { DoScriptText(SAY_VALROTH2, me); DoCast(who, SPELL_VALROTH_SMITE); } - void UpdateAI(const uint32 diff) { if (uiRenew_timer < diff) @@ -454,43 +400,36 @@ struct TRINITY_DLL_DECL mob_high_inquisitor_valrothAI : public ScriptedAI DoCast(me, SPELL_RENEW); uiRenew_timer = 1000 + rand()%5000; }else uiRenew_timer -= diff; - if (uiInquisitor_Penance_timer < diff) { Shout(); DoCast(me->getVictim(), SPELL_INQUISITOR_PENANCE); uiInquisitor_Penance_timer = 2000 + rand()%5000; }else uiInquisitor_Penance_timer -= diff; - if (uiValroth_Smite_timer < diff) { Shout(); DoCast(me->getVictim(), SPELL_VALROTH_SMITE); uiValroth_Smite_timer = 1000 + rand()%5000; }else uiValroth_Smite_timer -= diff; - DoMeleeAttackIfReady(); } - void Shout() { if(rand()%100 < 15) DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me); } - void JustDied(Unit* killer) { DoScriptText(SAY_VALROTH6, me); killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true); } }; - CreatureAI* GetAI_mob_high_inquisitor_valroth(Creature* pCreature) { return new mob_high_inquisitor_valrothAI (pCreature); } - /*###### ## npc_a_special_surprise ######*/ @@ -551,27 +490,21 @@ enum SpecialSurprise SAY_EXEC_TIME_10 = -1609076, SAY_EXEC_WAITING = -1609077, EMOTE_DIES = -1609078, - NPC_PLAGUEFIST = 29053 }; - struct TRINITY_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI { npc_a_special_surpriseAI(Creature *pCreature) : ScriptedAI(pCreature) {} - uint32 ExecuteSpeech_Timer; uint32 ExecuteSpeech_Counter; uint64 PlayerGUID; - void Reset() { ExecuteSpeech_Timer = 0; ExecuteSpeech_Counter = 0; PlayerGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - bool MeetQuestCondition(Unit* pPlayer) { switch(me->GetEntry()) @@ -617,19 +550,15 @@ struct TRINITY_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI return true; break; } - return false; } - void MoveInLineOfSight(Unit* pWho) { if (PlayerGUID || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(me, INTERACTION_DISTANCE)) return; - if (MeetQuestCondition(pWho)) PlayerGUID = pWho->GetGUID(); } - void UpdateAI(const uint32 diff) { if (PlayerGUID && !me->getVictim() && me->isAlive()) @@ -637,15 +566,12 @@ struct TRINITY_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI if (ExecuteSpeech_Timer < diff) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (!pPlayer) { Reset(); return; } - //TODO: simplify text's selection - switch(pPlayer->getRace()) { case RACE_HUMAN: @@ -929,12 +855,10 @@ struct TRINITY_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI } break; } - if (ExecuteSpeech_Counter >= 9) ExecuteSpeech_Timer = 15000; else ExecuteSpeech_Timer = 7000; - ++ExecuteSpeech_Counter; } else @@ -942,47 +866,39 @@ struct TRINITY_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature) { return new npc_a_special_surpriseAI(pCreature); } - void AddSC_the_scarlet_enclave_c2() { Script *newscript; - // How to win friends and influence enemies newscript = new Script; newscript->Name = "npc_crusade_persuaded"; newscript->GetAI = &GetAI_npc_crusade_persuaded; newscript->RegisterSelf(); - // Ambush At The Overlook newscript = new Script; newscript->Name = "mob_scarlet_courier"; newscript->GetAI = &GetAI_mob_scarlet_courier; newscript->RegisterSelf(); - // 12727 Bloody Breakout newscript = new Script; newscript->Name = "npc_koltira_deathweaver"; newscript->GetAI = &GetAI_npc_koltira_deathweaver; newscript->pQuestAccept = &QuestAccept_npc_koltira_deathweaver; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_high_inquisitor_valroth"; newscript->GetAI = &GetAI_mob_high_inquisitor_valroth; newscript->RegisterSelf(); - // A Special Suprise newscript = new Script; newscript->Name = "npc_a_special_surprise"; newscript->GetAI = &GetAI_npc_a_special_surprise; newscript->RegisterSelf(); } - /* -- Bloody Breakout UPDATE `creature_template` SET `ScriptName`='npc_koltira_deathweaver' WHERE `entry`='28912'; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp index 0f64371f528..2d42374f84c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "escort_ai.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 enum mograine @@ -44,11 +42,9 @@ enum mograine #endif ENCOUNTER_TOTAL_DAWN = 300, // Total number ENCOUNTER_TOTAL_SCOURGE = 10000, - WORLD_STATE_REMAINS = 3592, WORLD_STATE_COUNTDOWN = 3603, WORLD_STATE_EVENT_BEGIN = 3605, - SAY_LIGHT_OF_DAWN01 = -1609201, // pre text SAY_LIGHT_OF_DAWN02 = -1609202, SAY_LIGHT_OF_DAWN03 = -1609203, @@ -117,7 +113,6 @@ enum mograine SAY_LIGHT_OF_DAWN66 = -1609266, // Highlord Tirion Fordring SAY_LIGHT_OF_DAWN67 = -1609267, // Highlord Tirion Fordring SAY_LIGHT_OF_DAWN68 = -1609268, // Highlord Darion Mograine - EMOTE_LIGHT_OF_DAWN01 = -1609269, // Emotes EMOTE_LIGHT_OF_DAWN02 = -1609270, EMOTE_LIGHT_OF_DAWN03 = -1609271, @@ -136,10 +131,8 @@ enum mograine EMOTE_LIGHT_OF_DAWN16 = -1609284, EMOTE_LIGHT_OF_DAWN17 = -1609285, EMOTE_LIGHT_OF_DAWN18 = -1609286, - GO_LIGHT_OF_DAWN = 191330, SPELL_THE_LIGHT_OF_DAWN_Q = 53606, // quest credit - // ---- Dark Knight npc -------------------- // Highlord Darion Mograine NPC_HIGHLORD_DARION_MOGRAINE = 29173, @@ -153,7 +146,6 @@ enum mograine SPELL_ALEXANDROS_MOGRAINE_SPAWN = 53667, SPELL_MOGRAINE_CHARGE = 53679, SPELL_ASHBRINGER = 53701, - // Koltira Deathweaver & Orbaz Bloodbane are using the same abilities NPC_KOLTIRA_DEATHWEAVER = 29199, NPC_ORBAZ_BLOODBANE = 29204, // this guy fleed @@ -163,7 +155,6 @@ enum mograine SPELL_ICY_TOUCH2 = 52372, SPELL_PLAGUE_STRIKE1 = 50668, // all do SPELL_HERO_AGGRO_AURA 53627 - // Lich King NPC_THE_LICH_KING = 29183, // show up at end SPELL_APOCALYPSE = 53210, @@ -172,26 +163,20 @@ enum mograine SPELL_SOUL_FEAST_TIRION = 53685, // on Tirion SPELL_ICEBOUND_VISAGE = 53274, // not sure what is it for SPELL_REBUKE = 53680, - // others NPC_RAMPAGING_ABOMINATION = 29186, SPELL_CLEAVE1 = 53633, SPELL_SCOURGE_HOOK = 50335, SPELL_SCOURGE_AGGRO_AURA = 53624, - NPC_FLESH_BEHEMOTH = 29190, // giant guy SPELL_STOMP = 53634, SPELL_THUNDERCLAP = 36706, SPELL_HERO_AGGRO_AURA = 53627, - NPC_ACHERUS_GHOUL = 29219, // just ghoul.... SPELL_GHOULPLOSION = 53632, - NPC_WARRIOR_OF_THE_FROZEN_WASTES = 29206, // use SPELL_CLEAVE 53631 - NPC_HIGHLORD_ALEXANDROS_MOGRAINE = 29227, // ghost NPC_DARION_MOGRAINE = 29228, // ghost - // ---- Dawn npc -------------------- // Highlord Tirion Fordring NPC_HIGHLORD_TIRION_FORDRING = 29175, @@ -200,56 +185,46 @@ enum mograine SPELL_REBIRTH_OF_THE_ASHBRINGER = 53702, SPELL_TIRION_CHARGE = 53705, SPELL_TIRION_CHARGE_VISUAL = 53706, - // others NPC_KORFAX_CHAMPION_OF_THE_LIGHT = 29176, SPELL_CLEAVE = 53631, SPELL_HEROIC_LEAP = 53625, - NPC_LORD_MAXWELL_TYROSUS = 29178, NPC_LEONID_BARTHALOMEW_THE_REVERED = 29179, NPC_DUKE_NICHOLAS_ZVERENHOFF = 29180, - NPC_COMMANDER_ELIGOR_DAWNBRINGER = 29177, SPELL_HOLY_LIGHT2 = 37979, - NPC_RAYNE = 29181, SPELL_REJUVENATION = 20664, SPELL_STARFALL = 20678, SPELL_TRANQUILITY = 25817, SPELL_WRATH = 21807, - NPC_DEFENDER_OF_THE_LIGHT = 29174, // also does SPELL_HEROIC_LEAP 53625 SPELL_HOLY_LIGHT1 = 29427, SPELL_HOLY_STRIKE = 53643, SPELL_HOLY_WRATH = 53638, SPELL_UPPERCUT = 53629, - NPC_RIMBLAT_EARTHSHATTER = 29182, SPELL_CHAIN_HEAL = 33642, SPELL_THUNDER = 53630 }; - struct Locations { float x, y, z, o; uint32 id; }; - void UpdateWorldState(Map *map, uint32 id, uint32 state) { Map::PlayerList const& players = map->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) pPlayer->SendUpdateWorldState(id,state); } } } - static Locations LightofDawnLoc[]= { {2281.335, -5300.409, 85.170, 0}, // 0 Tirion Fordring loc @@ -283,14 +258,12 @@ static Locations LightofDawnLoc[]= {2272.709, -5255.552, 78.226, 0}, // 28 Lich king kicked {2273.972, -5257.676, 78.862, 0} // 29 Lich king moves forward }; - struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI { npc_highlord_darion_mograineAI(Creature *pCreature) : npc_escortAI(pCreature) { Reset(); } - bool bIsBattle; uint32 uiStep; uint32 uiPhase_timer; @@ -298,7 +271,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uint32 uiTotal_dawn; uint32 uiTotal_scourge; uint32 uiSummon_counter; - // Darion Mograine uint32 uiAnti_magic_zone; uint32 uiDeath_strike; @@ -308,7 +280,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uint32 uiFight_speech; uint32 uiSpawncheck; uint32 uiTargetcheck; - // Dawn uint64 uiTirionGUID; uint64 uiAlexandrosGUID; @@ -319,7 +290,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uint64 uiRayneGUID; uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; - // Death uint64 uiKoltiraGUID; uint64 uiOrbazGUID; @@ -329,7 +299,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) @@ -341,24 +310,19 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiTotal_dawn = ENCOUNTER_TOTAL_DAWN; uiTotal_scourge = ENCOUNTER_TOTAL_SCOURGE; uiSummon_counter = 0; - uiAnti_magic_zone = 1000 + rand()%5000; uiDeath_strike = 5000 + rand()%5000; uiDeath_embrace = 5000 + rand()%5000; uiIcy_touch = 5000 + rand()%5000; uiUnholy_blight = 5000 + rand()%5000; - uiFight_speech = 15000; uiSpawncheck = 1000; uiTargetcheck = 10000; - me->SetStandState(UNIT_STAND_STATE_STAND); me->Mount(25279); - UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 0); //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) pTemp->setDeathState(JUST_DIED); if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) @@ -369,26 +333,23 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->setDeathState(JUST_DIED); if (Creature* pTemp = Unit::GetCreature(*me, uiRayneGUID)) pTemp->setDeathState(JUST_DIED); - uiTirionGUID = NULL; uiKorfaxGUID = NULL; uiMaxwellGUID = NULL; uiEligorGUID = NULL; uiRayneGUID = NULL; - - for(uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[i])) pTemp->setDeathState(JUST_DIED); uiDefenderGUID[i] = 0; } - for(uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) pTemp->setDeathState(JUST_DIED); uiEarthshatterGUID[i] = 0; } - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) pTemp->setDeathState(JUST_DIED); if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) @@ -397,30 +358,29 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->setDeathState(JUST_DIED); if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) pTemp->setDeathState(JUST_DIED); - uiKoltiraGUID = NULL; uiOrbazGUID = NULL; uiThassarianGUID = NULL; uiLichKingGUID = NULL; - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) pTemp->setDeathState(JUST_DIED); uiAbominationGUID[i] = 0; } - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) pTemp->setDeathState(JUST_DIED); uiBehemothGUID[i] = 0; } - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) pTemp->setDeathState(JUST_DIED); uiGhoulGUID[i] = 0; } - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) pTemp->setDeathState(JUST_DIED); @@ -428,15 +388,12 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } } } - void AttackStart(Unit* who) { if (!who) return; - if (who == me) return; - if (me->Attack(who, true)) { me->AddThreat(who, 0.0f); @@ -445,22 +402,18 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI DoStartMovement(who); } } - void MoveInLineOfSight(Unit* who) { if (!who) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) AttackStart(who); } - void SetHoldState(bool bOnHold) { SetEscortPaused(bOnHold); } - void WaypointReached(uint32 i) { switch(i) @@ -471,33 +424,28 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI break; case 1: SetHoldState(true); - SpawnNPC(); if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) DoScriptText(SAY_LIGHT_OF_DAWN07, pTemp); if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) DoScriptText(SAY_LIGHT_OF_DAWN08, pTemp); - - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) NPCChangeTarget(uiGhoulGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) NPCChangeTarget(uiWarriorGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) NPCChangeTarget(uiAbominationGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) NPCChangeTarget(uiBehemothGUID[i]); NPCChangeTarget(uiKoltiraGUID); NPCChangeTarget(uiOrbazGUID); NPCChangeTarget(uiThassarianGUID); - me->Unmount(); me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) pTemp->Unmount(); if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) pTemp->Unmount(); - bIsBattle = true; break; case 2: @@ -507,7 +455,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI case 3: { Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); - DoScriptText(EMOTE_LIGHT_OF_DAWN05, me); if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); @@ -546,7 +493,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI case 4: DoScriptText(SAY_LIGHT_OF_DAWN27, me); me->SetStandState(UNIT_STAND_STATE_KNEEL); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) @@ -575,11 +521,9 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI break; } } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!bIsBattle) { if (uiPhase_timer < diff) @@ -590,7 +534,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI case 0: // countdown //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 1); break; - case 1: // just delay //UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 1); UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); @@ -598,7 +541,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); JumpToNextStep(3000); break; - case 2: DoScriptText(SAY_LIGHT_OF_DAWN04, me); if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f)) @@ -609,12 +551,10 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiThassarianGUID = pThassarian->GetGUID(); JumpToNextStep(10000); break; - case 3: // rise DoScriptText(SAY_LIGHT_OF_DAWN05, me); JumpToNextStep(3000); break; - case 4: // summon ghoul // Dunno whats the summon spell, so workaround DoCast(me, 33271); // shack effect @@ -633,7 +573,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiStep++; } break; - case 5: // summon abomination DoCast(me, 33271); // shack effect uiPhase_timer = 500; @@ -651,7 +590,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiStep++; } break; - case 6: // summon warrior DoCast(me, 33271); // shack effect uiPhase_timer = 500; @@ -669,7 +607,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiStep++; } break; - case 7: // summon warrior DoCast(me, 33271); // shack effect uiPhase_timer = 500; @@ -687,12 +624,10 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiStep++; } break; - case 8: // summon announce DoScriptText(SAY_LIGHT_OF_DAWN06, me); JumpToNextStep(5000); break; - case 9: // charge begins SetHoldState(false); if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) @@ -710,46 +645,41 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); JumpToNextStep(5000); break; - // ******* After battle ***************************************************************** case 11: // Tirion starts to speak if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN28, pTemp); JumpToNextStep(21000); break; - case 12: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN29, pTemp); JumpToNextStep(13000); break; - case 13: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN30, pTemp); JumpToNextStep(13000); break; - case 14: me->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_LIGHT_OF_DAWN31, me); JumpToNextStep(7000); break; - case 15: // summon gate if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { @@ -760,7 +690,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(4000); break; - case 16: // Alexandros out if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) { @@ -771,13 +700,11 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI SetHoldState(false); // makes darion turns back JumpToNextStep(5000); break; - case 17: me->SetStandState(UNIT_STAND_STATE_KNEEL); DoScriptText(SAY_LIGHT_OF_DAWN34, me); JumpToNextStep(5000); break; - case 18: // Darion's spirit out if (Unit* pTemp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { @@ -787,7 +714,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(4000); break; - case 19: // runs to father if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) { @@ -796,65 +722,53 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(4000); break; - case 20: if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN36, pTemp); JumpToNextStep(4000); break; - case 21: if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) DoScriptText(EMOTE_LIGHT_OF_DAWN08, pTemp); JumpToNextStep(4000); break; - case 22: if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) DoScriptText(SAY_LIGHT_OF_DAWN37, pTemp); JumpToNextStep(8000); break; - case 23: if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN38, pTemp); JumpToNextStep(8000); break; - case 24: if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) DoScriptText(SAY_LIGHT_OF_DAWN39, pTemp); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); - JumpToNextStep(15000); break; - case 25: if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN40, pTemp); JumpToNextStep(11000); break; - case 26: if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) DoScriptText(SAY_LIGHT_OF_DAWN41, pTemp); JumpToNextStep(5000); break; - case 27: if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) pTemp->setDeathState(JUST_DIED); JumpToNextStep(24000); break; - case 28: if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) DoScriptText(SAY_LIGHT_OF_DAWN42, pTemp); JumpToNextStep(6000); break; - case 29: // lich king spawns if (Unit* pTemp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { @@ -865,7 +779,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(2000); break; - case 30: if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him { @@ -879,20 +792,17 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(3000); break; - case 31: me->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(EMOTE_LIGHT_OF_DAWN10, me); DoScriptText(SAY_LIGHT_OF_DAWN44, me); JumpToNextStep(3000); break; - case 32: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); JumpToNextStep(6000); break; - case 33: // Darion supports to jump to lich king here if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge @@ -902,7 +812,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI SetHoldState(false); JumpToNextStep(0); break; - case 35: // Lich king counterattacks if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { @@ -914,30 +823,25 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI SetHoldState(false); // Darion got kicked by lich king JumpToNextStep(0); break; - case 37: // Lich king counterattacks me->SetStandState(UNIT_STAND_STATE_KNEEL); JumpToNextStep(3000); break; - case 38: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN47, pTemp); JumpToNextStep(8000); break; - case 39: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN48, pTemp); JumpToNextStep(15000); break; - case 40: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN49, pTemp); JumpToNextStep(17000); break; - case 41: // Lich king - Apocalypse if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { @@ -953,7 +857,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(2000); break; - case 42: // Maxwell yells for attack { float fLichPositionX, fLichPositionY, fLichPositionZ; @@ -963,7 +866,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI fLichPositionY = pTemp->GetPositionY(); fLichPositionZ = pTemp->GetPositionZ(); } - if (fLichPositionX && fLichPositionY) { Unit* pTemp; @@ -974,7 +876,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->setFaction(me->getFaction()); pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); uiDefenderGUID[0] = pTemp->GetGUID(); - pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); @@ -1009,11 +910,9 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(4500); break; - case 43: // They all got kicked if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(EMOTE_LIGHT_OF_DAWN13, pTemp); - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) { pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); @@ -1049,7 +948,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(3000); break; - case 44: // make them stand up if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) pTemp->SetStandState(UNIT_STAND_STATE_STAND); @@ -1059,12 +957,10 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->SetStandState(UNIT_STAND_STATE_STAND); JumpToNextStep(1000); break; - case 45: DoScriptText(SAY_LIGHT_OF_DAWN52, me); JumpToNextStep(5000); break; - case 46: // Darion stand up, "not today" me->SetSpeed(MOVE_RUN, 1.0f); me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); @@ -1073,7 +969,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI SetHoldState(false); // Darion throws sword JumpToNextStep(7000); break; - case 47: // Ashbringer rebirth me->SetStandState(UNIT_STAND_STATE_KNEEL); DoScriptText(EMOTE_LIGHT_OF_DAWN15, me); @@ -1085,7 +980,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(1000); break; - case 48: // Show the cleansing effect (dawn of light) //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // pGo->SetPhaseMask(128, true); @@ -1101,25 +995,21 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->InterruptNonMeleeSpells(false); JumpToNextStep(2500); break; - case 49: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN54, pTemp); JumpToNextStep(4000); break; - case 50: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN55, pTemp); JumpToNextStep(5000); break; - case 51: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN56, pTemp); JumpToNextStep(1000); break; - case 52: // Tiron charges if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) { @@ -1134,13 +1024,11 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(1500); break; - case 53: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN57, pTemp); JumpToNextStep(1000); break; - case 54: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { @@ -1150,31 +1038,26 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(4000); break; - case 55: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); JumpToNextStep(2000); break; - case 56: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) pTemp->SetStandState(UNIT_STAND_STATE_STAND); JumpToNextStep(1500); break; - case 57: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN58, pTemp); JumpToNextStep(10000); break; - case 58: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) DoScriptText(SAY_LIGHT_OF_DAWN59, pTemp); JumpToNextStep(10000); break; - case 59: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) pTemp->CastSpell(pTemp, SPELL_TELEPORT_VISUAL, false); @@ -1186,7 +1069,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(2500); break; - case 60: if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here { @@ -1195,13 +1077,11 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(10000); break; - case 61: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN60, pTemp); JumpToNextStep(3000); break; - case 62: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) { @@ -1210,7 +1090,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(5500); break; - case 63: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) { @@ -1219,53 +1098,44 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } JumpToNextStep(15000); break; - case 64: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN62, pTemp); JumpToNextStep(7000); break; - case 65: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN63, pTemp); JumpToNextStep(10000); break; - case 66: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN64, pTemp); JumpToNextStep(11000); break; - case 67: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN65, pTemp); JumpToNextStep(10000); break; - case 68: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN66, pTemp); JumpToNextStep(8000); break; - case 69: if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN67, pTemp); JumpToNextStep(10000); break; - case 70: me->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_LIGHT_OF_DAWN68, me); JumpToNextStep(10000); break; - case 71: //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light // pGo->SetPhaseMask(0, true); - { Map *map = me->GetMap(); // search players with in 50 yards for quest credit Map::PlayerList const &PlayerList = map->GetPlayers(); @@ -1280,16 +1150,13 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI me->SummonCreature(NPC_HIGHLORD_DARION_MOGRAINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); JumpToNextStep(1000); break; - case 72: SetHoldState(false); // Escort ends JumpToNextStep(0); break; } - }else uiPhase_timer -= diff; } - // ******* During battle ***************************************************************** else { @@ -1298,31 +1165,26 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI DoCast(me, SPELL_ANTI_MAGIC_ZONE1); uiAnti_magic_zone = 25000 + rand()%5000; } else uiAnti_magic_zone -= diff; - if (uiDeath_strike < diff) { DoCast(me->getVictim(), SPELL_DEATH_STRIKE); uiDeath_strike = 5000 + rand()%5000; } else uiDeath_strike -= diff; - if (uiDeath_embrace < diff) { DoCast(me->getVictim(), SPELL_DEATH_EMBRACE); uiDeath_embrace = 5000 + rand()%5000; } else uiDeath_embrace -= diff; - if (uiIcy_touch < diff) { DoCast(me->getVictim(), SPELL_ICY_TOUCH1); uiIcy_touch = 5000 + rand()%5000; } else uiIcy_touch -= diff; - if (uiUnholy_blight < diff) { DoCast(me->getVictim(), SPELL_UNHOLY_BLIGHT); uiUnholy_blight = 5000 + rand()%5000; } else uiUnholy_blight -= diff; - if (uiFight_speech < diff) { DoScriptText(RAND(SAY_LIGHT_OF_DAWN09,SAY_LIGHT_OF_DAWN10,SAY_LIGHT_OF_DAWN11, @@ -1333,32 +1195,28 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI SAY_LIGHT_OF_DAWN24), me); uiFight_speech = 15000 + rand()%5000; } else uiFight_speech -= diff; - // Check spawns if (uiSpawncheck < diff) { SpawnNPC(); uiSpawncheck = 1000; } else uiSpawncheck -= diff; - // Check targets if (uiTargetcheck < diff) { - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) NPCChangeTarget(uiGhoulGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) NPCChangeTarget(uiWarriorGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) NPCChangeTarget(uiAbominationGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) NPCChangeTarget(uiBehemothGUID[i]); NPCChangeTarget(uiKoltiraGUID); NPCChangeTarget(uiOrbazGUID); NPCChangeTarget(uiThassarianGUID); - uiTargetcheck = 10000; } else uiTargetcheck -= diff; - // Battle end if (uiFight_duration < diff + 5000) { @@ -1375,7 +1233,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI { bIsBattle = false; uiFight_duration = 300000; - if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); me->RemoveAllAuras(); @@ -1383,20 +1240,18 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI me->CombatStop(true); me->InterruptNonMeleeSpells(false); me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - - for(uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) DespawnNPC(uiDefenderGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) DespawnNPC(uiEarthshatterGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) DespawnNPC(uiAbominationGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) DespawnNPC(uiBehemothGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) DespawnNPC(uiGhoulGUID[i]); - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) DespawnNPC(uiWarriorGUID[i]); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) { pTemp->RemoveAllAuras(); @@ -1407,7 +1262,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); } - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) { pTemp->RemoveAllAuras(); @@ -1418,7 +1272,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); } - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) { pTemp->RemoveAllAuras(); @@ -1430,7 +1283,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); } DespawnNPC(uiRayneGUID); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) { pTemp->RemoveAllAuras(); @@ -1442,10 +1294,8 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); } - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) DoScriptText(EMOTE_LIGHT_OF_DAWN04, pTemp); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) { pTemp->RemoveAllAuras(); @@ -1457,24 +1307,18 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); } - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) DoScriptText(SAY_LIGHT_OF_DAWN26, pTemp); - SetHoldState(false); - } else uiFight_duration -= diff; - DoMeleeAttackIfReady(); } } - void JumpToNextStep(uint32 uiTimer) { uiPhase_timer = uiTimer; uiStep++; } - void NPCChangeTarget(uint64 ui_GUID) { if (Creature* pTemp = Unit::GetCreature(*me, ui_GUID)) @@ -1490,13 +1334,11 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI // pTemp->GetMotionMaster()->MoveChase(pTarger, 20.0f); } } - void SpawnNPC() { Unit* pTemp = NULL; - // Death - for(uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiGhoulGUID[i]))) { @@ -1505,7 +1347,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiGhoulGUID[i] = pTemp->GetGUID(); } } - for(uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiAbominationGUID[i]))) { @@ -1514,7 +1356,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiAbominationGUID[i] = pTemp->GetGUID(); } } - for(uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiWarriorGUID[i]))) { @@ -1523,7 +1365,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiWarriorGUID[i] = pTemp->GetGUID(); } } - for(uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiBehemothGUID[i]))) { @@ -1532,9 +1374,8 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiBehemothGUID[i] = pTemp->GetGUID(); } } - // Dawn - for(uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiDefenderGUID[i]))) { @@ -1544,7 +1385,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiDefenderGUID[i] = pTemp->GetGUID(); } } - for(uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) { if (!(pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i]))) { @@ -1583,7 +1424,6 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI uiRayneGUID = pTemp->GetGUID(); } } - void DespawnNPC(uint64 pGUID) { if (Creature* pTemp = Unit::GetCreature(*me, pGUID)) @@ -1594,20 +1434,15 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI } } }; - bool GossipHello_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu( pCreature->GetGUID() ); - if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM( 0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -1620,7 +1455,6 @@ bool GossipSelect_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreat } return true; } - /*###### ## npc the lich king in dawn of light ######*/ @@ -1632,28 +1466,23 @@ struct TRINITY_DLL_DECL npc_the_lich_king_tirion_dawnAI : public ScriptedAI void UpdateAI(const uint32 diff) { return; } void JustDied(Unit* killer) {} }; - CreatureAI* GetAI_npc_highlord_darion_mograine(Creature* pCreature) { return new npc_highlord_darion_mograineAI(pCreature); } - CreatureAI* GetAI_npc_the_lich_king_tirion_dawn(Creature* pCreature) { return new npc_the_lich_king_tirion_dawnAI (pCreature); } - void AddSC_the_scarlet_enclave_c5() { Script *newscript; - newscript = new Script; newscript->Name = "npc_highlord_darion_mograine"; newscript->GetAI = &GetAI_npc_highlord_darion_mograine; newscript->pGossipHello = &GossipHello_npc_highlord_darion_mograine; newscript->pGossipSelect = &GossipSelect_npc_highlord_darion_mograine; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_the_lich_king_tirion_dawn"; newscript->GetAI = &GetAI_npc_the_lich_king_tirion_dawn; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 049c4b72cde..2a728d5d2da 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -15,23 +15,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" - /*#### ## npc_valkyr_battle_maiden ####*/ #define SPELL_REVIVE 51918 #define VALK_WHISPER "It is not yet your time, champion. Rise! Rise and fight once more!" - struct TRINITY_DLL_DECL npc_valkyr_battle_maidenAI : public PassiveAI { npc_valkyr_battle_maidenAI(Creature *c) : PassiveAI(c) {} - uint32 FlyBackTimer; float x, y, z; uint32 phase; - void Reset() { m_creature->SetVisibility(VISIBILITY_OFF); @@ -39,13 +34,11 @@ struct TRINITY_DLL_DECL npc_valkyr_battle_maidenAI : public PassiveAI m_creature->SetFlying(true); FlyBackTimer = 500; phase = 0; - m_creature->GetPosition(x, y, z); z += 4; x -= 3.5; y -= 5; m_creature->GetMotionMaster()->Clear(false); m_creature->GetMap()->CreatureRelocation(m_creature, x, y, z, 0.0f); } - void UpdateAI(const uint32 diff) { if(FlyBackTimer < diff) @@ -55,10 +48,8 @@ struct TRINITY_DLL_DECL npc_valkyr_battle_maidenAI : public PassiveAI if(Unit *summoner = CAST_SUM(me)->GetSummoner()) if(summoner->GetTypeId() == TYPEID_PLAYER) plr = CAST_PLR(summoner); - if(!plr) phase = 3; - switch(phase) { case 0: @@ -94,21 +85,17 @@ struct TRINITY_DLL_DECL npc_valkyr_battle_maidenAI : public PassiveAI }else FlyBackTimer-=diff; } }; - CreatureAI* GetAI_npc_valkyr_battle_maiden(Creature* pCreature) { return new npc_valkyr_battle_maidenAI (pCreature); } - void AddSC_the_scarlet_enclave() { Script *newscript; - newscript = new Script; newscript->Name = "npc_valkyr_battle_maiden"; newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; newscript->RegisterSelf(); - // Chapter 3: Scarlet Armies Approach... - An End To All Things... // Chapter 4: An End To All Things... - An End To All Things... } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_arcanist_doan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_arcanist_doan.cpp index 51a8d6efc8d..be5d73b4009 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_arcanist_doan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_arcanist_doan.cpp @@ -13,38 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Arcanist_Doan SD%Complete: 100 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1189019, SAY_SPECIALAE = -1189020, - SPELL_POLYMORPH = 13323, SPELL_AOESILENCE = 8988, SPELL_ARCANEEXPLOSION = 9433, SPELL_FIREAOE = 9435, SPELL_ARCANEBUBBLE = 9438, }; - struct TRINITY_DLL_DECL boss_arcanist_doanAI : public ScriptedAI { boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {} - uint32 Polymorph_Timer; uint32 AoESilence_Timer; uint32 ArcaneExplosion_Timer; bool bCanDetonate; bool bShielded; - void Reset() { Polymorph_Timer = 20000; @@ -53,62 +46,50 @@ struct TRINITY_DLL_DECL boss_arcanist_doanAI : public ScriptedAI bCanDetonate = false; bShielded = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (bShielded && bCanDetonate) { DoCast(m_creature,SPELL_FIREAOE); bCanDetonate = false; } - if (m_creature->HasAura(SPELL_ARCANEBUBBLE)) return; - //If we are <50% hp cast Arcane Bubble if (!bShielded && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50) { //wait if we already casting if (m_creature->IsNonMeleeSpellCasted(false)) return; - DoScriptText(SAY_SPECIALAE, m_creature); DoCast(m_creature,SPELL_ARCANEBUBBLE); - bCanDetonate = true; bShielded = true; } - if (Polymorph_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,SPELL_POLYMORPH); - Polymorph_Timer = 20000; }else Polymorph_Timer -= diff; - //AoESilence_Timer if (AoESilence_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_AOESILENCE); AoESilence_Timer = 15000 + rand()%5000; }else AoESilence_Timer -= diff; - //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ARCANEEXPLOSION); ArcaneExplosion_Timer = 8000; }else ArcaneExplosion_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -116,7 +97,6 @@ CreatureAI* GetAI_boss_arcanist_doan(Creature* pCreature) { return new boss_arcanist_doanAI (pCreature); } - void AddSC_boss_arcanist_doan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_azshir_the_sleepless.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_azshir_the_sleepless.cpp index 1409b2ff693..4b2a045cb7a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_azshir_the_sleepless.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_azshir_the_sleepless.cpp @@ -13,44 +13,35 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Azshir_the_Sleepless SD%Complete: 80 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - #define SPELL_CALLOFTHEGRAVE 17831 #define SPELL_TERRIFY 7399 #define SPELL_SOULSIPHON 7290 - struct TRINITY_DLL_DECL boss_azshir_the_sleeplessAI : public ScriptedAI { boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {} - uint32 SoulSiphon_Timer; uint32 CallOftheGrave_Timer; uint32 Terrify_Timer; - void Reset() { SoulSiphon_Timer = 1; CallOftheGrave_Timer = 30000; Terrify_Timer = 20000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <50% hp cast Soul Siphon rank 1 if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->IsNonMeleeSpellCasted(false)) { @@ -59,34 +50,28 @@ struct TRINITY_DLL_DECL boss_azshir_the_sleeplessAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_SOULSIPHON); return; - SoulSiphon_Timer = 20000; }else SoulSiphon_Timer -= diff; } - //CallOfTheGrave_Timer if (CallOftheGrave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CALLOFTHEGRAVE); CallOftheGrave_Timer = 30000; }else CallOftheGrave_Timer -= diff; - //Terrify_Timer if (Terrify_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TERRIFY); Terrify_Timer = 20000; }else Terrify_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_azshir_the_sleepless(Creature* pCreature) { return new boss_azshir_the_sleeplessAI (pCreature); } - void AddSC_boss_azshir_the_sleepless() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_bloodmage_thalnos.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_bloodmage_thalnos.cpp index b7cba1ae97a..a3b67ee7e71 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_bloodmage_thalnos.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_bloodmage_thalnos.cpp @@ -13,38 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Bloodmage_Thalnos SD%Complete: 100 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1189016, SAY_HEALTH = -1189017, SAY_KILL = -1189018, - SPELL_FLAMESHOCK = 8053, SPELL_SHADOWBOLT = 1106, SPELL_FLAMESPIKE = 8814, SPELL_FIRENOVA = 16079, }; - struct TRINITY_DLL_DECL boss_bloodmage_thalnosAI : public ScriptedAI { boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {} - bool HpYell; uint32 FlameShock_Timer; uint32 ShadowBolt_Timer; uint32 FlameSpike_Timer; uint32 FireNova_Timer; - void Reset() { HpYell = false; @@ -53,66 +46,55 @@ struct TRINITY_DLL_DECL boss_bloodmage_thalnosAI : public ScriptedAI FlameSpike_Timer = 8000; FireNova_Timer = 40000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit* Victim) { DoScriptText(SAY_KILL, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <35% hp if (!HpYell && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 35)) { DoScriptText(SAY_HEALTH, m_creature); HpYell = true; } - //FlameShock_Timer if (FlameShock_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMESHOCK); FlameShock_Timer = 10000 + rand()%5000; }else FlameShock_Timer -= diff; - //FlameSpike_Timer if (FlameSpike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FLAMESPIKE); FlameSpike_Timer = 30000; }else FlameSpike_Timer -= diff; - //FireNova_Timer if (FireNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIRENOVA); FireNova_Timer = 40000; }else FireNova_Timer -= diff; - //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT); ShadowBolt_Timer = 2000; }else ShadowBolt_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_bloodmage_thalnos(Creature* pCreature) { return new boss_bloodmage_thalnosAI (pCreature); } - void AddSC_boss_bloodmage_thalnos() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp index bce58b42632..bece0e692bd 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Headless_Horseman SD%Complete: SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" #include "SpellMgr.h" #include "def_scarlet_monastery.h" - //this texts are already used by 3975 and 3976 #define SAY_ENTRANCE -1189001 #define SAY_REJOINED -1189002 @@ -33,9 +30,7 @@ EndScriptData */ #define SAY_SPROUTING_PUMPKINS -1189005 #define SAY_PLAYER_DEATH -1189006 #define SAY_DEATH -1189007 - uint32 RandomLaugh[] = {11965, 11975, 11976}; - // Entryes #define HH_MOUNTED 23682 #define HH_UNHORSED 23800 @@ -44,28 +39,23 @@ uint32 RandomLaugh[] = {11965, 11975, 11976}; #define PUMPKIN_FIEND 23545 #define HELPER 23686 #define WISP_INVIS 24034 - //Spells #define SPELL_CLEAVE 42587 #define SPELL_CONFLAGRATION 42380 //Phase 2, can't find real spell(Dim Fire?) //#define SPELL_CONFL_SPEED 22587 //8% increase speed, value 22587 from SPELL_CONFLAGRATION mains that spell? #define SPELL_SUMMON_PUMPKIN 42394 - #define SPELL_WHIRLWIND 43116 #define SPELL_IMMUNE 42556 #define SPELL_BODY_REGEN 42403 #define SPELL_CONFUSE 43105 - #define SPELL_FLYING_HEAD 42399 //visual flying head #define SPELL_HEAD 42413 //visual buff, "head" #define SPELL_HEAD_IS_DEAD 42428 //at killing head, Phase 3 - #define SPELL_PUMPKIN_AURA 42280 #define SPELL_PUMPKIN_AURA_GREEN 42294 #define SPELL_SQUASH_SOUL 42514 #define SPELL_SPROUTING 42281 #define SPELL_SPROUT_BODY 42285 - //Effects #define SPELL_RHYME_BIG 42909 //#define SPELL_RHYME_SMALL 42910 @@ -79,12 +69,10 @@ uint32 RandomLaugh[] = {11965, 11975, 11976}; //#define SPELL_WISP_INVIS 42823 #define SPELL_SMOKE 42355 #define SPELL_DEATH 42566 //not correct spell - struct Locations { float x, y, z; }; - static Locations FlightPoint[]= { {1754.00,1346.00,17.50}, @@ -109,18 +97,15 @@ static Locations FlightPoint[]= {1757.80,1378.20,29.00}, {1758.00,1367.00,19.51} }; - static Locations Spawn[]= { {1776.27,1348.74,19.20}, //spawn point for pumpkin shrine mob {1765.28,1347.46,17.55} //spawn point for smoke }; - struct Summon { const std::string text; }; - static Summon Text[]= { {"Horseman rise..."}, @@ -128,9 +113,7 @@ static Summon Text[]= {"You felt death once..."}, {"Now, know demise!"} }; - #define EMOTE_LAUGHS "laughs" - struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI { mob_wisp_invisAI(Creature *c) : ScriptedAI(c) @@ -144,7 +127,6 @@ struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI if (port) port->rangeIndex = 6; } - uint32 Creaturetype; uint32 delay; uint32 spell; @@ -175,22 +157,18 @@ struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI if (spell) DoCast(m_creature,spell); } - void SpellHit(Unit* caster, const SpellEntry *spell) { if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) m_creature->SetDisplayId(2027); } - void MoveInLineOfSight(Unit *who) { if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) return; - if (m_creature->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL)) DoCast(who,SPELL_SQUASH_SOUL); } - void UpdateAI(const uint32 diff) { if (delay) @@ -205,20 +183,15 @@ struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI { mob_headAI(Creature *c) : ScriptedAI(c) {} - uint64 bodyGUID; - uint32 Phase; uint32 laugh; uint32 wait; - bool withbody; bool die; - void Reset() { Phase = 0; @@ -228,7 +201,6 @@ struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI wait = 1000; laugh = urand(15000,30000); } - void EnterCombat(Unit *who) {} void SaySound(int32 textEntry, Unit *target = 0) { @@ -239,12 +211,10 @@ struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); laugh += 3000; } - void DamageTaken(Unit* done_by,uint32 &damage) { if (withbody) return; - switch(Phase) { case 1: @@ -270,12 +240,10 @@ struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI break; } } - void SpellHit(Unit *caster, const SpellEntry* spell) { if (!withbody) return; - if (spell->Id == SPELL_FLYING_HEAD) { if (Phase < 3) ++Phase; @@ -304,7 +272,6 @@ struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveFleeing(m_creature->getVictim()); } else wait -= diff; - if (laugh < diff) { laugh = urand(15000,30000); @@ -331,7 +298,6 @@ struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI { boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) @@ -347,7 +313,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI /* if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION)) confl->EffectTriggerSpell[1] = 22587; - if (SpellEntry *speed = GET_SPELL(22587)) { speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; @@ -356,17 +321,13 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI */ pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint64 headGUID; uint64 PlayerGUID; - uint32 Phase; uint32 id; uint32 count; uint32 say_timer; - uint32 conflagrate; uint32 summonadds; uint32 cleave; @@ -374,13 +335,11 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI uint32 whirlwind; uint32 laugh; uint32 burn; - bool withhead; bool returned; bool IsFlying; bool wp_reached; bool burned; - void Reset() { Phase = 1; @@ -392,7 +351,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI burn = 6000; count = 0; say_timer = 3000; - withhead = true; returned = true; burned = false; @@ -402,14 +360,11 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI { if (Creature* Head = Unit::GetCreature((*m_creature), headGUID)) Head->DisappearAndDie(); - headGUID = 0; } - if (pInstance) pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED); } - void FlyMode() { m_creature->SetVisibility(VISIBILITY_OFF); @@ -422,14 +377,11 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI id = 0; Phase = 0; } - void MovementInform(uint32 type, uint32 i) { if (type != POINT_MOTION_TYPE || !IsFlying || i != id) return; - wp_reached = true; - switch (id) { case 0: @@ -463,7 +415,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } ++id; } - void EnterCombat(Unit *who) { if (pInstance) @@ -487,30 +438,24 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); } } - void SaySound(int32 textEntry, Unit *target = 0) { DoScriptText(textEntry, m_creature, target); laugh += 4000; } - Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) { Map* pMap = m_creature->GetMap(); if (!pMap->IsDungeon()) return NULL; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); Map::PlayerList::const_iterator i; if (PlayerList.isEmpty()) return NULL; - std::list temp; std::list::iterator j; - - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if ((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() && m_creature->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) temp.push_back(i->getSource()); - if (temp.size()) { j = temp.begin(); @@ -519,13 +464,11 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } return NULL; } - void SpellHitTarget(Unit* unit, const SpellEntry* spell) { if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION)) SaySound(SAY_CONFLAGRATION,unit); } - void JustDied(Unit* killer) { m_creature->StopMoving(); @@ -538,12 +481,10 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); } - void SpellHit(Unit *caster, const SpellEntry* spell) { if (withhead) return; - if (spell->Id == SPELL_FLYING_HEAD) { if (Phase < 3) @@ -560,7 +501,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5)); //DoResetThreat();//not sure if need std::list::iterator itr; - for(itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->isAlive() && pUnit != caster) @@ -568,7 +509,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } } } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth() && withhead) @@ -578,7 +518,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100; m_creature->RemoveAllAuras(); m_creature->SetName("Headless Horseman, Unhorsed"); - if (!headGUID) headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); Unit* Head = Unit::GetUnit((*m_creature), headGUID); @@ -597,7 +536,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (withhead) @@ -672,14 +610,12 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } else summonadds -= diff; break; } - if (laugh < diff) { laugh = urand(11000,22000); m_creature->MonsterTextEmote(EMOTE_LAUGHS,NULL); DoPlaySoundToSet(m_creature, RandomLaugh[rand()%3]); } else laugh -= diff; - if (UpdateVictim()) { DoMeleeAttackIfReady(); @@ -711,7 +647,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } } else regen -= diff; - if (whirlwind < diff) { whirlwind = urand(4000,8000); @@ -726,7 +661,6 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI } } }; - void mob_headAI::Disappear() { if (withbody) @@ -748,14 +682,11 @@ void mob_headAI::Disappear() } } } - struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI { mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {} - bool sprouted; uint64 debuffGUID; - void Reset() { float x, y, z; @@ -775,9 +706,7 @@ struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI DoCast(m_creature,SPELL_SPROUTING); m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); } - void EnterCombat(Unit *who){} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_SPROUTING) @@ -790,7 +719,6 @@ struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI DoStartMovement(m_creature->getVictim()); } } - void Despawn() { if (!debuffGUID) return; @@ -799,26 +727,21 @@ struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI debuff->SetVisibility(VISIBILITY_OFF); debuffGUID = 0; } - void JustDied(Unit *killer) { if (!sprouted) Despawn(); } - void MoveInLineOfSight(Unit *who) { if (!who || !who->isTargetableForAttack() || !m_creature->IsHostileTo(who) || m_creature->getVictim()) return; - m_creature->AddThreat(who,0.0f); if (sprouted) DoStartMovement(who); } - void UpdateAI(const uint32 diff) { if (sprouted && UpdateVictim()) DoMeleeAttackIfReady(); } }; - bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil) { /* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) @@ -837,51 +760,41 @@ bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil) //} return true; } - CreatureAI* GetAI_mob_head(Creature* pCreature) { return new mob_headAI (pCreature); } - CreatureAI* GetAI_boss_headless_horseman(Creature* pCreature) { return new boss_headless_horsemanAI (pCreature); } - CreatureAI* GetAI_mob_pulsing_pumpkin(Creature* pCreature) { return new mob_pulsing_pumpkinAI (pCreature); } - CreatureAI* GetAI_mob_wisp_invis(Creature* pCreature) { return new mob_wisp_invisAI (pCreature); } - void AddSC_boss_headless_horseman() { Script *newscript; - newscript = new Script; newscript->Name = "boss_headless_horseman"; newscript->GetAI = &GetAI_boss_headless_horseman; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_head"; newscript->GetAI = &GetAI_mob_head; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_pulsing_pumpkin"; newscript->GetAI = &GetAI_mob_pulsing_pumpkin; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_wisp_invis"; newscript->GetAI = &GetAI_mob_wisp_invis; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_loosely_turned_soil"; newscript->pGOHello = &GOHello_go_loosely_turned_soil; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp index fc02cad4a2f..5e4a3d31d70 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp @@ -13,70 +13,56 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Herod SD%Complete: 95 SDComment: Should in addition spawn Myrmidons in the hallway outside SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" #include "escort_ai.h" - #define SAY_AGGRO -1189000 #define SAY_WHIRLWIND -1189001 #define SAY_ENRAGE -1189002 #define SAY_KILL -1189003 #define EMOTE_ENRAGE -1189004 - #define SPELL_RUSHINGCHARGE 8260 #define SPELL_CLEAVE 15496 #define SPELL_WHIRLWIND 8989 #define SPELL_FRENZY 8269 - #define ENTRY_SCARLET_TRAINEE 6575 #define ENTRY_SCARLET_MYRMIDON 4295 - struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI { boss_herodAI(Creature *c) : ScriptedAI(c) {} - bool Enrage; - uint32 Cleave_Timer; uint32 Whirlwind_Timer; - void Reset() { Enrage = false; Cleave_Timer = 12000; Whirlwind_Timer = 60000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); DoCast(m_creature,SPELL_RUSHINGCHARGE); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - void JustDied(Unit* killer) { - for(uint8 i = 0; i < 20; ++i) + for (uint8 i = 0; i < 20; ++i) m_creature->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <30% hp goes Enraged if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->IsNonMeleeSpellCasted(false)) { @@ -85,14 +71,12 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI DoCast(m_creature,SPELL_FRENZY); Enrage = true; } - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 12000; }else Cleave_Timer -= diff; - // Whirlwind_Timer if (Whirlwind_Timer < diff) { @@ -100,29 +84,23 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_WHIRLWIND); Whirlwind_Timer = 30000; }else Whirlwind_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_herod(Creature* pCreature) { return new boss_herodAI(pCreature); } - struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI { mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) { Start_Timer = urand(1000,6000); } - uint32 Start_Timer; - void Reset() { } void WaypointReached(uint32 uiPoint) { } void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (Start_Timer) @@ -133,16 +111,13 @@ struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI Start_Timer = 0; }else Start_Timer -= diff; } - npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_mob_scarlet_trainee(Creature* pCreature) { return new mob_scarlet_traineeAI(pCreature); } - void AddSC_boss_herod() { Script *newscript; @@ -150,7 +125,6 @@ void AddSC_boss_herod() newscript->Name = "boss_herod"; newscript->GetAI = &GetAI_boss_herod; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_scarlet_trainee"; newscript->GetAI = &GetAI_mob_scarlet_trainee; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp index 13e9ef4af53..6522510fc13 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_High_Inquisitor_Fairbanks SD%Complete: 100 SDComment: TODO: if this guy not involved in some special event, remove (and let ACID script) SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - enum eSpells { SPELL_CURSEOFBLOOD = 8282, @@ -32,11 +29,9 @@ enum eSpells SPELL_POWERWORDSHIELD = 11647, SPELL_SLEEP = 8399 }; - struct TRINITY_DLL_DECL boss_high_inquisitor_fairbanksAI : public ScriptedAI { boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {} - uint32 CurseOfBlood_Timer; uint32 DispelMagic_Timer; uint32 Fear_Timer; @@ -44,7 +39,6 @@ struct TRINITY_DLL_DECL boss_high_inquisitor_fairbanksAI : public ScriptedAI uint32 Sleep_Timer; uint32 Dispel_Timer; bool PowerWordShield; - void Reset() { CurseOfBlood_Timer = 10000; @@ -55,73 +49,59 @@ struct TRINITY_DLL_DECL boss_high_inquisitor_fairbanksAI : public ScriptedAI Dispel_Timer = 20000; PowerWordShield = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <25% hp cast Heal if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 25 && !m_creature->IsNonMeleeSpellCasted(false) && Heal_Timer < diff) { DoCast(m_creature,SPELL_HEAL); Heal_Timer = 30000; }else Heal_Timer -= diff; - //Fear_Timer if (Fear_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,SPELL_FEAR); - Fear_Timer = 40000; }else Fear_Timer -= diff; - //Sleep_Timer if (Sleep_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,0)) DoCast(target,SPELL_SLEEP); - Sleep_Timer = 30000; }else Sleep_Timer -= diff; - //PowerWordShield_Timer if (!PowerWordShield && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 25) { DoCast(m_creature,SPELL_POWERWORDSHIELD); PowerWordShield = true; } - //Dispel_Timer if (Dispel_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, SPELL_DISPELMAGIC); - DispelMagic_Timer = 30000; }else DispelMagic_Timer -= diff; - //CurseOfBlood_Timer if (CurseOfBlood_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSEOFBLOOD); CurseOfBlood_Timer = 25000; }else CurseOfBlood_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_high_inquisitor_fairbanks(Creature* pCreature) { return new boss_high_inquisitor_fairbanksAI (pCreature); } - void AddSC_boss_high_inquisitor_fairbanks() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_houndmaster_loksey.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_houndmaster_loksey.cpp index 2e79f2449d0..c431cde008b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_houndmaster_loksey.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_houndmaster_loksey.cpp @@ -13,59 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Houndmaster_Loksey SD%Complete: 100 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1189021, SPELL_SUMMONSCARLETHOUND = 17164, SPELL_BLOODLUST = 6742 }; - struct TRINITY_DLL_DECL boss_houndmaster_lokseyAI : public ScriptedAI { boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {} - uint32 BloodLust_Timer; - void Reset() { BloodLust_Timer = 20000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (BloodLust_Timer < diff) { DoCast(m_creature,SPELL_BLOODLUST); BloodLust_Timer = 20000; }else BloodLust_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_houndmaster_loksey(Creature* pCreature) { return new boss_houndmaster_lokseyAI (pCreature); } - void AddSC_boss_houndmaster_loksey() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_interrogator_vishas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_interrogator_vishas.cpp index c0b02a2c370..b50c1a6a023 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_interrogator_vishas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_interrogator_vishas.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Interrogator_Vishas SD%Complete: 100 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" #include "def_scarlet_monastery.h" - enum eEnums { SAY_AGGRO = -1189011, @@ -31,82 +28,66 @@ enum eEnums SAY_HEALTH2 = -1189013, SAY_KILL = -1189014, SAY_TRIGGER_VORREL = -1189015, - SPELL_SHADOWWORDPAIN = 2767, }; - struct TRINITY_DLL_DECL boss_interrogator_vishasAI : public ScriptedAI { boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - bool Yell30; bool Yell60; uint32 ShadowWordPain_Timer; - void Reset() { ShadowWordPain_Timer = 5000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit* Victim) { DoScriptText(SAY_KILL, m_creature); } - void JustDied(Unit* Killer) { if (!pInstance) return; - //Any other actions to do with vorrel? setStandState? if (Unit *vorrel = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_VORREL))) DoScriptText(SAY_TRIGGER_VORREL, vorrel); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are low on hp Do sayings if (!Yell60 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 60)) { DoScriptText(SAY_HEALTH1, m_creature); Yell60 = true; } - if (!Yell30 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 30)) { DoScriptText(SAY_HEALTH2, m_creature); Yell30 = true; } - //ShadowWordPain_Timer if (ShadowWordPain_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWWORDPAIN); ShadowWordPain_Timer = 5000 + rand()%10000;; }else ShadowWordPain_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_interrogator_vishas(Creature* pCreature) { return new boss_interrogator_vishasAI (pCreature); } - void AddSC_boss_interrogator_vishas() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp index 9859f3b8bd7..742b2709e2b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp @@ -13,35 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Mograine_And_Whitemane SD%Complete: 90 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" #include "def_scarlet_monastery.h" - enum eEnums { //Mograine says SAY_MO_AGGRO = -1189005, SAY_MO_KILL = -1189006, SAY_MO_RESSURECTED = -1189007, - //Whitemane says SAY_WH_INTRO = -1189008, SAY_WH_KILL = -1189009, SAY_WH_RESSURECT = -1189010, - //Mograine Spells SPELL_CRUSADERSTRIKE = 14518, SPELL_HAMMEROFJUSTICE = 5589, SPELL_LAYONHANDS = 9257, SPELL_RETRIBUTIONAURA = 8990, - //Whitemanes Spells SPELL_DEEPSLEEP = 9256, SPELL_SCARLETRESURRECTION = 9232, @@ -50,42 +44,33 @@ enum eEnums SPELL_HEAL = 12039, SPELL_POWERWORDSHIELD = 22187 }; - struct TRINITY_DLL_DECL boss_scarlet_commander_mograineAI : public ScriptedAI { boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 m_uiCrusaderStrike_Timer; uint32 m_uiHammerOfJustice_Timer; - bool m_bHasDied; bool m_bHeal; bool m_bFakeDeath; - void Reset() { m_uiCrusaderStrike_Timer = 10000; m_uiHammerOfJustice_Timer = 10000; - //Incase wipe during phase that mograine fake death m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_STAND); - if (m_pInstance) if (m_creature->isAlive()) m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED); - m_bHasDied = false; m_bHeal = false; m_bFakeDeath = false; } - void JustReachedHome() { if (m_pInstance) @@ -94,57 +79,42 @@ struct TRINITY_DLL_DECL boss_scarlet_commander_mograineAI : public ScriptedAI m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); } } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_MO_AGGRO, m_creature); DoCast(m_creature,SPELL_RETRIBUTIONAURA); - m_creature->CallForHelp(VISIBLE_RANGE); } - void KilledUnit(Unit* pVictim) { DoScriptText(SAY_MO_KILL, m_creature); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage < m_creature->GetHealth() || m_bHasDied || m_bFakeDeath) return; - if (!m_pInstance) return; - //On first death, fake death and open door, as well as initiate whitemane if exist if (Unit* Whitemane = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_WHITEMANE))) { m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); - Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786); - m_creature->GetMotionMaster()->MovementExpired(); m_creature->GetMotionMaster()->MoveIdle(); - m_creature->SetHealth(0); - if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - m_creature->ClearComboPointHolders(); m_creature->RemoveAllAuras(); m_creature->ClearAllReactives(); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); - m_bHasDied = true; m_bFakeDeath = true; - uiDamage = 0; } } - void SpellHit(Unit* pWho, const SpellEntry* pSpell) { //When hit with ressurection say text @@ -152,18 +122,15 @@ struct TRINITY_DLL_DECL boss_scarlet_commander_mograineAI : public ScriptedAI { DoScriptText(SAY_MO_RESSURECTED, m_creature); m_bFakeDeath = false; - if (m_pInstance) m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) { //On ressurection, stop fake death and heal whitemane and resume fight @@ -172,94 +139,74 @@ struct TRINITY_DLL_DECL boss_scarlet_commander_mograineAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_STAND); DoCast(Whitemane, SPELL_LAYONHANDS); - m_uiCrusaderStrike_Timer = 10000; m_uiHammerOfJustice_Timer = 10000; - if (m_creature->getVictim()) m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - m_bHeal = true; } } - //This if-check to make sure mograine does not attack while fake death if (m_bFakeDeath) return; - //m_uiCrusaderStrike_Timer if (m_uiCrusaderStrike_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_CRUSADERSTRIKE); m_uiCrusaderStrike_Timer = 10000; }else m_uiCrusaderStrike_Timer -= uiDiff; - //m_uiHammerOfJustice_Timer if (m_uiHammerOfJustice_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_HAMMEROFJUSTICE); m_uiHammerOfJustice_Timer = 60000; }else m_uiHammerOfJustice_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_high_inquisitor_whitemaneAI : public ScriptedAI { boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 m_uiHeal_Timer; uint32 m_uiPowerWordShield_Timer; uint32 m_uiHolySmite_Timer; uint32 m_uiWait_Timer; - bool m_bCanResurrectCheck; bool m_bCanResurrect; - void Reset() { m_uiWait_Timer = 7000; m_uiHeal_Timer = 10000; m_uiPowerWordShield_Timer = 15000; m_uiHolySmite_Timer = 6000; - m_bCanResurrectCheck = false; m_bCanResurrect = false; - if (m_pInstance) if (m_creature->isAlive()) m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); } - void AttackStart(Unit* pWho) { if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED) return; - ScriptedAI::AttackStart(pWho); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_WH_INTRO, m_creature); } - void KilledUnit(Unit* pVictim) { DoScriptText(SAY_WH_KILL, m_creature); } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - if (m_bCanResurrect) { //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out @@ -274,31 +221,25 @@ struct TRINITY_DLL_DECL boss_high_inquisitor_whitemaneAI : public ScriptedAI } else m_uiWait_Timer -= uiDiff; } - //Cast Deep sleep when health is less than 50% if (!m_bCanResurrectCheck && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature->getVictim(), SPELL_DEEPSLEEP); m_bCanResurrectCheck = true; m_bCanResurrect = true; return; } - //while in "resurrect-mode", don't do anything if (m_bCanResurrect) return; - //If we are <75% hp cast healing spells at self or Mograine if (m_uiHeal_Timer < uiDiff) { Creature* pTarget = NULL; - if (m_creature->GetHealth() <= m_creature->GetMaxHealth()*0.75f) pTarget = m_creature; - if (m_pInstance) { if (Creature* pMograine = Unit::GetCreature((*m_creature), m_pInstance->GetData64(DATA_MOGRAINE))) @@ -308,50 +249,40 @@ struct TRINITY_DLL_DECL boss_high_inquisitor_whitemaneAI : public ScriptedAI pTarget = pMograine; } } - if (pTarget) DoCast(pTarget, SPELL_HEAL); - m_uiHeal_Timer = 13000; }else m_uiHeal_Timer -= uiDiff; - //m_uiPowerWordShield_Timer if (m_uiPowerWordShield_Timer < uiDiff) { DoCast(m_creature,SPELL_POWERWORDSHIELD); m_uiPowerWordShield_Timer = 15000; }else m_uiPowerWordShield_Timer -= uiDiff; - //m_uiHolySmite_Timer if (m_uiHolySmite_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_HOLYSMITE); m_uiHolySmite_Timer = 6000; }else m_uiHolySmite_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_scarlet_commander_mograine(Creature* pCreature) { return new boss_scarlet_commander_mograineAI (pCreature); } - CreatureAI* GetAI_boss_high_inquisitor_whitemane(Creature* pCreature) { return new boss_high_inquisitor_whitemaneAI (pCreature); } - void AddSC_boss_mograine_and_whitemane() { Script *newscript; - newscript = new Script; newscript->Name = "boss_scarlet_commander_mograine"; newscript->GetAI = &GetAI_boss_scarlet_commander_mograine; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_high_inquisitor_whitemane"; newscript->GetAI = &GetAI_boss_high_inquisitor_whitemane; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_scorn.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_scorn.cpp index 0b0b5114f92..9d5d99a9a83 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_scorn.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_scorn.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Scorn SD%Complete: 100 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" - #define SPELL_LICHSLAP 28873 #define SPELL_FROSTBOLTVOLLEY 8398 #define SPELL_MINDFLAY 17313 #define SPELL_FROSTNOVA 15531 - struct TRINITY_DLL_DECL boss_scornAI : public ScriptedAI { boss_scornAI(Creature *c) : ScriptedAI(c) {} - uint32 LichSlap_Timer; uint32 FrostboltVolley_Timer; uint32 MindFlay_Timer; uint32 FrostNova_Timer; - void Reset() { LichSlap_Timer = 45000; @@ -44,44 +38,37 @@ struct TRINITY_DLL_DECL boss_scornAI : public ScriptedAI MindFlay_Timer = 30000; FrostNova_Timer = 30000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //LichSlap_Timer if (LichSlap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_LICHSLAP); LichSlap_Timer = 45000; }else LichSlap_Timer -= diff; - //FrostboltVolley_Timer if (FrostboltVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBOLTVOLLEY); FrostboltVolley_Timer = 20000; }else FrostboltVolley_Timer -= diff; - //MindFlay_Timer if (MindFlay_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MINDFLAY); MindFlay_Timer = 20000; }else MindFlay_Timer -= diff; - //FrostNova_Timer if (FrostNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTNOVA); FrostNova_Timer = 15000; }else FrostNova_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -89,7 +76,6 @@ CreatureAI* GetAI_boss_scorn(Creature* pCreature) { return new boss_scornAI (pCreature); } - void AddSC_boss_scorn() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/def_scarlet_monastery.h b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/def_scarlet_monastery.h index 2b6399ae3e4..e92d0cd9cad 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/def_scarlet_monastery.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/def_scarlet_monastery.h @@ -1,18 +1,14 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SCARLET_M #define DEF_SCARLET_M - #define TYPE_MOGRAINE_AND_WHITE_EVENT 1 #define DATA_MOGRAINE 2 #define DATA_WHITEMANE 3 #define DATA_DOOR_WHITEMANE 4 - #define DATA_HORSEMAN_EVENT 5 #define GAMEOBJECT_PUMPKIN_SHRINE 6 - #define DATA_VORREL 7 #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/instance_scarlet_monastery.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/instance_scarlet_monastery.cpp index 492493e2390..6b0e0098f80 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/instance_scarlet_monastery.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/instance_scarlet_monastery.cpp @@ -13,56 +13,44 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Scarlet_Monastery SD%Complete: 50 SDComment: SDCategory: Scarlet Monastery EndScriptData */ - #include "precompiled.h" #include "def_scarlet_monastery.h" #include "sc_creature.h" - #define ENTRY_PUMPKIN_SHRINE 186267 #define ENTRY_HORSEMAN 23682 #define ENTRY_HEAD 23775 #define ENTRY_PUMPKIN 23694 - #define MAX_ENCOUNTER 1 - struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance { instance_scarlet_monastery(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 PumpkinShrineGUID; uint64 HorsemanGUID; uint64 HeadGUID; std::set HorsemanAdds; - uint64 MograineGUID; uint64 WhitemaneGUID; uint64 VorrelGUID; uint64 DoorHighInquisitorGUID; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - PumpkinShrineGUID = 0; HorsemanGUID = 0; HeadGUID = 0; HorsemanAdds.clear(); - MograineGUID = 0; WhitemaneGUID = 0; VorrelGUID = 0; DoorHighInquisitorGUID = 0; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -71,7 +59,6 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -84,7 +71,6 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance case 3981: VorrelGUID = pCreature->GetGUID(); break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -94,7 +80,6 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance DoUseDoorOrButton(DoorHighInquisitorGUID); if (data == FAIL) DoUseDoorOrButton(DoorHighInquisitorGUID); - m_auiEncounter[0] = data; break; case GAMEOBJECT_PUMPKIN_SHRINE: @@ -103,7 +88,7 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance case DATA_HORSEMAN_EVENT: if (data == DONE) { - for(std::set::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) + for (std::set::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) { Creature* add = instance->GetCreature(*itr); if (add && add->isAlive()) @@ -115,7 +100,6 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance break; } } - uint64 GetData64(uint32 type) { switch(type) @@ -130,21 +114,17 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance } return 0; } - uint32 GetData(uint32 type) { if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) return m_auiEncounter[0]; - return 0; } }; - InstanceData* GetInstanceData_instance_scarlet_monastery(Map* pMap) { return new instance_scarlet_monastery(pMap); } - void AddSC_instance_scarlet_monastery() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_darkmaster_gandling.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_darkmaster_gandling.cpp index b064a1d9e10..7ad9a5a67bf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_darkmaster_gandling.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_darkmaster_gandling.cpp @@ -13,57 +13,45 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Darkmaster_Gandling SD%Complete: 75 SDComment: Doors missing in instance script. SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_ARCANEMISSILES 22272 #define SPELL_SHADOWSHIELD 22417 //Not right ID. But 12040 is wrong either. #define SPELL_CURSE 18702 - #define ADD_1X 170.205 #define ADD_1Y 99.413 #define ADD_1Z 104.733 #define ADD_1O 3.16 - #define ADD_2X 170.813 #define ADD_2Y 97.857 #define ADD_2Z 104.713 #define ADD_2O 3.16 - #define ADD_3X 170.720 #define ADD_3Y 100.900 #define ADD_3Z 104.739 #define ADD_3O 3.16 - #define ADD_4X 171.866 #define ADD_4Y 99.373 #define ADD_4Z 104.732 #define ADD_4O 3.16 - struct TRINITY_DLL_DECL boss_darkmaster_gandlingAI : public ScriptedAI { boss_darkmaster_gandlingAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 ArcaneMissiles_Timer; uint32 ShadowShield_Timer; uint32 Curse_Timer; uint32 Teleport_Timer; - Creature *Summoned; - void Reset() { ArcaneMissiles_Timer = 4500; @@ -71,43 +59,36 @@ struct TRINITY_DLL_DECL boss_darkmaster_gandlingAI : public ScriptedAI Curse_Timer = 2000; Teleport_Timer = 16000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit *killer) { if (pInstance) pInstance->SetData(TYPE_GANDLING, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ArcaneMissiles_Timer if (ArcaneMissiles_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ARCANEMISSILES); ArcaneMissiles_Timer = 8000; }else ArcaneMissiles_Timer -= diff; - //ShadowShield_Timer if (ShadowShield_Timer < diff) { DoCast(m_creature,SPELL_SHADOWSHIELD); ShadowShield_Timer = 14000 + rand()%14000; }else ShadowShield_Timer -= diff; - //Curse_Timer if (Curse_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSE); Curse_Timer = 15000 + rand()%12000; }else Curse_Timer -= diff; - //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 3) @@ -120,7 +101,6 @@ struct TRINITY_DLL_DECL boss_darkmaster_gandlingAI : public ScriptedAI { if (DoGetThreat(target)) DoModifyThreatPercent(target, -100); - switch(rand()%6) { case 0: @@ -206,7 +186,6 @@ struct TRINITY_DLL_DECL boss_darkmaster_gandlingAI : public ScriptedAI Teleport_Timer = 20000 + rand()%15000; }else Teleport_Timer -= diff; } - DoMeleeAttackIfReady(); } }; @@ -214,7 +193,6 @@ CreatureAI* GetAI_boss_darkmaster_gandling(Creature* pCreature) { return new boss_darkmaster_gandlingAI (pCreature); } - void AddSC_boss_darkmaster_gandling() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_death_knight_darkreaver.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_death_knight_darkreaver.cpp index 9144542ae7e..bab59bf0638 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_death_knight_darkreaver.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_death_knight_darkreaver.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Death_knight_darkreaver SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" - struct TRINITY_DLL_DECL boss_death_knight_darkreaverAI : public ScriptedAI { boss_death_knight_darkreaverAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void DamageTaken(Unit *done_by, uint32 &damage) { if (m_creature->GetHealth() <= damage) @@ -38,7 +33,6 @@ struct TRINITY_DLL_DECL boss_death_knight_darkreaverAI : public ScriptedAI m_creature->CastSpell(m_creature,23261,true); //Summon Darkreaver's Fallen Charger } } - void EnterCombat(Unit *who) { } @@ -47,11 +41,9 @@ CreatureAI* GetAI_boss_death_knight_darkreaver(Creature* pCreature) { return new boss_death_knight_darkreaverAI (pCreature); } - void AddSC_boss_death_knight_darkreaver() { Script *newscript; - newscript = new Script; newscript->Name = "boss_death_knight_darkreaver"; newscript->GetAI = &GetAI_boss_death_knight_darkreaver; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp index 51ace6a6e21..0ec2492eb39 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp @@ -13,58 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Doctor_Theolen_Krastinov SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - enum eEnums { EMOTE_GENERIC_FRENZY_KILL = -1000001, - SPELL_REND = 16509, SPELL_BACKHAND = 18103, SPELL_FRENZY = 8269 }; - struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI { boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiRend_Timer; uint32 m_uiBackhand_Timer; uint32 m_uiFrenzy_Timer; - void Reset() { m_uiRend_Timer = 8000; m_uiBackhand_Timer = 9000; m_uiFrenzy_Timer = 1000; } - void JustDied(Unit* pKiller) { ScriptedInstance* pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //Rend_Timer if (m_uiRend_Timer < uiDiff) { @@ -73,7 +62,6 @@ struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI } else m_uiRend_Timer -= uiDiff; - //Backhand_Timer if (m_uiBackhand_Timer < uiDiff) { @@ -82,7 +70,6 @@ struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI } else m_uiBackhand_Timer -= uiDiff; - //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26) { @@ -90,22 +77,18 @@ struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI { DoCast(m_creature,SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - m_uiFrenzy_Timer = 120000; } else m_uiFrenzy_Timer -= uiDiff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_theolenkrastinov(Creature* pCreature) { return new boss_theolenkrastinovAI (pCreature); } - void AddSC_boss_theolenkrastinov() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_illucia_barov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_illucia_barov.cpp index c6bb471f6f0..d37a8668a89 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_illucia_barov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_illucia_barov.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Illucia_Barov SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_CURSEOFAGONY 18671 #define SPELL_SHADOWSHOCK 20603 #define SPELL_SILENCE 15487 #define SPELL_FEAR 6215 - struct TRINITY_DLL_DECL boss_illuciabarovAI : public ScriptedAI { boss_illuciabarovAI(Creature *c) : ScriptedAI(c) {} - uint32 CurseOfAgony_Timer; uint32 ShadowShock_Timer; uint32 Silence_Timer; uint32 Fear_Timer; - void Reset() { CurseOfAgony_Timer = 18000; @@ -45,59 +39,49 @@ struct TRINITY_DLL_DECL boss_illuciabarovAI : public ScriptedAI Silence_Timer = 5000; Fear_Timer = 30000; } - void JustDied(Unit *killer) { ScriptedInstance *pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //CurseOfAgony_Timer if (CurseOfAgony_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSEOFAGONY); CurseOfAgony_Timer = 30000; }else CurseOfAgony_Timer -= diff; - //ShadowShock_Timer if (ShadowShock_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_SHADOWSHOCK); - ShadowShock_Timer = 12000; }else ShadowShock_Timer -= diff; - //Silence_Timer if (Silence_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); Silence_Timer = 14000; }else Silence_Timer -= diff; - //Fear_Timer if (Fear_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FEAR); Fear_Timer = 30000; }else Fear_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -105,7 +89,6 @@ CreatureAI* GetAI_boss_illuciabarov(Creature* pCreature) { return new boss_illuciabarovAI (pCreature); } - void AddSC_boss_illuciabarov() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_instructor_malicia.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_instructor_malicia.cpp index 866a2f4dfbc..2b8f7ac2a41 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_instructor_malicia.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_instructor_malicia.cpp @@ -13,27 +13,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_instructormalicia SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_CALLOFGRAVES 17831 #define SPELL_CORRUPTION 11672 #define SPELL_FLASHHEAL 10917 #define SPELL_RENEW 10929 #define SPELL_HEALINGTOUCH 9889 - struct TRINITY_DLL_DECL boss_instructormaliciaAI : public ScriptedAI { boss_instructormaliciaAI(Creature *c) : ScriptedAI(c) {} - uint32 CallOfGraves_Timer; uint32 Corruption_Timer; uint32 FlashHeal_Timer; @@ -41,7 +36,6 @@ struct TRINITY_DLL_DECL boss_instructormaliciaAI : public ScriptedAI uint32 HealingTouch_Timer; uint32 FlashCounter; uint32 TouchCounter; - void Reset() { CallOfGraves_Timer = 4000; @@ -52,57 +46,47 @@ struct TRINITY_DLL_DECL boss_instructormaliciaAI : public ScriptedAI FlashCounter = 0; TouchCounter = 0; } - void JustDied(Unit *killer) { ScriptedInstance *pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //CallOfGraves_Timer if (CallOfGraves_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CALLOFGRAVES); CallOfGraves_Timer = 65000; }else CallOfGraves_Timer -= diff; - //Corruption_Timer if (Corruption_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_CORRUPTION); - Corruption_Timer = 24000; }else Corruption_Timer -= diff; - //Renew_Timer if (Renew_Timer < diff) { DoCast(m_creature, SPELL_RENEW); Renew_Timer = 10000; }else Renew_Timer -= diff; - //FlashHeal_Timer if (FlashHeal_Timer < diff) { DoCast(m_creature,SPELL_FLASHHEAL); - //5 Flashheals will be casted if (FlashCounter < 2) { @@ -115,12 +99,10 @@ struct TRINITY_DLL_DECL boss_instructormaliciaAI : public ScriptedAI FlashHeal_Timer = 30000; } }else FlashHeal_Timer -= diff; - //HealingTouch_Timer if (HealingTouch_Timer < diff) { DoCast(m_creature,SPELL_HEALINGTOUCH); - //3 Healingtouchs will be casted if (HealingTouch_Timer < 2) { @@ -133,7 +115,6 @@ struct TRINITY_DLL_DECL boss_instructormaliciaAI : public ScriptedAI HealingTouch_Timer = 30000; } }else HealingTouch_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -141,7 +122,6 @@ CreatureAI* GetAI_boss_instructormalicia(Creature* pCreature) { return new boss_instructormaliciaAI (pCreature); } - void AddSC_boss_instructormalicia() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp index 7d304445fdc..328cf01be4f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp @@ -13,26 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_jandicebarov SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" - #define SPELL_CURSEOFBLOOD 24673 //#define SPELL_ILLUSION 17773 - //Spells of Illusion of Jandice Barov #define SPELL_CLEAVE 15584 - struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI { boss_jandicebarovAI(Creature *c) : ScriptedAI(c) {} - uint32 CurseOfBlood_Timer; uint32 Illusion_Timer; //uint32 Illusioncounter; @@ -42,7 +36,6 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI int RandX; int RandY; Creature* Summoned; - void Reset() { CurseOfBlood_Timer = 15000; @@ -50,11 +43,9 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI Invisible_Timer = 3000; //Too much too low? Invisible = false; } - void EnterCombat(Unit *who) { } - void SummonIllusions(Unit* victim) { Rand = rand()%10; @@ -75,7 +66,6 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI if (Summoned) (Summoned->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { if (Invisible && Invisible_Timer < diff) @@ -91,35 +81,29 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI //Do nothing while invisible return; } - //Return since we have no target if (!UpdateVictim()) return; - //CurseOfBlood_Timer if (CurseOfBlood_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_CURSEOFBLOOD); - //45 seconds CurseOfBlood_Timer = 30000; }else CurseOfBlood_Timer -= diff; - //Illusion_Timer if (!Invisible && Illusion_Timer < diff) { - //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetDisplayId(11686); // Invisible Model DoModifyThreatPercent(m_creature->getVictim(),-99); - //Summon 10 Illusions attacking random gamers Unit* target = NULL; - for(uint8 i = 0; i < 10; ++i) + for (uint8 i = 0; i < 10; ++i) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) @@ -127,12 +111,10 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI } Invisible = true; Invisible_Timer = 3000; - //25 seconds until we should cast this agian Illusion_Timer = 25000; }else Illusion_Timer -= diff; - // //Illusion_Timer // if (Illusion_Timer < diff) // { @@ -152,61 +134,48 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI // } // // }else Illusion_Timer -= diff; - DoMeleeAttackIfReady(); } }; - // Illusion of Jandice Barov Script - struct TRINITY_DLL_DECL mob_illusionofjandicebarovAI : public ScriptedAI { mob_illusionofjandicebarovAI(Creature *c) : ScriptedAI(c) {} - uint32 Cleave_Timer; - void Reset() { Cleave_Timer = 2000 + rand()%6000; m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Cleave_Timer if (Cleave_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_CLEAVE); - //5-8 seconds Cleave_Timer = 5000 + rand()%3000; }else Cleave_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_jandicebarov(Creature* pCreature) { return new boss_jandicebarovAI (pCreature); } - CreatureAI* GetAI_mob_illusionofjandicebarov(Creature* pCreature) { return new mob_illusionofjandicebarovAI (pCreature); } - void AddSC_boss_jandicebarov() { Script *newscript; @@ -214,7 +183,6 @@ void AddSC_boss_jandicebarov() newscript->Name = "boss_jandice_barov"; newscript->GetAI = &GetAI_boss_jandicebarov; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_illusionofjandicebarov"; newscript->GetAI = &GetAI_mob_illusionofjandicebarov; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp index 753f1969f7f..d5793b24e98 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp @@ -13,23 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kormok SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" - #define SPELL_SHADOWBOLTVOLLEY 20741 #define SPELL_BONESHIELD 27688 - struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI { boss_kormokAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowVolley_Timer; uint32 BoneShield_Timer; uint32 Minion_Timer; @@ -43,7 +38,6 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI int Rand2Y; Creature* SummonedMinions; Creature* SummonedMages; - void Reset() { ShadowVolley_Timer = 10000; @@ -52,11 +46,9 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI Mage_Timer = 0; Mages = false; } - void EnterCombat(Unit *who) { } - void SummonMinion(Unit* victim) { Rand1 = rand()%8; @@ -77,7 +69,6 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI if (SummonedMinions) (SummonedMinions->AI())->AttackStart(victim); } - void SummonMages(Unit* victim) { Rand2 = rand()%10; @@ -98,26 +89,22 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI if (SummonedMages) (SummonedMages->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowVolley_Timer if (ShadowVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOWBOLTVOLLEY); ShadowVolley_Timer = 15000; }else ShadowVolley_Timer -= diff; - //BoneShield_Timer if (BoneShield_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BONESHIELD); BoneShield_Timer = 45000; }else BoneShield_Timer -= diff; - //Minion_Timer if (Minion_Timer < diff) { @@ -126,10 +113,8 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI SummonMinion(m_creature->getVictim()); SummonMinion(m_creature->getVictim()); SummonMinion(m_creature->getVictim()); - Minion_Timer = 12000; }else Minion_Timer -= diff; - //Summon 2 Bone Mages if (!Mages && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26) { @@ -138,7 +123,6 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI SummonMages(m_creature->getVictim()); Mages = true; } - DoMeleeAttackIfReady(); } }; @@ -146,7 +130,6 @@ CreatureAI* GetAI_boss_kormok(Creature* pCreature) { return new boss_kormokAI (pCreature); } - void AddSC_boss_kormok() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lord_alexei_barov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lord_alexei_barov.cpp index 41f771471db..5b777130b32 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lord_alexei_barov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lord_alexei_barov.cpp @@ -13,73 +13,58 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Lord_Alexei_Barov SD%Complete: 100 SDComment: aura applied/defined in database SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_IMMOLATE 20294 // Old ID was 15570 #define SPELL_VEILOFSHADOW 17820 - struct TRINITY_DLL_DECL boss_lordalexeibarovAI : public ScriptedAI { boss_lordalexeibarovAI(Creature *c) : ScriptedAI(c) {} - uint32 Immolate_Timer; uint32 VeilofShadow_Timer; - void Reset() { Immolate_Timer = 7000; VeilofShadow_Timer = 15000; - m_creature->LoadCreaturesAddon(); } - void JustDied(Unit *killer) { ScriptedInstance *pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Immolate_Timer if (Immolate_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_IMMOLATE); - Immolate_Timer = 12000; }else Immolate_Timer -= diff; - //VeilofShadow_Timer if (VeilofShadow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_VEILOFSHADOW); VeilofShadow_Timer = 20000; }else VeilofShadow_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -87,7 +72,6 @@ CreatureAI* GetAI_boss_lordalexeibarov(Creature* pCreature) { return new boss_lordalexeibarovAI (pCreature); } - void AddSC_boss_lordalexeibarov() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lorekeeper_polkelt.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lorekeeper_polkelt.cpp index 695d907fca5..a2b9e017eb1 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_lorekeeper_polkelt.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Lorekeeper_Polkelt SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_VOLATILEINFECTION 24928 #define SPELL_DARKPLAGUE 18270 #define SPELL_CORROSIVEACID 23313 #define SPELL_NOXIOUSCATALYST 18151 - struct TRINITY_DLL_DECL boss_lorekeeperpolkeltAI : public ScriptedAI { boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {} - uint32 VolatileInfection_Timer; uint32 Darkplague_Timer; uint32 CorrosiveAcid_Timer; uint32 NoxiousCatalyst_Timer; - void Reset() { VolatileInfection_Timer = 38000; @@ -45,56 +39,47 @@ struct TRINITY_DLL_DECL boss_lorekeeperpolkeltAI : public ScriptedAI CorrosiveAcid_Timer = 45000; NoxiousCatalyst_Timer = 35000; } - void JustDied(Unit *killer) { ScriptedInstance *pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //VolatileInfection_Timer if (VolatileInfection_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_VOLATILEINFECTION); VolatileInfection_Timer = 32000; }else VolatileInfection_Timer -= diff; - //Darkplague_Timer if (Darkplague_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DARKPLAGUE); Darkplague_Timer = 8000; }else Darkplague_Timer -= diff; - //CorrosiveAcid_Timer if (CorrosiveAcid_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CORROSIVEACID); CorrosiveAcid_Timer = 25000; }else CorrosiveAcid_Timer -= diff; - //NoxiousCatalyst_Timer if (NoxiousCatalyst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_NOXIOUSCATALYST); NoxiousCatalyst_Timer = 38000; }else NoxiousCatalyst_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -102,7 +87,6 @@ CreatureAI* GetAI_boss_lorekeeperpolkelt(Creature* pCreature) { return new boss_lorekeeperpolkeltAI (pCreature); } - void AddSC_boss_lorekeeperpolkelt() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_ras_frostwhisper.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_ras_frostwhisper.cpp index 0659ab2da4d..2a2e34e137a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_ras_frostwhisper.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_ras_frostwhisper.cpp @@ -13,34 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ras_Frostwhisper SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" - #define SPELL_FROSTBOLT 21369 #define SPELL_ICEARMOR 18100 //This is actually a buff he gives himself #define SPELL_FREEZE 18763 #define SPELL_FEAR 26070 #define SPELL_CHILLNOVA 18099 #define SPELL_FROSTVOLLEY 8398 - struct TRINITY_DLL_DECL boss_rasfrostAI : public ScriptedAI { boss_rasfrostAI(Creature *c) : ScriptedAI(c) {} - uint32 IceArmor_Timer; uint32 Frostbolt_Timer; uint32 Freeze_Timer; uint32 Fear_Timer; uint32 ChillNova_Timer; uint32 FrostVolley_Timer; - void Reset() { IceArmor_Timer = 2000; @@ -49,64 +43,53 @@ struct TRINITY_DLL_DECL boss_rasfrostAI : public ScriptedAI Freeze_Timer = 18000; FrostVolley_Timer = 24000; Fear_Timer = 45000; - m_creature->CastSpell(m_creature,SPELL_ICEARMOR,true); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //IceArmor_Timer if (IceArmor_Timer < diff) { DoCast(m_creature, SPELL_ICEARMOR); IceArmor_Timer = 180000; }else IceArmor_Timer -= diff; - //Frostbolt_Timer if (Frostbolt_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_FROSTBOLT); - Frostbolt_Timer = 8000; }else Frostbolt_Timer -= diff; - //Freeze_Timer if (Freeze_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FREEZE); Freeze_Timer = 24000; }else Freeze_Timer -= diff; - //Fear_Timer if (Fear_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FEAR); Fear_Timer = 30000; }else Fear_Timer -= diff; - //ChillNova_Timer if (ChillNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CHILLNOVA); ChillNova_Timer = 14000; }else ChillNova_Timer -= diff; - //FrostVolley_Timer if (FrostVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTVOLLEY); FrostVolley_Timer = 15000; }else FrostVolley_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -114,7 +97,6 @@ CreatureAI* GetAI_boss_rasfrost(Creature* pCreature) { return new boss_rasfrostAI (pCreature); } - void AddSC_boss_rasfrost() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_the_ravenian.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_the_ravenian.cpp index aae06c8d27a..01479e575cb 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_the_ravenian.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_the_ravenian.cpp @@ -13,32 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_the_ravenian SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define SPELL_TRAMPLE 15550 #define SPELL_CLEAVE 20691 #define SPELL_SUNDERINCLEAVE 25174 #define SPELL_KNOCKAWAY 10101 - struct TRINITY_DLL_DECL boss_theravenianAI : public ScriptedAI { boss_theravenianAI(Creature *c) : ScriptedAI(c) {} - uint32 Trample_Timer; uint32 Cleave_Timer; uint32 SunderingCleave_Timer; uint32 KnockAway_Timer; bool HasYelled; - void Reset() { Trample_Timer = 24000; @@ -47,65 +41,54 @@ struct TRINITY_DLL_DECL boss_theravenianAI : public ScriptedAI KnockAway_Timer = 32000; HasYelled = false; } - void JustDied(Unit *killer) { ScriptedInstance *pInstance = m_creature->GetInstanceData(); if (pInstance) { pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) m_creature->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Trample_Timer if (Trample_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TRAMPLE); Trample_Timer = 10000; }else Trample_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //SunderingCleave_Timer if (SunderingCleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUNDERINCLEAVE); SunderingCleave_Timer = 20000; }else SunderingCleave_Timer -= diff; - //KnockAway_Timer if (KnockAway_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKAWAY); KnockAway_Timer = 12000; }else KnockAway_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_theravenian(Creature* pCreature) { return new boss_theravenianAI (pCreature); } - void AddSC_boss_theravenian() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp index f3eef33d24a..e20ecf20b2f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp @@ -13,46 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Vectus SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" - enum eEnums { EMOTE_GENERIC_FRENZY_KILL = -1000001, - SPELL_FLAMESTRIKE = 18399, SPELL_BLAST_WAVE = 16046, SPELL_FIRESHIELD = 19626, SPELL_FRENZY = 8269 //28371, }; - struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI { boss_vectusAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiFireShield_Timer; uint32 m_uiBlastWave_Timer; uint32 m_uiFrenzy_Timer; - void Reset() { m_uiFireShield_Timer = 2000; m_uiBlastWave_Timer = 14000; m_uiFrenzy_Timer = 0; } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //FireShield_Timer if (m_uiFireShield_Timer < uiDiff) { @@ -61,7 +52,6 @@ struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI } else m_uiFireShield_Timer -= uiDiff; - //BlastWave_Timer if (m_uiBlastWave_Timer < uiDiff) { @@ -70,7 +60,6 @@ struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI } else m_uiBlastWave_Timer -= uiDiff; - //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25) { @@ -78,22 +67,18 @@ struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI { DoCast(m_creature, SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - m_uiFrenzy_Timer = 24000; } else m_uiFrenzy_Timer -= uiDiff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_vectus(Creature* pCreature) { return new boss_vectusAI (pCreature); } - void AddSC_boss_vectus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/def_scholomance.h b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/def_scholomance.h index 83ce26c9687..beaae92bee8 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/def_scholomance.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/def_scholomance.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SCHOLOMANCE_H #define DEF_SCHOLOMANCE_H - #define TYPE_GANDLING 1 #define DATA_DOCTORTHEOLENKRASTINOV_DEATH 2 #define DATA_INSTRUCTORMALICIA_DEATH 3 diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/instance_scholomance.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/instance_scholomance.cpp index 282d6e9705a..4a56bf215f1 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/instance_scholomance.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/instance_scholomance.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Scholomance SD%Complete: 100 SDComment: SDCategory: Scholomance EndScriptData */ - #include "precompiled.h" #include "def_scholomance.h" - #define GO_GATE_KIRTONOS 175570 #define GO_GATE_GANDLING 177374 #define GO_GATE_MALICIA 177375 @@ -32,17 +29,13 @@ EndScriptData */ #define GO_GATE_RAVENIAN 177372 #define GO_GATE_BAROV 177373 #define GO_GATE_ILLUCIA 177371 - #define MAX_ENCOUNTER 2 - struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance { instance_scholomance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - //Lord Alexei Barov, Doctor Theolen Krastinov, The Ravenian, Lorekeeper Polkelt, Instructor Malicia and the Lady Illucia Barov. bool IsBossDied[6]; uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 GateKirtonosGUID; uint64 GateGandlingGUID; uint64 GateMiliciaGUID; @@ -51,11 +44,9 @@ struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance uint64 GateRavenianGUID; uint64 GateBarovGUID; uint64 GateIlluciaGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - GateKirtonosGUID = 0; GateGandlingGUID = 0; GateMiliciaGUID = 0; @@ -64,11 +55,9 @@ struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance GateRavenianGUID = 0; GateBarovGUID = 0; GateIlluciaGUID = 0; - - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) IsBossDied[i] = false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -83,7 +72,6 @@ struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance case GO_GATE_ILLUCIA: GateIlluciaGUID = pGo->GetGUID(); break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -114,7 +102,6 @@ struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance break; } } - uint32 GetData(uint32 type) { if (type == TYPE_GANDLING) @@ -125,16 +112,13 @@ struct TRINITY_DLL_DECL instance_scholomance : public ScriptedInstance return IN_PROGRESS; } } - return 0; } }; - InstanceData* GetInstanceData_instance_scholomance(Map* pMap) { return new instance_scholomance(pMap); } - void AddSC_instance_scholomance() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp index c6e18761ded..a2797da6dbe 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp @@ -13,43 +13,33 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Searing_Gorge SD%Complete: 80 SDComment: Quest support: 3377, 3441 (More accurate info on Kalaran needed). Lothos Riftwaker teleport to Molten Core. SDCategory: Searing Gorge EndScriptData */ - /* ContentData npc_kalaran_windblade npc_lothos_riftwaker npc_zamael_lunthistle EndContentData */ - #include "precompiled.h" - /*###### ## npc_kalaran_windblade ######*/ - #define GOSSIP_HELLO_KW "Tell me what drives this vengance?" #define GOSSIP_SELECT_KW1 "Continue please" #define GOSSIP_SELECT_KW2 "Let me confer with my colleagues" - bool GossipHello_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(3441) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -69,26 +59,19 @@ bool GossipSelect_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## npc_lothos_riftwaker ######*/ - #define GOSSIP_HELLO_LR "Teleport me to the Molten Core" - bool GossipHello_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -96,31 +79,23 @@ bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature, uin pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->TeleportTo(409, 1096, -467, -104.6, 3.64); } - return true; } - /*###### ## npc_zamael_lunthistle ######*/ - #define GOSSIP_HELLO_ZL "Tell me your story" #define GOSSIP_SELECT_ZL1 "Please continue..." #define GOSSIP_SELECT_ZL2 "Goodbye" - bool GossipHello_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(3377) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ZL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(1920, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -140,27 +115,22 @@ bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## ######*/ - void AddSC_searing_gorge() { Script *newscript; - newscript = new Script; newscript->Name = "npc_kalaran_windblade"; newscript->pGossipHello = &GossipHello_npc_kalaran_windblade; newscript->pGossipSelect = &GossipSelect_npc_kalaran_windblade; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lothos_riftwaker"; newscript->pGossipHello = &GossipHello_npc_lothos_riftwaker; newscript->pGossipSelect = &GossipSelect_npc_lothos_riftwaker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_zamael_lunthistle"; newscript->pGossipHello = &GossipHello_npc_zamael_lunthistle; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/def_shadowfang_keep.h b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/def_shadowfang_keep.h index 8383a5c3950..d3a2dce833e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/def_shadowfang_keep.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/def_shadowfang_keep.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SHADOWFANG_H #define DEF_SHADOWFANG_H - #define TYPE_FREE_NPC 1 #define TYPE_RETHILGORE 2 #define TYPE_FENRUS 3 diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/instance_shadowfang_keep.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/instance_shadowfang_keep.cpp index 29a8d04a1cb..b5381c1e685 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/instance_shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/instance_shadowfang_keep.cpp @@ -13,58 +13,44 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Shadowfang_Keep SD%Complete: 90 SDComment: SDCategory: Shadowfang Keep EndScriptData */ - #include "precompiled.h" #include "def_shadowfang_keep.h" - #define MAX_ENCOUNTER 4 - enum eEnums { SAY_BOSS_DIE_AD = -1033007, SAY_BOSS_DIE_AS = -1033008, - NPC_ASH = 3850, NPC_ADA = 3849, - GO_COURTYARD_DOOR = 18895, //door to open when talking to NPC's GO_SORCERER_DOOR = 18972, //door to open when Fenrus the Devourer GO_ARUGAL_DOOR = 18971 //door to open when Wolf Master Nandos }; - struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance { instance_shadowfang_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - uint64 uiAshGUID; uint64 uiAdaGUID; - uint64 DoorCourtyardGUID; uint64 DoorSorcererGUID; uint64 DoorArugalGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - uiAshGUID = 0; uiAdaGUID = 0; - DoorCourtyardGUID = 0; DoorSorcererGUID = 0; DoorArugalGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -73,7 +59,6 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -95,19 +80,16 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance break; } } - void DoSpeech() { Creature* pAda = instance->GetCreature(uiAdaGUID); Creature* pAsh = instance->GetCreature(uiAshGUID); - if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) { DoScriptText(SAY_BOSS_DIE_AD,pAda); DoScriptText(SAY_BOSS_DIE_AS,pAsh); } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -133,21 +115,16 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance m_auiEncounter[3] = data; break; } - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint32 GetData(uint32 type) { switch(type) @@ -163,12 +140,10 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance } return 0; } - std::string GetSaveData() { return str_data; } - void Load(const char* in) { if (!in) @@ -176,27 +151,21 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; } - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_shadowfang_keep(Map* pMap) { return new instance_shadowfang_keep(pMap); } - void AddSC_instance_shadowfang_keep() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp index dddf80ee4bb..6c3f0197466 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Shadowfang_Keep SD%Complete: 75 SDComment: npc_shadowfang_prisoner using escortAI for movement to door. Might need additional code in case being attacked. Add proper texts/say(). SDCategory: Shadowfang Keep EndScriptData */ - /* ContentData npc_shadowfang_prisoner EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_shadowfang_keep.h" - /*###### ## npc_shadowfang_prisoner ######*/ - enum eEnums { SAY_FREE_AS = -1033000, @@ -42,13 +37,10 @@ enum eEnums SAY_OPEN_DOOR_AD = -1033004, SAY_POST1_DOOR_AD = -1033005, SAY_POST2_DOOR_AD = -1033006, - SPELL_UNLOCK = 6421, NPC_ASH = 3850 }; - #define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door." - struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI { npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) @@ -56,10 +48,8 @@ struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI pInstance = c->GetInstanceData(); uiNpcEntry = c->GetEntry(); } - ScriptedInstance *pInstance; uint32 uiNpcEntry; - void WaypointReached(uint32 uiPoint) { switch(uiPoint) @@ -85,7 +75,6 @@ struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI DoScriptText(SAY_POST_DOOR_AS, m_creature); else DoScriptText(SAY_POST1_DOOR_AD, m_creature); - if (pInstance) pInstance->SetData(TYPE_FREE_NPC, DONE); break; @@ -95,44 +84,34 @@ struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI break; } } - void Reset() {} void EnterCombat(Unit* who) {} }; - CreatureAI* GetAI_npc_shadowfang_prisoner(Creature* pCreature) { return new npc_shadowfang_prisonerAI(pCreature); } - bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisonerAI, pCreature->AI())) pEscortAI->Start(false, false); } return true; } - void AddSC_shadowfang_keep() { Script *newscript; - newscript = new Script; newscript->Name = "npc_shadowfang_prisoner"; newscript->pGossipHello = &GossipHello_npc_shadowfang_prisoner; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/silvermoon_city.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/silvermoon_city.cpp index eb06008ed75..e69f8dfc71e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/silvermoon_city.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/silvermoon_city.cpp @@ -13,37 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Silvermoon_City SD%Complete: 100 SDComment: Quest support: 9685 SDCategory: Silvermoon City EndScriptData */ - /* ContentData npc_blood_knight_stillblade EndContentData */ - #include "precompiled.h" - /*####### # npc_blood_knight_stillblade #######*/ - #define SAY_HEAL -1000334 - #define QUEST_REDEEMING_THE_DEAD 9685 #define SPELL_SHIMMERING_VESSEL 31225 #define SPELL_REVIVE_SELF 32343 - struct TRINITY_DLL_DECL npc_blood_knight_stillbladeAI : public ScriptedAI { npc_blood_knight_stillbladeAI(Creature *c) : ScriptedAI(c) {} - uint32 lifeTimer; bool spellHit; - void Reset() { lifeTimer = 120000; @@ -51,16 +42,13 @@ struct TRINITY_DLL_DECL npc_blood_knight_stillbladeAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,7); // lay down spellHit = false; } - void EnterCombat(Unit *who) { } - void MoveInLineOfSight(Unit *who) { return; } - void UpdateAI(const uint32 diff) { if (m_creature->IsStandState()) @@ -71,7 +59,6 @@ struct TRINITY_DLL_DECL npc_blood_knight_stillbladeAI : public ScriptedAI lifeTimer -= diff; } } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && @@ -87,12 +74,10 @@ struct TRINITY_DLL_DECL npc_blood_knight_stillbladeAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_blood_knight_stillblade(Creature* pCreature) { return new npc_blood_knight_stillbladeAI (pCreature); } - void AddSC_silvermoon_city() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp index 7a70d646fae..453656b94c4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp @@ -13,63 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Silverpine_Forest SD%Complete: 100 SDComment: Quest support: 1886, 435 SDCategory: Silverpine Forest EndScriptData */ - /* ContentData npc_astor_hadren npc_deathstalker_erland EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_astor_hadren ######*/ - #define GOSSIP_HAH "You're Astor Hadren, right?" #define GOSSIP_SAH "You've got something I need, Astor. And I'll be taking it now." - struct TRINITY_DLL_DECL npc_astor_hadrenAI : public ScriptedAI { npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {} - void Reset() { m_creature->setFaction(68); } - void EnterCombat(Unit* who) { } - void JustDied(Unit *who) { m_creature->setFaction(68); } }; - CreatureAI* GetAI_npc_astor_hadren(Creature* pCreature) { return new npc_astor_hadrenAI(pCreature); } - bool GossipHello_npc_astor_hadren(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_astor_hadren(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -87,11 +73,9 @@ bool GossipSelect_npc_astor_hadren(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_deathstalker_erland ######*/ - enum eErland { SAY_QUESTACCEPT = -1000335, @@ -99,32 +83,25 @@ enum eErland SAY_AGGRO_1 = -1000337, SAY_AGGRO_2 = -1000338, SAY_LAST = -1000339, - SAY_THANKS = -1000340, SAY_RANE = -1000341, SAY_ANSWER = -1000342, SAY_MOVE_QUINN = -1000343, - SAY_GREETINGS = -1000344, SAY_QUINN = -1000345, SAY_ON_BYE = -1000346, - QUEST_ESCORTING = 435, NPC_RANE = 1950, NPC_QUINN = 1951 }; - struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI { npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 1: DoScriptText(SAY_START, m_creature, pPlayer);break; @@ -146,51 +123,40 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI DoScriptText(SAY_QUINN, Quinn); break;} case 26: DoScriptText(SAY_ON_BYE, m_creature, NULL);break; - } } - void Reset() {} - void EnterCombat(Unit* who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), m_creature, who); } }; - bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ESCORTING) { DoScriptText(SAY_QUESTACCEPT, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erlandAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); } - return true; } - CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) { return new npc_deathstalker_erlandAI(pCreature); } - /*###### ## AddSC ######*/ - void AddSC_silverpine_forest() { Script *newscript; - newscript = new Script; newscript->Name = "npc_astor_hadren"; newscript->pGossipHello = &GossipHello_npc_astor_hadren; newscript->pGossipSelect = &GossipSelect_npc_astor_hadren; newscript->GetAI = &GetAI_npc_astor_hadren; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_deathstalker_erland"; newscript->GetAI = &GetAI_npc_deathstalker_erlandAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp index 5e495d6e1e6..e0f190b5a7b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp @@ -13,42 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Stormwind_City SD%Complete: 100 SDComment: Quest support: 1640, 1447, 4185, 11223 SDCategory: Stormwind City EndScriptData */ - /* ContentData npc_archmage_malin npc_bartleby npc_dashel_stonefist npc_lady_katrana_prestor EndContentData */ - #include "precompiled.h" - /*###### ## npc_archmage_malin ######*/ - #define GOSSIP_ITEM_MALIN "Can you send me to Theramore? I have an urgent message for Lady Jaina from Highlord Bolvar." - bool GossipHello_npc_archmage_malin(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_archmage_malin(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -56,60 +46,48 @@ bool GossipSelect_npc_archmage_malin(Player* pPlayer, Creature* pCreature, uint3 pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer, 42711, true); } - return true; } - /*###### ## npc_bartleby ######*/ - enum eBartleby { FACTION_ENEMY = 168, QUEST_BEAT = 1640 }; - struct TRINITY_DLL_DECL npc_bartlebyAI : public ScriptedAI { npc_bartlebyAI(Creature *c) : ScriptedAI(c) { m_uiNormalFaction = c->getFaction(); } - uint32 m_uiNormalFaction; - void Reset() { if (m_creature->getFaction() != m_uiNormalFaction) m_creature->setFaction(m_uiNormalFaction); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 15)) { //Take 0 damage uiDamage = 0; - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT); EnterEvadeMode(); } } }; - bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_BEAT) @@ -119,62 +97,49 @@ bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, Quest const* } return true; } - CreatureAI* GetAI_npc_bartleby(Creature* pCreature) { return new npc_bartlebyAI(pCreature); } - /*###### ## npc_dashel_stonefist ######*/ - enum eDashel { QUEST_MISSING_DIPLO_PT8 = 1447, FACTION_HOSTILE = 168 }; - struct TRINITY_DLL_DECL npc_dashel_stonefistAI : public ScriptedAI { npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) { m_uiNormalFaction = c->getFaction(); } - uint32 m_uiNormalFaction; - void Reset() { if (m_creature->getFaction() != m_uiNormalFaction) m_creature->setFaction(m_uiNormalFaction); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 15)) { uiDamage = 0; - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); - EnterEvadeMode(); } } }; - bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) @@ -184,34 +149,26 @@ bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, Ques } return true; } - CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) { return new npc_dashel_stonefistAI(pCreature); } - /*###### ## npc_lady_katrana_prestor ######*/ - #define GOSSIP_ITEM_KAT_1 "Pardon the intrusion, Lady Prestor, but Highlord Bolvar suggested that I seek your advice." #define GOSSIP_ITEM_KAT_2 "My apologies, Lady Prestor." #define GOSSIP_ITEM_KAT_3 "Begging your pardon, Lady Prestor. That was not my intent." #define GOSSIP_ITEM_KAT_4 "Thank you for your time, Lady Prestor." - bool GossipHello_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(2693, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -235,29 +192,24 @@ bool GossipSelect_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature, } return true; } - void AddSC_stormwind_city() { Script *newscript; - newscript = new Script; newscript->Name = "npc_archmage_malin"; newscript->pGossipHello = &GossipHello_npc_archmage_malin; newscript->pGossipSelect = &GossipSelect_npc_archmage_malin; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_bartleby"; newscript->GetAI = &GetAI_npc_bartleby; newscript->pQuestAccept = &QuestAccept_npc_bartleby; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_dashel_stonefist"; newscript->GetAI = &GetAI_npc_dashel_stonefist; newscript->pQuestAccept = &QuestAccept_npc_dashel_stonefist; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lady_katrana_prestor"; newscript->pGossipHello = &GossipHello_npc_lady_katrana_prestor; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stranglethorn_vale.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stranglethorn_vale.cpp index 6f2c787f950..c8a43c7d5e9 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stranglethorn_vale.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stranglethorn_vale.cpp @@ -13,40 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Stranglethorn_Vale SD%Complete: 100 SDComment: Quest support: 592 SDCategory: Stranglethorn Vale EndScriptData */ - /* ContentData mob_yenniku EndContentData */ - #include "precompiled.h" - /*###### ## mob_yenniku ######*/ - struct TRINITY_DLL_DECL mob_yennikuAI : public ScriptedAI { mob_yennikuAI(Creature *c) : ScriptedAI(c) { bReset = false; } - uint32 Reset_Timer; bool bReset; - void Reset() { Reset_Timer = 0; m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (caster->GetTypeId() == TYPEID_PLAYER) @@ -58,16 +50,13 @@ struct TRINITY_DLL_DECL mob_yennikuAI : public ScriptedAI m_creature->CombatStop(); //stop combat m_creature->DeleteThreatList(); //unsure of this m_creature->setFaction(83); //horde generic - bReset = true; Reset_Timer = 60000; } } return; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (bReset) @@ -80,7 +69,6 @@ struct TRINITY_DLL_DECL mob_yennikuAI : public ScriptedAI return; } else Reset_Timer -= diff; - if (m_creature->isInCombat() && m_creature->getVictim()) { if (m_creature->getVictim()->GetTypeId() == TYPEID_PLAYER) @@ -94,11 +82,9 @@ struct TRINITY_DLL_DECL mob_yennikuAI : public ScriptedAI } } } - //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; @@ -106,15 +92,12 @@ CreatureAI* GetAI_mob_yenniku(Creature* pCreature) { return new mob_yennikuAI (pCreature); } - /*###### ## ######*/ - void AddSC_stranglethorn_vale() { Script *newscript; - newscript = new Script; newscript->Name = "mob_yenniku"; newscript->GetAI = &GetAI_mob_yenniku; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baron_rivendare.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baron_rivendare.cpp index e5f33d7a086..aaf4f754f35 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baron_rivendare.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baron_rivendare.cpp @@ -13,84 +13,68 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Baron_Rivendare SD%Complete: 70 SDComment: aura applied/defined in database SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SAY_0 "Intruders! More pawns of the Argent Dawn, no doubt. I already count one of their number among my prisoners. Withdraw from my domain before she is executed!" #define SAY_1 "You're still here? Your foolishness is amusing! The Argent Dawn wench needn't suffer in vain. Leave at once and she shall be spared!" #define SAY_2 "I shall take great pleasure in taking this poor wretch's life! It's not too late, she needn't suffer in vain. Turn back and her death shall be merciful!" #define SAY_3 "May this prisoner's death serve as a warning. None shall defy the Scourge and live!" #define SAY_4 "So you see fit to toy with the Lich King's creations? Ramstein, be sure to give the intruders a proper greeting." #define SAY_5 "Time to take matters into my own hands. Come. Enter my domain and challenge the might of the Scourge!" - #define ADD_1X 4017.403809 #define ADD_1Y -3339.703369 #define ADD_1Z 115.057655 #define ADD_1O 5.487860 - #define ADD_2X 4013.189209 #define ADD_2Y -3351.808350 #define ADD_2Z 115.052254 #define ADD_2O 0.134280 - #define ADD_3X 4017.738037 #define ADD_3Y -3363.478016 #define ADD_3Z 115.057274 #define ADD_3O 0.723313 - #define ADD_4X 4048.877197 #define ADD_4Y -3363.223633 #define ADD_4Z 115.054253 #define ADD_4O 3.627735 - #define ADD_5X 4051.777588 #define ADD_5Y -3350.893311 #define ADD_5Z 115.055351 #define ADD_5O 3.066176 - #define ADD_6X 4048.375977 #define ADD_6Y -3339.966309 #define ADD_6Z 115.055222 #define ADD_6O 2.457497 - #define SPELL_SHADOWBOLT 17393 #define SPELL_CLEAVE 15284 #define SPELL_MORTALSTRIKE 15708 - #define SPELL_UNHOLY_AURA 17467 #define SPELL_RAISEDEAD 17473 //triggers death pact (17471) - #define SPELL_RAISE_DEAD1 17475 #define SPELL_RAISE_DEAD2 17476 #define SPELL_RAISE_DEAD3 17477 #define SPELL_RAISE_DEAD4 17478 #define SPELL_RAISE_DEAD5 17479 #define SPELL_RAISE_DEAD6 17480 - struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI { boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 ShadowBolt_Timer; uint32 Cleave_Timer; uint32 MortalStrike_Timer; // uint32 RaiseDead_Timer; uint32 SummonSkeletons_Timer; Creature *Summoned; - void Reset() { ShadowBolt_Timer = 5000; @@ -101,40 +85,33 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI if (pInstance && pInstance->GetData(TYPE_RAMSTEIN) == DONE) pInstance->SetData(TYPE_BARON,NOT_STARTED); } - void AttackStart(Unit* who) { - if (pInstance)//can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door + if (pInstance) //can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door pInstance->SetData(TYPE_BARON,IN_PROGRESS); ScriptedAI::AttackStart(who); } - void JustSummoned(Creature* summoned) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) summoned->AI()->AttackStart(target); } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(TYPE_BARON,DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ShadowBolt if (ShadowBolt_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT); - ShadowBolt_Timer = 10000; }else ShadowBolt_Timer -= diff; - //Cleave if (Cleave_Timer < diff) { @@ -142,21 +119,18 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI //13 seconds until we should cast this again Cleave_Timer = 7000 + (rand()%10000); }else Cleave_Timer -= diff; - //MortalStrike if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); MortalStrike_Timer = 10000 + (rand()%15000); }else MortalStrike_Timer -= diff; - //RaiseDead // if (RaiseDead_Timer < diff) // { // DoCast(m_creature,SPELL_RAISEDEAD); // RaiseDead_Timer = 45000; // }else RaiseDead_Timer -= diff; - //SummonSkeletons if (SummonSkeletons_Timer < diff) { @@ -166,20 +140,16 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI m_creature->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); m_creature->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); m_creature->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); - //34 seconds until we should cast this again SummonSkeletons_Timer = 40000; }else SummonSkeletons_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_baron_rivendare(Creature* pCreature) { return new boss_baron_rivendareAI (pCreature); } - void AddSC_boss_baron_rivendare() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baroness_anastari.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baroness_anastari.cpp index ba5c2ec0521..897a2aef8e5 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baroness_anastari.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_baroness_anastari.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Baroness_Anastari SD%Complete: 90 SDComment: MC disabled SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SPELL_BANSHEEWAIL 16565 #define SPELL_BANSHEECURSE 16867 #define SPELL_SILENCE 18327 //#define SPELL_POSSESS 17244 - struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI { boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 BansheeWail_Timer; uint32 BansheeCurse_Timer; uint32 Silence_Timer; //uint32 Possess_Timer; - void Reset() { BansheeWail_Timer = 1000; @@ -50,22 +43,18 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI Silence_Timer = 13000; //Possess_Timer = 35000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //BansheeWail if (BansheeWail_Timer < diff) { @@ -74,7 +63,6 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI //4 seconds until we should cast this again BansheeWail_Timer = 4000; }else BansheeWail_Timer -= diff; - //BansheeCurse if (BansheeCurse_Timer < diff) { @@ -83,7 +71,6 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI //18 seconds until we should cast this again BansheeCurse_Timer = 18000; }else BansheeCurse_Timer -= diff; - //Silence if (Silence_Timer < diff) { @@ -92,7 +79,6 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI //13 seconds until we should cast this again Silence_Timer = 13000; }else Silence_Timer -= diff; - //Possess /* if (Possess_Timer < diff) { @@ -107,7 +93,6 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI Possess_Timer = 50000; }else Possess_Timer -= diff; */ - DoMeleeAttackIfReady(); } }; @@ -115,7 +100,6 @@ CreatureAI* GetAI_boss_baroness_anastari(Creature* pCreature) { return new boss_baroness_anastariAI (pCreature); } - void AddSC_boss_baroness_anastari() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_cannon_master_willey.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_cannon_master_willey.cpp index 69ff09067f5..5586693df80 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_cannon_master_willey.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_cannon_master_willey.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_cannon_master_willey SD%Complete: 100 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" - //front, left #define ADD_1X 3553.851807 #define ADD_1Y -2945.885986 @@ -68,21 +65,17 @@ EndScriptData */ #define ADD_9Y -2957.437744 #define ADD_9Z 125.001015 #define ADD_9O 0.592007 - #define SPELL_KNOCKAWAY 10101 #define SPELL_PUMMEL 15615 #define SPELL_SHOOT 16496 //#define SPELL_SUMMONCRIMSONRIFLEMAN 17279 - struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI { boss_cannon_master_willeyAI(Creature *c) : ScriptedAI(c) {} - uint32 KnockAway_Timer; uint32 Pummel_Timer; uint32 Shoot_Timer; uint32 SummonRifleman_Timer; - void Reset() { Shoot_Timer = 1000; @@ -90,7 +83,6 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI KnockAway_Timer = 11000; SummonRifleman_Timer = 15000; } - void JustDied(Unit* Victim) { m_creature->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); @@ -101,18 +93,15 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI m_creature->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); m_creature->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Pummel if (Pummel_Timer < diff) { @@ -124,7 +113,6 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI //12 seconds until we should cast this again Pummel_Timer = 12000; }else Pummel_Timer -= diff; - //KnockAway if (KnockAway_Timer < diff) { @@ -136,7 +124,6 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI //14 seconds until we should cast this again KnockAway_Timer = 14000; }else KnockAway_Timer -= diff; - //Shoot if (Shoot_Timer < diff) { @@ -145,7 +132,6 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI //1 seconds until we should cast this again Shoot_Timer = 1000; }else Shoot_Timer -= diff; - //SummonRifleman if (SummonRifleman_Timer < diff) { @@ -201,7 +187,6 @@ struct TRINITY_DLL_DECL boss_cannon_master_willeyAI : public ScriptedAI //30 seconds until we should cast this again SummonRifleman_Timer = 30000; }else SummonRifleman_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -209,7 +194,6 @@ CreatureAI* GetAI_boss_cannon_master_willey(Creature* pCreature) { return new boss_cannon_master_willeyAI (pCreature); } - void AddSC_boss_cannon_master_willey() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_dathrohan_balnazzar.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_dathrohan_balnazzar.cpp index 91477d3fef5..86978181dd7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_dathrohan_balnazzar.cpp @@ -13,60 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Dathrohan_Balnazzar SD%Complete: 95 SDComment: Possibly need to fix/improve summons after death SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" - enum eEnums { //Dathrohan spells SPELL_CRUSADERSHAMMER = 17286, //AOE stun SPELL_CRUSADERSTRIKE = 17281, SPELL_HOLYSTRIKE = 17284, //weapon dmg +3 - //Transform SPELL_BALNAZZARTRANSFORM = 17288, //restore full HP/mana, trigger spell Balnazzar Transform Stun - //Balnazzar spells SPELL_SHADOWSHOCK = 17399, SPELL_MINDBLAST = 17287, SPELL_PSYCHICSCREAM = 13704, SPELL_SLEEP = 12098, SPELL_MINDCONTROL = 15690, - NPC_DATHROHAN = 10812, NPC_BALNAZZAR = 10813, NPC_ZOMBIE = 10698 //probably incorrect }; - struct SummonDef { float m_fX, m_fY, m_fZ, m_fOrient; }; - SummonDef m_aSummonPoint[]= { {3444.156, -3090.626, 135.002, 2.240}, //G1 front, left {3449.123, -3087.009, 135.002, 2.240}, //G1 front, right {3446.246, -3093.466, 135.002, 2.240}, //G1 back left {3451.160, -3089.904, 135.002, 2.240}, //G1 back, right - {3457.995, -3080.916, 135.002, 3.784}, //G2 front, left {3454.302, -3076.330, 135.002, 3.784}, //G2 front, right {3460.975, -3078.901, 135.002, 3.784}, //G2 back left {3457.338, -3073.979, 135.002, 3.784} //G2 back, right }; - struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI { boss_dathrohan_balnazzarAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiCrusadersHammer_Timer; uint32 m_uiCrusaderStrike_Timer; uint32 m_uiMindBlast_Timer; @@ -76,7 +65,6 @@ struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI uint32 m_uiDeepSleep_Timer; uint32 m_uiMindControl_Timer; bool m_bTransformed; - void Reset() { m_uiCrusadersHammer_Timer = 8000; @@ -88,30 +76,24 @@ struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI m_uiDeepSleep_Timer = 20000; m_uiMindControl_Timer = 10000; m_bTransformed = false; - if (m_creature->GetEntry() == NPC_BALNAZZAR) m_creature->UpdateEntry(NPC_DATHROHAN); } - void JustDied(Unit* Victim) { static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); - for (uint8 i=0; iSummonCreature(NPC_ZOMBIE, m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, TEMPSUMMON_TIMED_DESPAWN, HOUR*IN_MILISECONDS); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //START NOT TRANSFORMED if (!m_bTransformed) { @@ -121,34 +103,29 @@ struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_MINDBLAST); m_uiMindBlast_Timer = 15000 + rand()%5000; }else m_uiMindBlast_Timer -= uiDiff; - //CrusadersHammer if (m_uiCrusadersHammer_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_CRUSADERSHAMMER); m_uiCrusadersHammer_Timer = 12000; }else m_uiCrusadersHammer_Timer -= uiDiff; - //CrusaderStrike if (m_uiCrusaderStrike_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_CRUSADERSTRIKE); m_uiCrusaderStrike_Timer = 15000; }else m_uiCrusaderStrike_Timer -= uiDiff; - //HolyStrike if (m_uiHolyStrike_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_HOLYSTRIKE); m_uiHolyStrike_Timer = 15000; }else m_uiHolyStrike_Timer -= uiDiff; - //BalnazzarTransform if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 40) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - //restore hp, mana and stun DoCast(m_creature,SPELL_BALNAZZARTRANSFORM); m_creature->UpdateEntry(NPC_BALNAZZAR); @@ -163,32 +140,26 @@ struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_MINDBLAST); m_uiMindBlast_Timer = 15000 + rand()%5000; }else m_uiMindBlast_Timer -= uiDiff; - //ShadowShock if (m_uiShadowShock_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_SHADOWSHOCK); m_uiShadowShock_Timer = 11000; }else m_uiShadowShock_Timer -= uiDiff; - //PsychicScream if (m_uiPsychicScream_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget,SPELL_PSYCHICSCREAM); - m_uiPsychicScream_Timer = 20000; }else m_uiPsychicScream_Timer -= uiDiff; - //DeepSleep if (m_uiDeepSleep_Timer < uiDiff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget,SPELL_SLEEP); - m_uiDeepSleep_Timer = 15000; }else m_uiDeepSleep_Timer -= uiDiff; - //MindControl if (m_uiMindControl_Timer < uiDiff) { @@ -196,16 +167,13 @@ struct TRINITY_DLL_DECL boss_dathrohan_balnazzarAI : public ScriptedAI m_uiMindControl_Timer = 15000; }else m_uiMindControl_Timer -= uiDiff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_dathrohan_balnazzar(Creature* pCreature) { return new boss_dathrohan_balnazzarAI (pCreature); } - void AddSC_boss_dathrohan_balnazzar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_magistrate_barthilas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_magistrate_barthilas.cpp index c1fe3220b9e..439e104b8ef 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_magistrate_barthilas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_magistrate_barthilas.cpp @@ -13,35 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Magistrate_Barthilas SD%Complete: 70 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SPELL_DRAININGBLOW 16793 #define SPELL_CROWDPUMMEL 10887 #define SPELL_MIGHTYBLOW 14099 #define SPELL_FURIOUS_ANGER 16791 - #define MODEL_NORMAL 10433 #define MODEL_HUMAN 3637 - struct TRINITY_DLL_DECL boss_magistrate_barthilasAI : public ScriptedAI { boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) {} - uint32 DrainingBlow_Timer; uint32 CrowdPummel_Timer; uint32 MightyBlow_Timer; uint32 FuriousAnger_Timer; uint32 AngerCount; - void Reset() { DrainingBlow_Timer = 20000; @@ -49,66 +42,54 @@ struct TRINITY_DLL_DECL boss_magistrate_barthilasAI : public ScriptedAI MightyBlow_Timer = 10000; FuriousAnger_Timer = 5000; AngerCount = 0; - if (m_creature->isAlive()) m_creature->SetDisplayId(MODEL_NORMAL); else m_creature->SetDisplayId(MODEL_HUMAN); } - void MoveInLineOfSight(Unit *who) { //nothing to see here yet - ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit* Killer) { m_creature->SetDisplayId(MODEL_HUMAN); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (FuriousAnger_Timer < diff) { FuriousAnger_Timer = 4000; if (AngerCount > 25) return; - ++AngerCount; m_creature->CastSpell(m_creature,SPELL_FURIOUS_ANGER,false); }else FuriousAnger_Timer -= diff; - //DrainingBlow if (DrainingBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DRAININGBLOW); DrainingBlow_Timer = 15000; }else DrainingBlow_Timer -= diff; - //CrowdPummel if (CrowdPummel_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CROWDPUMMEL); CrowdPummel_Timer = 15000; }else CrowdPummel_Timer -= diff; - //MightyBlow if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MIGHTYBLOW); MightyBlow_Timer = 20000; }else MightyBlow_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -116,7 +97,6 @@ CreatureAI* GetAI_boss_magistrate_barthilas(Creature* pCreature) { return new boss_magistrate_barthilasAI (pCreature); } - void AddSC_boss_magistrate_barthilas() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_maleki_the_pallid.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_maleki_the_pallid.cpp index e5e31e20704..1af71d380da 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_maleki_the_pallid.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_maleki_the_pallid.cpp @@ -13,58 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_maleki_the_pallid SD%Complete: 100 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SPELL_FROSTBOLT 17503 #define SPELL_DRAINLIFE 20743 #define SPELL_DRAIN_MANA 17243 #define SPELL_ICETOMB 16869 - struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI { boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 Frostbolt_Timer; uint32 IceTomb_Timer; uint32 DrainLife_Timer; - void Reset() { Frostbolt_Timer = 1000; IceTomb_Timer = 16000; DrainLife_Timer = 31000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(TYPE_PALLID,IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Frostbolt if (Frostbolt_Timer < diff) { @@ -72,7 +61,6 @@ struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); Frostbolt_Timer = 3500; }else Frostbolt_Timer -= diff; - //IceTomb if (IceTomb_Timer < diff) { @@ -80,7 +68,6 @@ struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_ICETOMB); IceTomb_Timer = 28000; }else IceTomb_Timer -= diff; - //DrainLife if (DrainLife_Timer < diff) { @@ -88,7 +75,6 @@ struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_DRAINLIFE); DrainLife_Timer = 31000; }else DrainLife_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -96,7 +82,6 @@ CreatureAI* GetAI_boss_maleki_the_pallid(Creature* pCreature) { return new boss_maleki_the_pallidAI (pCreature); } - void AddSC_boss_maleki_the_pallid() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp index f051208c287..465b7c4a272 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Nerubenkan SD%Complete: 70 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SPELL_ENCASINGWEBS 4962 #define SPELL_PIERCEARMOR 6016 #define SPELL_CRYPT_SCARABS 31602 #define SPELL_RAISEUNDEADSCARAB 17235 - struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI { boss_nerubenkanAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 EncasingWebs_Timer; uint32 PierceArmor_Timer; uint32 CryptScarabs_Timer; @@ -46,7 +40,6 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI int RandX; int RandY; Creature* Summoned; - void Reset() { CryptScarabs_Timer = 3000; @@ -54,17 +47,14 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI PierceArmor_Timer = 19000; RaiseUndeadScarab_Timer = 3000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(TYPE_NERUB,IN_PROGRESS); } - void RaiseUndeadScarab(Unit* victim) { Rand = rand()%10; @@ -85,19 +75,16 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI if (Summoned) (Summoned->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //EncasingWebs if (EncasingWebs_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ENCASINGWEBS); EncasingWebs_Timer = 30000; }else EncasingWebs_Timer -= diff; - //PierceArmor if (PierceArmor_Timer < diff) { @@ -105,21 +92,18 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_PIERCEARMOR); PierceArmor_Timer = 35000; }else PierceArmor_Timer -= diff; - //CryptScarabs_Timer if (CryptScarabs_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CRYPT_SCARABS); CryptScarabs_Timer = 20000; }else CryptScarabs_Timer -= diff; - //RaiseUndeadScarab if (RaiseUndeadScarab_Timer < diff) { RaiseUndeadScarab(m_creature->getVictim()); RaiseUndeadScarab_Timer = 16000; }else RaiseUndeadScarab_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -127,7 +111,6 @@ CreatureAI* GetAI_boss_nerubenkan(Creature* pCreature) { return new boss_nerubenkanAI (pCreature); } - void AddSC_boss_nerubenkan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_order_of_silver_hand.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_order_of_silver_hand.cpp index 4cbbe273a65..63e0da6143b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_order_of_silver_hand.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_order_of_silver_hand.cpp @@ -13,51 +13,41 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Silver_Hand_Bosses SD%Complete: 40 SDComment: Basic script to have support for Horde paladin epic mount (quest 9737). All 5 members of Order of the Silver Hand running this script (least for now) SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - /*##### # Additional: # Although this is a working solution, the correct would be in addition to check if Aurius is dead. # Once player extinguish the eternal flame (cast spell 31497->start event 11206) Aurius should become hostile. # Once Aurius is defeated, he should be the one summoning the ghosts. #####*/ - #define SH_GREGOR 17910 #define SH_CATHELA 17911 #define SH_NEMAS 17912 #define SH_AELMAR 17913 #define SH_VICAR 17914 #define SH_QUEST_CREDIT 17915 - #define SPELL_HOLY_LIGHT 25263 #define SPELL_DIVINE_SHIELD 13874 - struct TRINITY_DLL_DECL boss_silver_hand_bossesAI : public ScriptedAI { boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 HolyLight_Timer; uint32 DivineShield_Timer; - void Reset() { HolyLight_Timer = 20000; DivineShield_Timer = 20000; - if (pInstance) { switch(m_creature->GetEntry()) @@ -80,11 +70,9 @@ struct TRINITY_DLL_DECL boss_silver_hand_bossesAI : public ScriptedAI } } } - void EnterCombat(Unit* who) { } - void JustDied(Unit* Killer) { if (pInstance) @@ -111,13 +99,11 @@ struct TRINITY_DLL_DECL boss_silver_hand_bossesAI : public ScriptedAI CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT,m_creature->GetGUID()); } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (HolyLight_Timer < diff) { if (m_creature->GetHealth()*5 < m_creature->GetMaxHealth()) @@ -126,7 +112,6 @@ struct TRINITY_DLL_DECL boss_silver_hand_bossesAI : public ScriptedAI HolyLight_Timer = 20000; } }else HolyLight_Timer -= diff; - if (DivineShield_Timer < diff) { if (m_creature->GetHealth()*20 < m_creature->GetMaxHealth()) @@ -135,20 +120,16 @@ struct TRINITY_DLL_DECL boss_silver_hand_bossesAI : public ScriptedAI DivineShield_Timer = 40000; } }else DivineShield_Timer -= diff; - DoMeleeAttackIfReady(); } - }; CreatureAI* GetAI_boss_silver_hand_bossesAI(Creature* pCreature) { return new boss_silver_hand_bossesAI (pCreature); } - void AddSC_boss_order_of_silver_hand() { Script *newscript; - newscript = new Script; newscript->Name = "boss_silver_hand_bosses"; newscript->GetAI = &GetAI_boss_silver_hand_bossesAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_postmaster_malown.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_postmaster_malown.cpp index ef43c7774bc..e2c6fcb3312 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_postmaster_malown.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_postmaster_malown.cpp @@ -13,38 +13,30 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_postmaster_malown SD%Complete: 50 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" - //Spell ID to summon this guy is 24627 "Summon Postmaster Malown" //He should be spawned along with three other elites once the third postbox has been opened - #define SAY_MALOWNED "You just got MALOWNED!" - #define SPELL_WAILINGDEAD 7713 #define SPELL_BACKHAND 6253 #define SPELL_CURSEOFWEAKNESS 8552 #define SPELL_CURSEOFTONGUES 12889 #define SPELL_CALLOFTHEGRAVE 17831 - struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI { boss_postmaster_malownAI(Creature *c) : ScriptedAI(c) {} - uint32 WailingDead_Timer; uint32 Backhand_Timer; uint32 CurseOfWeakness_Timer; uint32 CurseOfTongues_Timer; uint32 CallOfTheGrave_Timer; bool HasYelled; - void Reset() { WailingDead_Timer = 19000; //lasts 6 sec @@ -54,17 +46,14 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI CallOfTheGrave_Timer = 25000; HasYelled = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //WailingDead if (WailingDead_Timer < diff) { @@ -76,7 +65,6 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI //19 seconds until we should cast this again WailingDead_Timer = 19000; }else WailingDead_Timer -= diff; - //Backhand if (Backhand_Timer < diff) { @@ -88,7 +76,6 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI //8 seconds until we should cast this again Backhand_Timer = 8000; }else Backhand_Timer -= diff; - //CurseOfWeakness if (CurseOfWeakness_Timer < diff) { @@ -100,7 +87,6 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI //20 seconds until we should cast this again CurseOfWeakness_Timer = 20000; }else CurseOfWeakness_Timer -= diff; - //CurseOfTongues if (CurseOfTongues_Timer < diff) { @@ -112,7 +98,6 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI //22 seconds until we should cast this again CurseOfTongues_Timer = 22000; }else CurseOfTongues_Timer -= diff; - //CallOfTheGrave if (CallOfTheGrave_Timer < diff) { @@ -124,7 +109,6 @@ struct TRINITY_DLL_DECL boss_postmaster_malownAI : public ScriptedAI //25 seconds until we should cast this again CallOfTheGrave_Timer = 25000; }else CallOfTheGrave_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -132,7 +116,6 @@ CreatureAI* GetAI_boss_postmaster_malown(Creature* pCreature) { return new boss_postmaster_malownAI (pCreature); } - void AddSC_boss_postmaster_malown() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_ramstein_the_gorger.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_ramstein_the_gorger.cpp index bac18320293..a65022ac629 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_ramstein_the_gorger.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_ramstein_the_gorger.cpp @@ -13,76 +13,61 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ramstein_The_Gorger SD%Complete: 70 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define SPELL_TRAMPLE 5568 #define SPELL_KNOCKOUT 17307 - #define C_MINDLESS_UNDEAD 11030 - struct TRINITY_DLL_DECL boss_ramstein_the_gorgerAI : public ScriptedAI { boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 Trample_Timer; uint32 Knockout_Timer; - void Reset() { Trample_Timer = 3000; Knockout_Timer = 12000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { - for(uint8 i = 0; i < 30; ++i) + for (uint8 i = 0; i < 30; ++i) { if (Creature* mob = m_creature->SummonCreature(C_MINDLESS_UNDEAD,3969.35+irand(-10,10),-3391.87+irand(-10,10),119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000)) mob->AI()->AttackStart(m_creature->SelectNearestTarget(500)); } - if (pInstance) pInstance->SetData(TYPE_RAMSTEIN,DONE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Trample if (Trample_Timer < diff) { DoCast(m_creature,SPELL_TRAMPLE); Trample_Timer = 7000; }else Trample_Timer -= diff; - //Knockout if (Knockout_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKOUT); Knockout_Timer = 10000; }else Knockout_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -90,7 +75,6 @@ CreatureAI* GetAI_boss_ramstein_the_gorger(Creature* pCreature) { return new boss_ramstein_the_gorgerAI (pCreature); } - void AddSC_boss_ramstein_the_gorger() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_timmy_the_cruel.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_timmy_the_cruel.cpp index e6e96c3a776..140b8725841 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_timmy_the_cruel.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/boss_timmy_the_cruel.cpp @@ -13,33 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_timmy_the_cruel SD%Complete: 100 SDComment: SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" - #define SAY_SPAWN "TIMMY!" - #define SPELL_RAVENOUSCLAW 17470 - struct TRINITY_DLL_DECL boss_timmy_the_cruelAI : public ScriptedAI { boss_timmy_the_cruelAI(Creature *c) : ScriptedAI(c) {} - uint32 RavenousClaw_Timer; bool HasYelled; - void Reset() { RavenousClaw_Timer = 10000; HasYelled = false; } - void EnterCombat(Unit *who) { if (!HasYelled) @@ -48,13 +40,11 @@ struct TRINITY_DLL_DECL boss_timmy_the_cruelAI : public ScriptedAI HasYelled = true; } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //RavenousClaw if (RavenousClaw_Timer < diff) { @@ -63,7 +53,6 @@ struct TRINITY_DLL_DECL boss_timmy_the_cruelAI : public ScriptedAI //15 seconds until we should cast this again RavenousClaw_Timer = 15000; }else RavenousClaw_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -71,7 +60,6 @@ CreatureAI* GetAI_boss_timmy_the_cruel(Creature* pCreature) { return new boss_timmy_the_cruelAI (pCreature); } - void AddSC_boss_timmy_the_cruel() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/def_stratholme.h b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/def_stratholme.h index b9246091a7c..2f05f55f556 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/def_stratholme.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/def_stratholme.h @@ -1,27 +1,22 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_STRATHOLME_H #define DEF_STRATHOLME_H - #define TYPE_BARON_RUN 1 #define TYPE_BARONESS 2 #define TYPE_NERUB 3 #define TYPE_PALLID 4 #define TYPE_RAMSTEIN 5 #define TYPE_BARON 6 - #define DATA_BARON 10 #define DATA_YSIDA_TRIGGER 11 - #define TYPE_SH_QUEST 20 #define TYPE_SH_CATHELA 21 #define TYPE_SH_GREGOR 22 #define TYPE_SH_NEMAS 23 #define TYPE_SH_VICAR 24 #define TYPE_SH_AELMAR 25 - #define QUEST_DEAD_MAN_PLEA 8945 #define SPELL_BARON_ULTIMATUM 27861 #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/instance_stratholme.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/instance_stratholme.cpp index d475e116039..6a56d2ca865 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/instance_stratholme.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/instance_stratholme.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: instance_stratholme SD%Complete: 50 SDComment: In progress. Undead side 75% implemented. Save/load not implemented. SDCategory: Stratholme EndScriptData */ - #include "precompiled.h" #include "def_stratholme.h" - #define GO_SERVICE_ENTRANCE 175368 #define GO_GAUNTLET_GATE1 175357 #define GO_ZIGGURAT1 175380 //baroness @@ -34,30 +31,22 @@ EndScriptData */ #define GO_PORT_GAUNTLET 175374 //port from gauntlet to slaugther #define GO_PORT_SLAUGTHER 175373 //port at slaugther #define GO_PORT_ELDERS 175377 //port at elders square - #define C_CRYSTAL 10415 //three ziggurat crystals #define C_BARON 10440 #define C_YSIDA_TRIGGER 16100 - #define C_RAMSTEIN 10439 #define C_ABOM_BILE 10416 #define C_ABOM_VENOM 10417 #define C_BLACK_GUARD 10394 #define C_YSIDA 16031 - #define MAX_ENCOUNTER 6 - struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance { instance_stratholme(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 Encounter[MAX_ENCOUNTER]; - bool IsSilverHandDead[5]; - uint32 BaronRun_Timer; uint32 SlaugtherSquare_Timer; - uint64 serviceEntranceGUID; uint64 gauntletGate1GUID; uint64 ziggurat1GUID; @@ -68,23 +57,18 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance uint64 portGauntletGUID; uint64 portSlaugtherGUID; uint64 portElderGUID; - uint64 baronGUID; uint64 ysidaTriggerGUID; std::set crystalsGUID; std::set abomnationGUID; - void Initialize() { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) Encounter[i] = NOT_STARTED; - - for(uint8 i = 0; i < 5; ++i) + for (uint8 i = 0; i < 5; ++i) IsSilverHandDead[i] = false; - BaronRun_Timer = 0; SlaugtherSquare_Timer = 0; - serviceEntranceGUID = 0; gauntletGate1GUID = 0; ziggurat1GUID = 0; @@ -95,13 +79,11 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance portGauntletGUID = 0; portSlaugtherGUID = 0; portElderGUID = 0; - baronGUID = 0; ysidaTriggerGUID = 0; crystalsGUID.clear(); abomnationGUID.clear(); } - bool StartSlaugtherSquare() { //change to DONE when crystals implemented @@ -111,17 +93,14 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance UpdateGoState(portSlaugtherGUID,0,false); return true; } - debug_log("TSCR: Instance Stratholme: Cannot open slaugther square yet."); return false; } - //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) { if (!goGuid) return; - if (GameObject* pGo = instance->GetGameObject(goGuid)) { if (withRestoreTime) @@ -130,7 +109,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance pGo->SetGoState((GOState)newState); } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -142,7 +120,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance case C_ABOM_VENOM: abomnationGUID.insert(pCreature->GetGUID()); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -171,7 +148,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance case GO_PORT_ELDERS: portElderGUID = pGo->GetGUID(); break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -224,9 +200,8 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance { if (Encounter[4] != IN_PROGRESS) UpdateGoState(portGauntletGUID,GO_STATE_READY,false); - uint32 count = abomnationGUID.size(); - for(std::set::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) + for (std::set::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) { if (Creature* pAbom = instance->GetCreature(*i)) { @@ -234,7 +209,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance --count; } } - if (!count) { //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. @@ -261,22 +235,19 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); - if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); } } } - SetData(TYPE_BARON_RUN,DONE); } } @@ -305,19 +276,15 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance } if (data == DONE)SaveToDB(); } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; - OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - void Load(const char* in) { if (!in) @@ -325,20 +292,15 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] >> Encounter[4] >> Encounter[5]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (Encounter[i] == IN_PROGRESS) Encounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; } - uint32 GetData(uint32 type) { switch(type) @@ -362,7 +324,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -374,7 +335,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance } return 0; } - void Update(uint32 diff) { if (BaronRun_Timer) @@ -387,16 +347,14 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance debug_log("TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); }else BaronRun_Timer -= diff; } - if (SlaugtherSquare_Timer) { if (SlaugtherSquare_Timer <= diff) { if (Creature* pBaron = instance->GetCreature(baronGUID)) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - UpdateGoState(ziggurat4GUID,GO_STATE_ACTIVE,false); UpdateGoState(ziggurat5GUID,GO_STATE_ACTIVE,false); debug_log("TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); @@ -406,12 +364,10 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_stratholme(Map* pMap) { return new instance_stratholme(pMap); } - void AddSC_instance_stratholme() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp index 1d0473e1d9b..c091ab5562e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp @@ -13,46 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Stratholme SD%Complete: 100 SDComment: Misc mobs for instance. pGo-script to apply aura and start event for quest 8945 SDCategory: Stratholme EndScriptData */ - /* ContentData go_gauntlet_gate mob_freed_soul mob_restless_soul mobs_spectral_ghostly_citizen EndContentData */ - #include "precompiled.h" #include "def_stratholme.h" - /*###### ## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist) ######*/ - bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = pGo->GetInstanceData(); - if (!pInstance) return false; - if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) return false; - if (Group *pGroup = pPlayer->GetGroup()) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupie = itr->getSource(); if (!pGroupie) continue; - if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) && pGroupie->GetMap() == pGo->GetMap()) @@ -62,65 +53,51 @@ bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) !pPlayer->HasAura(SPELL_BARON_ULTIMATUM) && pPlayer->GetMap() == pGo->GetMap()) pPlayer->CastSpell(pPlayer,SPELL_BARON_ULTIMATUM,true); - pInstance->SetData(TYPE_BARON_RUN,IN_PROGRESS); return false; } - /*###### ## mob_freed_soul ######*/ - //Possibly more of these quotes around. #define SAY_ZAPPED0 -1329000 #define SAY_ZAPPED1 -1329001 #define SAY_ZAPPED2 -1329002 #define SAY_ZAPPED3 -1329003 - struct TRINITY_DLL_DECL mob_freed_soulAI : public ScriptedAI { mob_freed_soulAI(Creature *c) : ScriptedAI(c) {} - void Reset() { DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), m_creature); } - void EnterCombat(Unit* who) { } }; - CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) { return new mob_freed_soulAI (pCreature); } - /*###### ## mob_restless_soul ######*/ - #define SPELL_EGAN_BLASTER 17368 #define SPELL_SOUL_FREED 17370 #define QUEST_RESTLESS_SOUL 5282 #define ENTRY_RESTLESS 11122 #define ENTRY_FREED 11136 - struct TRINITY_DLL_DECL mob_restless_soulAI : public ScriptedAI { mob_restless_soulAI(Creature *c) : ScriptedAI(c) {} - uint64 Tagger; uint32 Die_Timer; bool Tagged; - void Reset() { Tagger = 0; Die_Timer = 5000; Tagged = false; } - void EnterCombat(Unit* who) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (caster->GetTypeId() == TYPEID_PLAYER) @@ -132,18 +109,15 @@ struct TRINITY_DLL_DECL mob_restless_soulAI : public ScriptedAI } } } - void JustSummoned(Creature *summoned) { summoned->CastSpell(summoned,SPELL_SOUL_FREED,false); } - void JustDied(Unit* Killer) { if (Tagged) m_creature->SummonCreature(ENTRY_FREED, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); } - void UpdateAI(const uint32 diff) { if (Tagged) @@ -156,48 +130,39 @@ struct TRINITY_DLL_DECL mob_restless_soulAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_restless_soul(Creature* pCreature) { return new mob_restless_soulAI (pCreature); } - /*###### ## mobs_spectral_ghostly_citizen ######*/ - enum eGhostlyCitizenSpells { SPELL_HAUNTING_PHANTOM = 16336, SPELL_SLAP = 6754 }; - struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI { mobs_spectral_ghostly_citizenAI(Creature *c) : ScriptedAI(c) {} - uint32 Die_Timer; bool Tagged; - void Reset() { Die_Timer = 5000; Tagged = false; } - void EnterCombat(Unit* who) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) Tagged = true; } - void JustDied(Unit* Killer) { if (Tagged) { - for(uint32 i = 1; i <= 4; ++i) + for (uint32 i = 1; i <= 4; ++i) { //100%, 50%, 33%, 25% chance to spawn if (urand(1,i) == 1) @@ -205,7 +170,6 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (Tagged) @@ -214,13 +178,10 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI m_creature->Kill(m_creature); else Die_Timer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void ReceiveEmote(Player* pPlayer, uint32 emote) { switch(emote) @@ -246,31 +207,25 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI } } }; - CreatureAI* GetAI_mobs_spectral_ghostly_citizen(Creature* pCreature) { return new mobs_spectral_ghostly_citizenAI (pCreature); } - void AddSC_stratholme() { Script *newscript; - newscript = new Script; newscript->Name = "go_gauntlet_gate"; newscript->pGOHello = &GOHello_go_gauntlet_gate; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_freed_soul"; newscript->GetAI = &GetAI_mob_freed_soul; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_restless_soul"; newscript->GetAI = &GetAI_mob_restless_soul; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mobs_spectral_ghostly_citizen"; newscript->GetAI = &GetAI_mobs_spectral_ghostly_citizen; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/def_sunken_temple.h b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/def_sunken_temple.h index 82245095c31..bc191af0697 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/def_sunken_temple.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/def_sunken_temple.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 kb_z * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SUNKEN_TEMPLE_H #define DEF_SUNKEN_TEMPLE_H - #define TROLLBOSS1_DEATH 1 #define TROLLBOSS2_DEATH 2 #define TROLLBOSS3_DEATH 3 @@ -16,7 +14,6 @@ #define HAZZAS_DEATH 9 #define ERANIKUS_DEATH 10 #define ATALALARION_DEATH 11 //optional - #define EVENT_STATE 1 #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp index 42ec8d5d784..4e7981c7969 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Sunken_Temple SD%Complete: 100 SDComment:Place Holder SDCategory: Sunken Temple EndScriptData */ - #include "precompiled.h" #include "def_sunken_temple.h" - #define GO_ATALAI_STATUE1 148830 #define GO_ATALAI_STATUE2 148831 #define GO_ATALAI_STATUE3 148832 @@ -31,19 +28,15 @@ EndScriptData */ #define GO_ATALAI_STATUE5 148834 #define GO_ATALAI_STATUE6 148835 #define GO_ATALAI_IDOL 148836 - #define GO_ATALAI_LIGHT1 148883 #define GO_ATALAI_LIGHT2 148937 - #define NPC_MALFURION_STORMRAGE 15362 - struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance { instance_sunken_temple(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; - GameObject* AtalaiStatue1; GameObject* AtalaiStatue2; GameObject* AtalaiStatue3; @@ -51,7 +44,6 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance GameObject* AtalaiStatue5; GameObject* AtalaiStatue6; GameObject* AtalaiIdol; - uint64 GOAtalaiStatue1; uint64 GOAtalaiStatue2; uint64 GOAtalaiStatue3; @@ -60,14 +52,12 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance uint64 GOAtalaiStatue6; uint64 GOAtalaiIdol; uint32 State; - bool s1; bool s2; bool s3; bool s4; bool s5; bool s6; - void Initialize() { GOAtalaiStatue1 = 0; @@ -92,7 +82,6 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance s5 = false; s6 = false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -128,7 +117,6 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance } }; - virtual void Update(uint32 diff) // correct order goes form 1-6 { switch(State) @@ -183,7 +171,6 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance break; } }; - void UseStatue(GameObject* pGo) { pGo->SummonGameObject(GO_ATALAI_LIGHT1,pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ(),0,0,0,0,0,0); @@ -199,13 +186,11 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue6->GetPositionX(),AtalaiStatue6->GetPositionY(),AtalaiStatue6->GetPositionZ(),0,0,0,0,0,100000); pGo->SummonGameObject(148838,-488.997,96.61,-189.019,-1.52,0,0,0,0,100000); } - void SetData(uint32 type, uint32 data) { if (type == EVENT_STATE) State = data; } - uint32 GetData(uint32 type) { if (type == EVENT_STATE) @@ -213,12 +198,10 @@ struct TRINITY_DLL_DECL instance_sunken_temple : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_sunken_temple(Map* pMap) { return new instance_sunken_temple(pMap); } - void AddSC_instance_sunken_temple() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/sunken_temple.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/sunken_temple.cpp index d4da9a68e53..47af3f53cb0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/sunken_temple.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunken_temple/sunken_temple.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Sunken_Temple SD%Complete: 100 SDComment: Area Trigger + Puzzle event support SDCategory: Sunken Temple EndScriptData */ - /* ContentData at_malfurion_Stormrage_trigger EndContentData */ - #include "precompiled.h" #include "def_sunken_temple.h" - /*##### # at_malfurion_Stormrage_trigger #####*/ - bool AreaTrigger_at_malfurion_stormrage(Player* pPlayer, AreaTriggerEntry *at) { if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) @@ -45,7 +40,6 @@ return false; /*##### # go_atalai_statue #####*/ - bool GOHello_go_atalai_statue(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = pPlayer->GetInstanceData(); @@ -54,16 +48,13 @@ bool GOHello_go_atalai_statue(Player* pPlayer, GameObject* pGo) pInstance->SetData(EVENT_STATE,pGo->GetEntry()); return false; } - void AddSC_sunken_temple() { Script *newscript; - newscript = new Script; newscript->Name = "at_malfurion_stormrage"; newscript->pAreaTrigger = &AreaTrigger_at_malfurion_stormrage; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_atalai_statue"; newscript->pGOHello = &GOHello_go_atalai_statue; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp index cfa03ab6086..d63ca9061a7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Brutallus SD%Complete: 80 SDComment: Find a way to start the intro, best code for the intro EndScriptData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - enum Quotes { YELL_INTRO = -1580017, @@ -30,13 +27,11 @@ enum Quotes YELL_INTRO_CHARGE = -1580019, YELL_INTRO_KILL_MADRIGOSA = -1580020, YELL_INTRO_TAUNT = -1580021, - YELL_MADR_ICE_BARRIER = -1580031, YELL_MADR_INTRO = -1580032, YELL_MADR_ICE_BLOCK = -1580033, YELL_MADR_TRAP = -1580034, YELL_MADR_DEATH = -1580035, - YELL_AGGRO = -1580022, YELL_KILL1 = -1580023, YELL_KILL2 = -1580024, @@ -47,7 +42,6 @@ enum Quotes YELL_BERSERK = -1580029, YELL_DEATH = -1580030 }; - enum Spells { SPELL_METEOR_SLASH = 45150, @@ -55,59 +49,47 @@ enum Spells SPELL_STOMP = 45185, SPELL_BERSERK = 26662, SPELL_DUAL_WIELD = 42459, - SPELL_INTRO_FROST_BLAST = 45203, SPELL_INTRO_FROSTBOLT = 44843, SPELL_INTRO_ENCAPSULATE = 45665, SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 }; - #define FELMYST 25038 - struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI { boss_brutallusAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; Unit* Madrigosa; - uint32 SlashTimer; uint32 BurnTimer; uint32 StompTimer; uint32 BerserkTimer; - uint32 IntroPhase; uint32 IntroPhaseTimer; uint32 IntroFrostBoltTimer; - bool Intro; bool IsIntro; bool Enraged; - void Reset() { SlashTimer = 11000; StompTimer = 30000; BurnTimer = 60000; BerserkTimer = 360000; - IntroPhase = 0; IntroPhaseTimer = 0; IntroFrostBoltTimer = 0; - IsIntro = false; Enraged = false; Intro = true; //for debug - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Madrigosa = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_MADRIGOSA)); //Creature* boss = Unit::GetCreature((*m_creature),AzgalorGUID); if (!Madrigosa) error_log("Madrigosa was not found"); - if (Intro && Madrigosa){ if (!Madrigosa->isAlive()) EndIntro(); @@ -115,28 +97,22 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI } else EndIntro(); - if (pInstance) pInstance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(YELL_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(YELL_KILL1,YELL_KILL2,YELL_KILL3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(YELL_DEATH, m_creature); - if (pInstance) { pInstance->SetData(DATA_BRUTALLUS_EVENT, DONE); @@ -145,7 +121,6 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI m_creature->SummonCreature(FELMYST, x,y, z+30, m_creature->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); } } - void StartIntro() { if (!Intro) @@ -158,7 +133,6 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI } error_log("Start Intro"); } - void EndIntro() { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -166,12 +140,10 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI IsIntro = false; error_log("End Intro"); } - void DoIntro() { if (!Madrigosa) return; - switch (IntroPhase) { case 0: @@ -242,16 +214,13 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI break; } } - void MoveInLineOfSight(Unit *who) { if (pInstance && Intro) pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); - if (Intro && !IsIntro) StartIntro(); } - void UpdateAI(const uint32 diff) { if (IsIntro) @@ -259,7 +228,6 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI if (IntroPhaseTimer < diff) DoIntro(); else IntroPhaseTimer -= diff; - if (IntroPhase == 3 + 1) { if (IntroFrostBoltTimer < diff) @@ -272,50 +240,41 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI } else IntroFrostBoltTimer -= diff; } } - if (!UpdateVictim() || IsIntro) return; - if (SlashTimer < diff) { DoCast(m_creature->getVictim(), SPELL_METEOR_SLASH); SlashTimer = 11000; } else SlashTimer -= diff; - if (StompTimer < diff) { DoScriptText(RAND(YELL_LOVE1,YELL_LOVE2,YELL_LOVE3), m_creature); DoCast(m_creature->getVictim(), SPELL_STOMP); StompTimer = 30000; } else StompTimer -= diff; - if (BurnTimer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) target->CastSpell(target, SPELL_BURN, true); BurnTimer = 60000; } else BurnTimer -= diff; - if (BerserkTimer < diff && !Enraged) { DoScriptText(YELL_BERSERK, m_creature); DoCast(m_creature, SPELL_BERSERK); Enraged = true; } else BerserkTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_brutallus(Creature* pCreature) { return new boss_brutallusAI (pCreature); } - void AddSC_boss_brutallus() { Script *newscript; - newscript = new Script; newscript->Name = "boss_brutallus"; newscript->GetAI = &GetAI_boss_brutallus; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp index 1d46bba348b..332ef12a60d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Eredar_Twins SD%Complete: 100 SDComment: EndScriptData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - enum Quotes { //Alytesh @@ -32,7 +29,6 @@ enum Quotes YELL_ALY_KILL_2 = -1580047, YELL_ALY_DEAD = -1580048, YELL_BERSERK = -1580049, - //Sacrolash YELL_SHADOW_NOVA = -1580050, YELL_SISTER_ALYTHESS_DEAD = -1580051, @@ -40,7 +36,6 @@ enum Quotes YELL_SAC_KILL_2 = -1580053, SAY_SAC_DEAD = -1580054, YELL_ENRAGE = -1580055, - //Intro YELL_INTRO_SAC_1 = -1580056, YELL_INTRO_ALY_2 = -1580057, @@ -50,12 +45,10 @@ enum Quotes YELL_INTRO_ALY_6 = -1580061, YELL_INTRO_SAC_7 = -1580062, YELL_INTRO_ALY_8 = -1580063, - //Emote EMOTE_SHADOW_NOVA = -1580064, EMOTE_CONFLAGRATION = -1580065 }; - enum Spells { //Lady Sacrolash spells @@ -64,16 +57,13 @@ enum Spells SPELL_DARK_STRIKE = 45271, SPELL_SHADOW_NOVA = 45329, //30-35 secs SPELL_CONFOUNDING_BLOW = 45256, //25 secs - //Shadow Image spells SPELL_SHADOW_FURY = 45270, SPELL_IMAGE_VISUAL = 45263, - //Misc spells SPELL_ENRAGE = 46587, SPELL_EMPOWER = 45366, SPELL_DARK_FLAME = 45345, - //Grand Warlock Alythess spells SPELL_PYROGENICS = 45230, //15secs SPELL_FLAME_TOUCHED = 45348, @@ -83,37 +73,30 @@ enum Spells SPELL_BLAZE_SUMMON = 45236, //187366 GO SPELL_BLAZE_BURN = 45246 }; - enum Creatures { GRAND_WARLOCK_ALYTHESS = 25166, MOB_SHADOW_IMAGE = 25214, LADY_SACROLASH = 25165 }; - struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI { boss_sacrolashAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - bool SisterDeath; bool Enraged; - uint32 ShadowbladesTimer; uint32 ShadownovaTimer; uint32 ConfoundingblowTimer; uint32 ShadowimageTimer; uint32 ConflagrationTimer; uint32 EnrageTimer; - void Reset() { Enraged = false; - if (pInstance) { Unit* Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_ALYTHESS)); @@ -129,7 +112,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI } } } - if (!m_creature->isInCombat()) { ShadowbladesTimer = 10000; @@ -138,49 +120,40 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI ShadowimageTimer = 20000; ConflagrationTimer = 30000; EnrageTimer = 360000; - SisterDeath = false; } - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoZoneInCombat(); - if (pInstance) { Unit* Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isAlive() && !(Temp->getVictim())) CAST_CRE(Temp)->AI()->AttackStart(who); } - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { if (rand()%4 == 0) DoScriptText(RAND(YELL_SAC_KILL_1,YELL_SAC_KILL_2), m_creature); } - void JustDied(Unit* Killer) { // only if ALY death if (SisterDeath) { DoScriptText(SAY_SAC_DEAD, m_creature); - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); } else m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - void SpellHitTarget(Unit* target,const SpellEntry* spell) { switch(spell->Id) @@ -196,7 +169,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI break; } } - void HandleTouchedSpells(Unit* target, uint32 TouchedType) { switch(TouchedType) @@ -223,7 +195,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI break; } } - void UpdateAI(const uint32 diff) { if (!SisterDeath) @@ -241,10 +212,8 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI } } } - if (!UpdateVictim()) return; - if (SisterDeath) { if (ConflagrationTimer < diff) @@ -270,7 +239,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_SHADOW_NOVA); - if (!SisterDeath) { if (target) @@ -281,7 +249,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI } }else ShadownovaTimer -=diff; } - if (ConfoundingblowTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -293,12 +260,11 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI ConfoundingblowTimer = 20000 + (rand()%5000); } }else ConfoundingblowTimer -=diff; - if (ShadowimageTimer < diff) { Unit* target = NULL; Creature* temp = NULL; - for(uint8 i = 0;i<3; ++i) + for (uint8 i = 0; i<3; ++i) { target = SelectUnit(SELECT_TARGET_RANDOM, 0); temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); @@ -307,7 +273,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI } ShadowimageTimer = 20000; }else ShadowimageTimer -=diff; - if (ShadowbladesTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -316,7 +281,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI ShadowbladesTimer = 10000; } }else ShadowbladesTimer -=diff; - if (EnrageTimer < diff && !Enraged) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); @@ -324,7 +288,6 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI DoCast(m_creature,SPELL_ENRAGE); Enraged = true; }else EnrageTimer -= diff; - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { //If we are within range melee the target @@ -337,12 +300,10 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_sacrolash(Creature* pCreature) { return new boss_sacrolashAI (pCreature); }; - struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI { boss_alythessAI(Creature *c) : Scripted_NoMovementAI(c) @@ -350,26 +311,20 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI pInstance = c->GetInstanceData(); IntroStepCounter = 10; } - ScriptedInstance *pInstance; - bool SisterDeath; bool Enraged; - uint32 IntroStepCounter; uint32 IntroYellTimer; - uint32 ConflagrationTimer; uint32 BlazeTimer; uint32 PyrogenicsTimer; uint32 ShadownovaTimer; uint32 FlamesearTimer; uint32 EnrageTimer; - void Reset() { Enraged = false; - if (pInstance) { Unit* Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SACROLASH)); @@ -385,7 +340,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI } } } - if (!m_creature->isInCombat()) { ConflagrationTimer = 45000; @@ -395,29 +349,23 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI EnrageTimer = 360000; FlamesearTimer = 15000; IntroYellTimer = 10000; - SisterDeath = false; } - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoZoneInCombat(); - if (pInstance) { Unit* Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isAlive() && !(Temp->getVictim())) CAST_CRE(Temp)->AI()->AttackStart(who); } - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); } - void AttackStart(Unit *who) { if (!m_creature->isInCombat()) @@ -425,15 +373,12 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI Scripted_NoMovementAI::AttackStart(who); } } - void MoveInLineOfSight(Unit *who) { if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) { @@ -448,7 +393,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI IntroStepCounter = 0; } } - void KilledUnit(Unit *victim) { if (rand()%4 == 0) @@ -456,25 +400,21 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI DoScriptText(RAND(YELL_ALY_KILL_1,YELL_ALY_KILL_2), m_creature); } } - void JustDied(Unit* Killer) { if (SisterDeath) { DoScriptText(YELL_ALY_DEAD, m_creature); - if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); } else m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - void SpellHitTarget(Unit* target,const SpellEntry* spell) { switch(spell->Id) { - case SPELL_BLAZE: target->CastSpell(target, SPELL_BLAZE_SUMMON, true); case SPELL_CONFLAGRATION: @@ -486,7 +426,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI break; } } - void HandleTouchedSpells(Unit* target, uint32 TouchedType) { switch(TouchedType) @@ -516,7 +455,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI break; } } - uint32 IntroStep(uint32 step) { Creature* Sacrolash = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_SACROLASH) : 0); @@ -546,7 +484,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI } return 10000; } - void UpdateAI(const uint32 diff) { if (IntroStepCounter < 9) @@ -556,7 +493,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI IntroYellTimer = IntroStep(++IntroStepCounter); }else IntroYellTimer -= diff; } - if (!SisterDeath) { if (pInstance) @@ -572,10 +508,8 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI } } } - if (!UpdateVictim()) return; - if (SisterDeath) { if (ShadownovaTimer < diff) @@ -602,19 +536,16 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI if (target) DoCast(target, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); - if (!SisterDeath) { if (target) DoScriptText(EMOTE_CONFLAGRATION, m_creature, target); DoScriptText(YELL_CANFLAGRATION, m_creature); } - BlazeTimer = 4000; } }else ConflagrationTimer -= diff; } - if (FlamesearTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -623,7 +554,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI FlamesearTimer = 15000; } }else FlamesearTimer -=diff; - if (PyrogenicsTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -632,7 +562,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI PyrogenicsTimer = 15000; } }else PyrogenicsTimer -= diff; - if (BlazeTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -641,7 +570,6 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI BlazeTimer = 3800; } }else BlazeTimer -= diff; - if (EnrageTimer < diff && !Enraged) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); @@ -651,34 +579,27 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI }else EnrageTimer -= diff; } }; - CreatureAI* GetAI_boss_alythess(Creature* pCreature) { return new boss_alythessAI (pCreature); }; - struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI { mob_shadow_imageAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowfuryTimer; uint32 KillTimer; uint32 DarkstrikeTimer; - void Reset() { ShadowfuryTimer = 5000 + (rand()%15000); DarkstrikeTimer = 3000; KillTimer = 15000; } - void EnterCombat(Unit *who){} - void SpellHitTarget(Unit* target,const SpellEntry* spell) { switch(spell->Id) { - case SPELL_SHADOW_FURY: case SPELL_DARK_STRIKE: if (!target->HasAura(SPELL_DARK_FLAME)) @@ -692,27 +613,22 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI break; } } - void UpdateAI(const uint32 diff) { if (!m_creature->HasAura(SPELL_IMAGE_VISUAL)) DoCast(m_creature, SPELL_IMAGE_VISUAL); - if (KillTimer < diff) { m_creature->Kill(m_creature); KillTimer = 9999999; } else KillTimer -= diff; - if (!UpdateVictim()) return; - if (ShadowfuryTimer < diff) { DoCast(m_creature, SPELL_SHADOW_FURY); ShadowfuryTimer = 10000; } else ShadowfuryTimer -=diff; - if (DarkstrikeTimer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -725,26 +641,21 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI } else DarkstrikeTimer -= diff; } }; - CreatureAI* GetAI_mob_shadow_image(Creature* pCreature) { return new mob_shadow_imageAI (pCreature); }; - void AddSC_boss_eredar_twins() { Script *newscript; - newscript = new Script; newscript->Name = "boss_sacrolash"; newscript->GetAI = &GetAI_boss_sacrolash; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_alythess"; newscript->GetAI = &GetAI_boss_alythess; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadow_image"; newscript->GetAI = &GetAI_mob_shadow_image; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp index b81cbca3516..3d4338493ed 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Felmyst SD%Complete: 0 SDComment: EndScriptData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - enum Quotes { YELL_BIRTH = -1580036, @@ -34,13 +31,11 @@ enum Quotes YELL_DEATH = -1580042, YELL_KALECGOS = -1580043 //after felmyst's death spawned and say this }; - enum Spells { //Aura AURA_SUNWELL_RADIANCE = 45769, AURA_NOXIOUS_FUMES = 47002, - //Land phase SPELL_CLEAVE = 19983, SPELL_CORROSION = 45866, @@ -48,7 +43,6 @@ enum Spells SPELL_ENCAPSULATE_CHANNEL = 45661, // SPELL_ENCAPSULATE_EFFECT = 45665, // SPELL_ENCAPSULATE_AOE = 45662, - //Flight phase SPELL_VAPOR_SELECT = 45391, // fel to player, force cast 45392, 50000y selete target SPELL_VAPOR_SUMMON = 45392, // player summon vapor, radius around caster, 5y, @@ -67,18 +61,15 @@ enum Spells SPELL_FOG_INFORM = 45714, // player let fel cast 45717, script effect SPELL_FOG_CHARM = 45717, // fel to player SPELL_FOG_CHARM2 = 45726, // link to 45717 - SPELL_TRANSFORM_TRIGGER = 44885, // madrigosa to self, trigger 46350 SPELL_TRANSFORM_VISUAL = 46350, //46411stun? SPELL_TRANSFORM_FELMYST = 45068, // become fel SPELL_FELMYST_SUMMON = 45069, - //Other SPELL_BERSERK = 45078, SPELL_CLOUD_VISUAL = 45212, SPELL_CLOUD_SUMMON = 45884 }; - enum Creatures { MOB_FELMYST = 25038, @@ -93,43 +84,36 @@ enum Creatures MOB_VAPOR = 25265, MOB_VAPOR_TRAIL = 25267 }; - enum PhaseFelmyst { PHASE_NULL = 0, PHASE_GROUND = 1, PHASE_FLIGHT = 2, }; - enum EventFelmyst { EVENT_NULL = 0, EVENT_BERSERK = 1, - EVENT_CLEAVE = 2, EVENT_CORROSION = 3, EVENT_GAS_NOVA = 4, EVENT_ENCAPSULATE = 5, EVENT_FLIGHT = 6, - EVENT_FLIGHT_SEQUENCE = 2, EVENT_SUMMON_DEAD = 3, EVENT_SUMMON_FOG = 4 }; - static EventFelmyst MaxTimer[]= { EVENT_NULL, EVENT_FLIGHT, EVENT_SUMMON_FOG, }; - struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI { boss_felmystAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - // wait for core patch be accepted /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT); if (TempSpell->SpellIconID == 2294) @@ -141,35 +125,27 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) TempSpell->Attributes |= SPELL_ATTR_PASSIVE;*/ } - ScriptedInstance *pInstance; PhaseFelmyst Phase; EventFelmyst Event; uint32 Timer[EVENT_FLIGHT + 1]; - uint32 FlightCount; uint32 BreathCount; - float BreathX, BreathY; - void Reset() { Phase = PHASE_NULL; Event = EVENT_NULL; Timer[EVENT_BERSERK] = 600000; FlightCount = 0; - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); m_creature->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - DespawnSummons(MOB_VAPOR_TRAIL); m_creature->setActive(false); - if (pInstance) pInstance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { m_creature->setActive(true); @@ -177,41 +153,33 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI m_creature->CastSpell(m_creature, AURA_SUNWELL_RADIANCE, true); m_creature->CastSpell(m_creature, AURA_NOXIOUS_FUMES, true); EnterPhase(PHASE_GROUND); - if (pInstance) pInstance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); } - void AttackStart(Unit *who) { if (Phase != PHASE_FLIGHT) ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit *who) { if (Phase != PHASE_FLIGHT) ScriptedAI::MoveInLineOfSight(who); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(YELL_KILL1,YELL_KILL2), m_creature); } - void JustRespawned() { DoScriptText(YELL_BIRTH, m_creature); } - void JustDied(Unit* Killer) { DoScriptText(YELL_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_FELMYST_EVENT, DONE); } - void SpellHit(Unit *caster, const SpellEntry *spell) { // workaround for linked aura @@ -234,7 +202,6 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI m_creature->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - void JustSummoned(Creature *summon) { if (summon->GetEntry() == MOB_DEAD) @@ -244,18 +211,15 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true); } } - void MovementInform(uint32, uint32) { Timer[EVENT_FLIGHT_SEQUENCE] = 1; } - void DamageTaken(Unit*, uint32 &damage) { if (Phase != PHASE_GROUND && damage >= m_creature->GetHealth()) damage = 0; } - void EnterPhase(PhaseFelmyst NextPhase) { switch(NextPhase) @@ -279,7 +243,6 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI } Phase = NextPhase; } - void HandleFlightSequence() { switch(FlightCount) @@ -421,7 +384,6 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI } FlightCount++; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -430,9 +392,8 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI EnterEvadeMode(); return; } - Event = EVENT_NULL; - for(uint32 i = 1; i <= MaxTimer[Phase]; ++i) + for (uint32 i = 1; i <= MaxTimer[Phase]; ++i) { if (Timer[i]) if (Timer[i] <= diff) @@ -441,10 +402,8 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI Event = (EventFelmyst)i; }else Timer[i] -= diff; } - if (m_creature->IsNonMeleeSpellCasted(false)) return; - if (Phase == PHASE_GROUND) { switch(Event) @@ -480,7 +439,6 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI break; } } - if (Phase == PHASE_FLIGHT) { switch(Event) @@ -511,29 +469,23 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI } } } - void DespawnSummons(uint32 entry) { std::list templist; float x, y, z; m_creature->GetPosition(x, y, z); - { CellPair pair(Trinity::ComputeCellPair(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, 100); Trinity::CreatureListSearcher searcher(m_creature, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap())); } - - for(std::list::iterator i = templist.begin(); i != templist.end(); ++i) + for (std::list::iterator i = templist.begin(); i != templist.end(); ++i) { if (entry == MOB_VAPOR_TRAIL && Phase == PHASE_FLIGHT) { @@ -547,7 +499,6 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_felmyst_vaporAI : public ScriptedAI { mob_felmyst_vaporAI(Creature *c) : ScriptedAI(c) @@ -567,7 +518,6 @@ struct TRINITY_DLL_DECL mob_felmyst_vaporAI : public ScriptedAI AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } }; - struct TRINITY_DLL_DECL mob_felmyst_trailAI : public ScriptedAI { mob_felmyst_trailAI(Creature *c) : ScriptedAI(c) @@ -583,22 +533,18 @@ struct TRINITY_DLL_DECL mob_felmyst_trailAI : public ScriptedAI void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) {} }; - CreatureAI* GetAI_boss_felmyst(Creature* pCreature) { return new boss_felmystAI(pCreature); } - CreatureAI* GetAI_mob_felmyst_vapor(Creature* pCreature) { return new mob_felmyst_vaporAI(pCreature); } - CreatureAI* GetAI_mob_felmyst_trail(Creature* pCreature) { return new mob_felmyst_trailAI(pCreature); } - void AddSC_boss_felmyst() { Script *newscript; @@ -606,12 +552,10 @@ void AddSC_boss_felmyst() newscript->Name = "boss_felmyst"; newscript->GetAI = &GetAI_boss_felmyst; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_felmyst_vapor"; newscript->GetAI = &GetAI_mob_felmyst_vapor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_felmyst_trail"; newscript->GetAI = &GetAI_mob_felmyst_trail; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp index 22328334919..2fcfdb43a5d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kalecgos SD%Complete: 95 SDComment: SDCategory: Sunwell_Plateau EndScriptData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - enum Quotes { //Kalecgos dragon form @@ -33,13 +30,11 @@ enum Quotes SAY_EVIL_SLAY1 = -1580003, SAY_EVIL_SLAY2 = -1580004, SAY_EVIL_ENRAGE = -1580005, - //Kalecgos humanoid form SAY_GOOD_AGGRO = -1580006, SAY_GOOD_NEAR_DEATH = -1580007, SAY_GOOD_NEAR_DEATH2 = -1580008, SAY_GOOD_PLRWIN = -1580009, - //Shattrowar SAY_SATH_AGGRO = -1580010, SAY_SATH_DEATH = -1580011, @@ -49,7 +44,6 @@ enum Quotes SAY_SATH_SLAY2 = -1580015, SAY_SATH_ENRAGE = -1580016 }; - enum SpellIds { AURA_SUNWELL_RADIANCE = 45769, @@ -57,25 +51,20 @@ enum SpellIds AURA_SPECTRAL_REALM = 46021, AURA_SPECTRAL_INVISIBILITY = 44801, AURA_DEMONIC_VISUAL = 44800, - SPELL_SPECTRAL_BLAST = 44869, SPELL_TELEPORT_SPECTRAL = 46019, SPELL_ARCANE_BUFFET = 45018, SPELL_FROST_BREATH = 44799, SPELL_TAIL_LASH = 45122, - SPELL_BANISH = 44836, SPELL_TRANSFORM_KALEC = 44670, SPELL_ENRAGE = 44807, - SPELL_CORRUPTION_STRIKE = 45029, SPELL_AGONY_CURSE = 45032, SPELL_SHADOW_BOLT = 45031, - SPELL_HEROIC_STRIKE = 45026, SPELL_REVITALIZE = 45027 }; - enum Creatures { MOB_KALECGOS = 24850, @@ -88,26 +77,18 @@ enum SWPActions DO_BANISH = 2 }; - #define GO_FAILED "You are unable to use this currently." - #define EMOTE_UNABLE_TO_FIND "is unable to find Kalecgos" - #define FLY_X 1679 #define FLY_Y 900 #define FLY_Z 82 - #define CENTER_X 1705 #define CENTER_Y 930 #define RADIUS 30 - #define DRAGON_REALM_Z 53.079 #define DEMON_REALM_Z -74.558 - #define MAX_PLAYERS_IN_SPECTRAL_REALM 0 //over this, teleport object won't work, 0 disables check - uint32 WildMagic[]= { 44978, 45001, 45002, 45004, 45006, 45010 }; - struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI { boss_kalecgosAI(Creature *c) : ScriptedAI(c) @@ -121,9 +102,7 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI if (TempSpell) TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; } - ScriptedInstance *pInstance; - uint32 ArcaneBuffetTimer; uint32 FrostBreathTimer; uint32 WildMagicTimer; @@ -133,15 +112,12 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI uint32 TalkTimer; uint32 TalkSequence; uint32 ResetTimer; - bool isFriendly; bool isEnraged; bool isBanished; bool JustReseted; - uint64 SathGUID; uint64 DoorGUID; - void Reset() { if (pInstance) @@ -149,12 +125,10 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI SathGUID = pInstance->GetData64(DATA_SATHROVARR); pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); } - if(Creature *Sath = Unit::GetCreature(*me, SathGUID)) Sath->AI()->EnterEvadeMode(); - me->setFaction(14); - if(!JustReseted)//first reset at create + if(!JustReseted) //first reset at create { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); @@ -169,14 +143,12 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI SpectralBlastTimer = 20000+(rand()%5000); CheckTimer = 1000; ResetTimer = 30000; - TalkTimer = 0; TalkSequence = 0; isFriendly = false; isEnraged = false; isBanished = false; } - void EnterEvadeMode() { JustReseted = true; @@ -184,7 +156,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); ScriptedAI::EnterEvadeMode(); } - void DoAction(const int32 param) { switch (param) @@ -199,7 +170,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI break; } } - void UpdateAI(const uint32 diff) { if (TalkTimer) @@ -239,7 +209,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI } if (!UpdateVictim()) return; - if (CheckTimer < diff) { if(me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) @@ -274,36 +243,31 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI } CheckTimer = 1000; }else CheckTimer -= diff; - if (ArcaneBuffetTimer < diff) { DoCastAOE(SPELL_ARCANE_BUFFET); ArcaneBuffetTimer = 8000; }else ArcaneBuffetTimer -= diff; - if (FrostBreathTimer < diff) { DoCastAOE(SPELL_FROST_BREATH); FrostBreathTimer = 15000; }else FrostBreathTimer -= diff; - if (TailLashTimer < diff) { DoCastAOE(SPELL_TAIL_LASH); TailLashTimer = 15000; }else TailLashTimer -= diff; - if (WildMagicTimer < diff) { DoCastAOE(WildMagic[rand()%6]); WildMagicTimer = 20000; }else WildMagicTimer -= diff; - if (SpectralBlastTimer < diff) { std::list &m_threatlist = me->getThreatManager().getThreatList(); std::list targetList; - for(std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) + for (std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) targetList.push_back((*itr)->getTarget()); if(targetList.empty()) @@ -319,14 +283,12 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI SpectralBlastTimer = 20000+rand()%5000; }else SpectralBlastTimer = 1000; }else SpectralBlastTimer -= diff; - DoMeleeAttackIfReady(); } } - void MoveInLineOfSight(Unit *who) { - if(JustReseted)//boss is invisible, don't attack + if(JustReseted) //boss is invisible, don't attack return; if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who))) { @@ -337,28 +299,23 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI } } } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= me->GetHealth() && done_by != me) damage = 0; } - void EnterCombat(Unit* who) { me->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_EVIL_AGGRO, me); DoZoneInCombat(); - if (pInstance) pInstance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_EVIL_SLAY1,SAY_EVIL_SLAY2), me); } - void MovementInform(uint32 type,uint32 id) { me->SetVisibility(VISIBILITY_OFF); @@ -370,7 +327,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI TalkTimer = 1000; } } - void GoodEnding() { switch(TalkSequence) @@ -392,7 +348,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI break; } } - void BadEnding() { switch(TalkSequence) @@ -414,7 +369,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI { boss_sathrovarrAI(Creature *c) : ScriptedAI(c) @@ -423,21 +377,16 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI KalecGUID = 0; KalecgosGUID = 0; } - ScriptedInstance *pInstance; - uint32 CorruptionStrikeTimer; uint32 AgonyCurseTimer; uint32 ShadowBoltTimer; uint32 CheckTimer; uint32 ResetThreat; - uint64 KalecGUID; uint64 KalecgosGUID; - bool isEnraged; bool isBanished; - void Reset() { me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. @@ -453,7 +402,6 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI Kalec->setDeathState(JUST_DIED); KalecGUID = 0; } - ShadowBoltTimer = 7000 + rand()%3 * 1000; AgonyCurseTimer = 20000; CorruptionStrikeTimer = 13000; @@ -461,11 +409,9 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI ResetThreat = 1000; isEnraged = false; isBanished = false; - me->CastSpell(me, AURA_DEMONIC_VISUAL, true); TeleportAllPlayersBack(); } - void EnterCombat(Unit* who) { if(Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) @@ -477,13 +423,11 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI } DoScriptText(SAY_SATH_AGGRO, me); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= me->GetHealth() && done_by != me) damage = 0; } - void KilledUnit(Unit *target) { if (target->GetGUID() == KalecGUID) @@ -499,7 +443,6 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI } DoScriptText(RAND(SAY_SATH_SLAY1,SAY_SATH_SLAY2), me); } - void JustDied(Unit *killer) { DoScriptText(SAY_SATH_DEATH, me); @@ -510,17 +453,15 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI CAST_AI(boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; CAST_AI(boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; } - if (pInstance) pInstance->SetData(DATA_KALECGOS_EVENT, DONE); } - void TeleportAllPlayersBack() { Map* pMap = me->GetMap(); if (!pMap->IsDungeon()) return; Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if(i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5) { @@ -529,7 +470,6 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI } } } - void DoAction(const int32 param) { switch (param) @@ -544,14 +484,12 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI break; } } - void UpdateAI(const uint32 diff) { if(!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; - if (CheckTimer < diff) { Creature *Kalec = Unit::GetCreature(*me, KalecGUID); @@ -597,10 +535,9 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI } CheckTimer = 1000; }else CheckTimer -= diff; - if (ResetThreat < diff) { - for(std::list::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + for (std::list::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { @@ -612,14 +549,12 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI } ResetThreat = 1000; }else ResetThreat -= diff; - if (ShadowBoltTimer < diff) { if(!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); }else ShadowBoltTimer -= diff; - if (AgonyCurseTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -627,49 +562,38 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI DoCast(target, SPELL_AGONY_CURSE); AgonyCurseTimer = 20000; }else AgonyCurseTimer -= diff; - if (CorruptionStrikeTimer < diff) { if(!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; }else CorruptionStrikeTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_kalecAI : public ScriptedAI { ScriptedInstance *pInstance; - uint32 RevitalizeTimer; uint32 HeroicStrikeTimer; uint32 YellTimer; uint32 YellSequence; - uint64 SathGUID; - bool isEnraged; // if demon is enraged - boss_kalecAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - void Reset() { if (pInstance) SathGUID = pInstance->GetData64(DATA_SATHROVARR); - RevitalizeTimer = 5000; HeroicStrikeTimer = 3000; YellTimer = 5000; YellSequence = 0; - isEnraged = false; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetGUID() != SathGUID) @@ -677,14 +601,12 @@ struct TRINITY_DLL_DECL boss_kalecAI : public ScriptedAI else if (isEnraged) damage *= 3; } - void UpdateAI(const uint32 diff) { if(!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; - if (YellTimer < diff) { switch(YellSequence) @@ -712,30 +634,26 @@ struct TRINITY_DLL_DECL boss_kalecAI : public ScriptedAI } YellTimer = 5000; } - if (RevitalizeTimer < diff) { DoCast(me, SPELL_REVITALIZE); RevitalizeTimer = 5000; }else RevitalizeTimer -= diff; - if (HeroicStrikeTimer < diff) { DoCast(me->getVictim(), SPELL_HEROIC_STRIKE); HeroicStrikeTimer = 2000; }else HeroicStrikeTimer -= diff; - DoMeleeAttackIfReady(); } }; - bool GOkalecgos_teleporter(Player* pPlayer, GameObject* pGo) { uint32 SpectralPlayers = 0; Map* pMap = pGo->GetMap(); if (!pMap->IsDungeon()) return true; Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if(i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5) SpectralPlayers++; @@ -746,22 +664,18 @@ bool GOkalecgos_teleporter(Player* pPlayer, GameObject* pGo) pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_SPECTRAL, true); return true; } - CreatureAI* GetAI_boss_kalecgos(Creature* pCreature) { return new boss_kalecgosAI (pCreature); } - CreatureAI* GetAI_boss_Sathrovarr(Creature* pCreature) { return new boss_sathrovarrAI (pCreature); } - CreatureAI* GetAI_boss_kalec(Creature* pCreature) { return new boss_kalecAI (pCreature); } - void AddSC_boss_kalecgos() { Script *newscript; @@ -769,17 +683,14 @@ void AddSC_boss_kalecgos() newscript->Name = "boss_kalecgos"; newscript->GetAI = &GetAI_boss_kalecgos; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_sathrovarr"; newscript->GetAI = &GetAI_boss_Sathrovarr; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_kalec"; newscript->GetAI = &GetAI_boss_kalec; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "kalecgos_teleporter"; newscript->pGOHello = &GOkalecgos_teleporter; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp index 3bb91d52110..84627aca7c7 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kiljaeden SD%Complete: 70 SDComment: Phase4, Phase5, Shadow Spike, Armageddon SDCategory: Sunwell_Plateau EndScriptData */ - //TODO rewrite Amagedon //TODO Remove blue visual from Orbs on reset and if it is used - #include "precompiled.h" #include "def_sunwell_plateau.h" #include - /*** Speech and sounds***/ enum Speeches { @@ -37,7 +33,6 @@ enum Speeches SAY_KJ_OFFCOMBAT3 = -1580068, SAY_KJ_OFFCOMBAT4 = -1580069, SAY_KJ_OFFCOMBAT5 = -1580070, - // Encounter speech and sounds SAY_KJ_EMERGE = -1580071, SAY_KJ_SLAY1 = -1580072, @@ -52,7 +47,6 @@ enum Speeches SAY_KJ_PHASE5 = -1580081, SAY_KJ_DEATH = -1580093, EMOTE_KJ_DARKNESS = -1580094, - /*** Kalecgos - Anveena speech at the beginning of Phase 5; Anveena's sacrifice ***/ SAY_KALECGOS_AWAKEN = -1580082, SAY_ANVEENA_IMPRISONED = -1580083, @@ -64,7 +58,6 @@ enum Speeches SAY_ANVEENA_GOODBYE = -1580089, SAY_KALECGOS_GOODBYE = -1580090, SAY_KALECGOS_ENCOURAGE = -1580091, - /*** Kalecgos says throughout the fight ***/ SAY_KALECGOS_JOIN = -1580092, SAY_KALEC_ORB_READY1 = -1580095, @@ -72,7 +65,6 @@ enum Speeches SAY_KALEC_ORB_READY3 = -1580097, SAY_KALEC_ORB_READY4 = -1580098 }; - /*** Spells used during the encounter ***/ enum SpellIds { @@ -81,10 +73,8 @@ enum SpellIds SPELL_SHADOW_INFUSION = 45772, // They gain this at 20% - Immunity to Stun/Silence and makes them look angry! SPELL_FELFIRE_PORTAL = 46875, // Creates a portal that spawns Felfire Fiends (LIVE FOR THE SWARM!1 FOR THE OVERMIND!) SPELL_SHADOW_CHANNELING = 46757, // Channeling animation out of combat - /* Volatile Felfire Fiend's spells */ SPELL_FELFIRE_FISSION = 45779, // Felfire Fiends explode when they die or get close to target. - /* Kil'Jaeden's spells and cosmetics */ SPELL_TRANS = 23188, // Surprisingly, this seems to be the right spell.. (Where is it used?) SPELL_REBIRTH = 44200, // Emerge from the Sunwell @@ -92,18 +82,15 @@ enum SpellIds SPELL_SOUL_FLAY_SLOW = 47106, SPELL_LEGION_LIGHTNING = 45664, // Chain Lightning, 4 targets, ~3k Shadow damage, 1.5k mana burn SPELL_FIRE_BLOOM = 45641, // Places a debuff on 5 raid members, which causes them to deal 2k Fire damage to nearby allies and selves. MIGHT NOT WORK - SPELL_SINISTER_REFLECTION = 45785, // Summon shadow copies of 5 raid members that fight against KJ's enemies SPELL_COPY_WEAPON = 41055, // } SPELL_COPY_WEAPON2 = 41054, // } SPELL_COPY_OFFHAND = 45206, // }- Spells used in Sinister Reflection creation SPELL_COPY_OFFHAND_WEAPON = 45205, // } - SPELL_SHADOW_SPIKE = 46680, // Bombard random raid members with Shadow Spikes (Very similar to Void Reaver orbs) SPELL_FLAME_DART = 45737, // Bombards the raid with flames every 3(?) seconds SPELL_DARKNESS_OF_A_THOUSAND_SOULS = 46605, // Begins a 8-second channeling, after which he will deal 50'000 damage to the raid SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE = 45657, - /* Armageddon spells wrong visual */ SPELL_ARMAGEDDON_TRIGGER = 45909, // Meteor spell trigger missile should cast Creature on himself SPELL_ARMAGEDDON_VISUAL = 45911, // Does the hellfire visual to indicate where the meteor missle lands @@ -111,47 +98,34 @@ enum SpellIds SPELL_ARMAGEDDON_VISUAL3 = 24207, // This shouldn't correct but same as seen on the movie SPELL_ARMAGEDDON_SUMMON_TRIGGER = 45921, // Summons the triggers that cast the spells on himself need random target select SPELL_ARMAGEDDON_DAMAGE = 45915, // This does the area damage - /* Shield Orb Spells*/ SPELL_SHADOW_BOLT = 45680, //45679 would be correct but triggers to often //TODO fix console error - /* Anveena's spells and cosmetics (Or, generally, everything that has "Anveena" in name) */ SPELL_ANVEENA_PRISON = 46367, // She hovers locked within a bubble SPELL_ANVEENA_ENERGY_DRAIN = 46410, // Sunwell energy glow animation (Control mob uses this) SPELL_SACRIFICE_OF_ANVEENA = 46474, // This is cast on Kil'Jaeden when Anveena sacrifices herself into the Sunwell - /* Sinister Reflection Spells */ SPELL_SR_CURSE_OF_AGONY = 46190, SPELL_SR_SHADOW_BOLT = 47076, - SPELL_SR_EARTH_SHOCK = 47071, - SPELL_SR_FIREBALL = 47074, - SPELL_SR_HEMORRHAGE = 45897, - SPELL_SR_HOLY_SHOCK = 38921, SPELL_SR_HAMMER_OF_JUSTICE = 37369, - SPELL_SR_HOLY_SMITE = 47077, SPELL_SR_RENEW = 47079, - SPELL_SR_SHOOT = 16496, SPELL_SR_MULTI_SHOT = 48098, SPELL_SR_WING_CLIP = 40652, - SPELL_SR_WHIRLWIND = 17207, - SPELL_SR_MOONFIRE = 47072, //SPELL_SR_PLAGU STRIKE = 58843, Dk Spell! - /*** Other Spells (used by players, etc) ***/ SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT = 45839, // Possess the blue dragon from the orb to help the raid. SPELL_ENTROPIUS_BODY = 46819, // Visual for Entropius at the Epilogue SPELL_RING_OF_BLUE_FLAMES = 45825 //Cast this spell when the go is activated }; - enum CreatureIds { CREATURE_ANVEENA = 26046, // Embodiment of the Sunwell @@ -169,17 +143,13 @@ enum CreatureIds CREATURE_SPIKE_TARGET2 = 30614, CREATURE_SINISTER_REFLECTION = 25708 //Sinister Relection spawnd on Phase swichtes }; - /*** GameObjects ***/ #define GAMEOBJECT_ORB_OF_THE_BLUE_DRAGONFLIGHT 188415 - /*** Error messages ***/ #define ERROR_KJ_NOT_SUMMONED "TSCR ERROR: Unable to summon Kil'Jaeden for some reason" - /*** Others ***/ #define FLOOR_Z 28.050388 #define SHIELD_ORB_Z 45.000 - enum Phase { PHASE_DECEIVERS = 1, // Fight 3 adds @@ -188,27 +158,22 @@ enum Phase PHASE_ARMAGEDDON = 4, // At 55%, he gains even more abilities PHASE_SACRIFICE = 5, // At 25%, Anveena sacrifices herself into the Sunwell; at this point he becomes enraged and has *significally* shorter cooldowns. }; - //Timers enum KilJaedenTimers { TIMER_KALEC_JOIN = 0, - //Phase 2 Timer TIMER_SOUL_FLAY = 1, TIMER_LEGION_LIGHTNING = 2, TIMER_FIRE_BLOOM = 3, TIMER_SUMMON_SHILEDORB = 4, - //Phase 3 Timer TIMER_SHADOW_SPIKE = 5, TIMER_FLAME_DART = 6, TIMER_DARKNESS = 7, TIMER_ORBS_EMPOWER = 8, - //Phase 4 Timer TIMER_ARMAGEDDON = 9 }; - // Locations of the Hand of Deceiver adds float DeceiverLocations[3][3]= { @@ -216,7 +181,6 @@ float DeceiverLocations[3][3]= {1684.099, 618.848, 0.589}, {1694.170, 612.272, 1.416}, }; - // Locations, where Shield Orbs will spawn float ShieldOrbLocations[4][2]= { @@ -225,14 +189,12 @@ float ShieldOrbLocations[4][2]= {12, 3.14/0.7}, // Second one spawns southeast {12, 3.14*3.8} // Third one spawns (?) }; - float OrbLocations[4][5] = { (1694.48, 674.29, 28.0502, 4.86985), (1745.68, 621.823, 28.0505, 2.93777), (1704.14, 583.591, 28.1696, 1.59003), (1653.12, 635.41, 28.0932, 0.0977725), }; - struct Speech { int32 textid; @@ -253,7 +215,6 @@ static Speech Sacrifice[]= {SAY_KJ_PHASE5, CREATURE_KILJAEDEN, 8000}, {SAY_KALECGOS_ENCOURAGE, CREATURE_KALECGOS, 5000} }; - class AllOrbsInGrid { public: @@ -265,7 +226,6 @@ public: return false; } }; - bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo) { if (pGo->GetUInt32Value(GAMEOBJECT_FACTION) == 35) @@ -282,7 +242,7 @@ bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo) pGo->GetPosition(x,y,z); // this won't work. need rewritten /* - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (DynamicObject* Dyn = Kalec->GetDynObject(SPELL_RING_OF_BLUE_FLAMES)) { @@ -299,7 +259,6 @@ bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo) } return true; } - //AI for Kalecgos struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI { @@ -307,16 +266,13 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - GameObject* Orb[4]; ScriptedInstance* pInstance; uint8 OrbsEmpowered; uint8 EmpowerCount; - bool Searched; - void InitializeAI(){ - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) Orb[i] = NULL; FindOrbs(); OrbsEmpowered = 0; @@ -326,12 +282,9 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI m_creature->setActive(true); Searched = false; FindOrbs(); - ScriptedAI::InitializeAI(); } - void Reset(){} - void FindOrbs() { CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); @@ -347,18 +300,16 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI if (orbList.empty()) return; uint8 i = 0; - for(std::list::iterator itr = orbList.begin(); itr != orbList.end(); ++itr, ++i){ + for (std::list::iterator itr = orbList.begin(); itr != orbList.end(); ++itr, ++i){ Orb[i] = pInstance ? pInstance->instance->GetGameObject(pInstance->GetData64((*itr)->GetGUID())) : NULL; } } - void ResetOrbs() { m_creature->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) if (Orb[i]) Orb[i]->SetUInt32Value(GAMEOBJECT_FACTION, 0); } - void EmpowerOrb(bool all) { if (!Orb[OrbsEmpowered]) @@ -367,7 +318,7 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI if (all) { m_creature->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (!Orb[i]) return; Orb[i]->CastSpell(m_creature, SPELL_RING_OF_BLUE_FLAMES); @@ -382,7 +333,7 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI /* float x,y,z, dx,dy,dz; Orb[random]->GetPosition(x,y,z); - for(uint8 i = 0; i < 4; ++i){ + for (uint8 i = 0; i < 4; ++i){ DynamicObject* Dyn = m_creature->GetDynObject(SPELL_RING_OF_BLUE_FLAMES); if (Dyn){ Dyn->GetPosition(dx,dy,dz); @@ -402,7 +353,6 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI ++OrbsEmpowered; } ++EmpowerCount; - switch(EmpowerCount) { case 1: DoScriptText(SAY_KALEC_ORB_READY1, m_creature); break; @@ -411,7 +361,6 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI case 4: DoScriptText(SAY_KALEC_ORB_READY4, m_creature); break; } } - void UpdateAI(const uint32 diff) { if (!Searched) @@ -419,17 +368,14 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI FindOrbs(); Searched = true; } - if (OrbsEmpowered == 4) OrbsEmpowered = 0; } }; - CreatureAI* GetAI_boss_kalecgos_kj(Creature* pCreature) { return new boss_kalecgos_kjAI (pCreature); } - //AI for Kil'jaeden struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI { @@ -437,72 +383,57 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; SummonList Summons; Creature* Kalec; Unit* randomPlayer; - uint8 Phase; uint8 ActiveTimers; - uint32 Timer[10]; uint32 WaitTimer; - /* Boolean */ bool IsKalecJoined; bool IsInDarkness; bool TimerIsDeactiveted[10]; bool IsWaiting; bool OrbActivated; - void Reset() { // TODO: Fix timers Timer[TIMER_KALEC_JOIN] = 26000; - //Phase 2 Timer Timer[TIMER_SOUL_FLAY] = 20000; Timer[TIMER_LEGION_LIGHTNING] = 40000; Timer[TIMER_FIRE_BLOOM] = 30000; Timer[TIMER_SUMMON_SHILEDORB] = 45000; - //Phase 3 Timer Timer[TIMER_SHADOW_SPIKE] = 4000; Timer[TIMER_FLAME_DART] = 3000; Timer[TIMER_DARKNESS] = 45000; Timer[TIMER_ORBS_EMPOWER] = 35000; - //Phase 4 Timer Timer[TIMER_ARMAGEDDON] = 2000; - ActiveTimers = 5; WaitTimer = 0; - Phase = PHASE_DECEIVERS; - IsKalecJoined = false; IsInDarkness = false; IsWaiting = false; OrbActivated = false; - if(pInstance) Kalec = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KALECGOS_KJ))); ChangeTimers(false, 0); } - void ChangeTimers(bool status, uint32 WTimer) { - for(uint8 i = 0; i < 10; ++i) + for (uint8 i = 0; i < 10; ++i) TimerIsDeactiveted[i] = status; TimerIsDeactiveted[TIMER_KALEC_JOIN] = IsKalecJoined; - if (WTimer > 0) { IsWaiting = true; WaitTimer = WTimer; } - if (OrbActivated) TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true; if (Timer[TIMER_SHADOW_SPIKE] == 0) @@ -510,59 +441,53 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI if (Phase == PHASE_SACRIFICE) TimerIsDeactiveted[TIMER_SUMMON_SHILEDORB] = true; } - void JustSummoned(Creature* summoned) { if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) { summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - }else{ + } + else + { summoned->SetLevel(m_creature->getLevel()); } summoned->setFaction(m_creature->getFaction()); Summons.Summon(summoned); } - void JustDied(Unit* killer) { DoScriptText(SAY_KJ_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_KILJAEDEN_EVENT, DONE); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), m_creature); } - void EnterEvadeMode() { Scripted_NoMovementAI::EnterEvadeMode(); Summons.DespawnAll(); - // Reset the controller if (pInstance) if(Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)))) CAST_AI(Scripted_NoMovementAI, Control->AI())->Reset(); } - void EnterCombat(Unit* who) { DoZoneInCombat(); DoScriptText(SAY_KJ_EMERGE, m_creature); } - void CastSinisterReflection() { DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), m_creature); DoCast(m_creature, SPELL_SINISTER_REFLECTION, true); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { float x,y,z; Unit* target; - for(uint8 z = 0; z < 6; ++z) + for (uint8 z = 0; z < 6; ++z) { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; @@ -573,12 +498,10 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI SinisterReflection->AI()->AttackStart(target); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim() || Phase < PHASE_NORMAL) return; - if (IsWaiting) { if (WaitTimer < diff) @@ -587,8 +510,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI ChangeTimers(false, 0); } else WaitTimer -= diff; } - - for(uint8 t = 0; t < ActiveTimers; ++t) + for (uint8 t = 0; t < ActiveTimers; ++t) { if (Timer[t] < diff && !TimerIsDeactiveted[t]) { @@ -614,7 +536,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI if (!m_creature->IsNonMeleeSpellCasted(false)) { m_creature->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); - for(uint8 z = 0; z < 6; ++z) + for (uint8 z = 0; z < 6; ++z) { randomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!randomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; @@ -637,7 +559,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } break; case TIMER_SUMMON_SHILEDORB: - for(uint8 i = 1; i < Phase; ++i) + for (uint8 i = 1; i < Phase; ++i) { float sx, sy; sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); @@ -704,7 +626,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI break; case TIMER_ARMAGEDDON: //Phase 4 Unit* target; - for(uint8 z = 0; z < 6; ++z) + for (uint8 z = 0; z < 6; ++z) { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; @@ -722,13 +644,12 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } } //Time runs over! - for(uint8 i = 0; i < ActiveTimers; ++i) + for (uint8 i = 0; i < ActiveTimers; ++i) if (!TimerIsDeactiveted[i]) { Timer[i] -= diff; if (((int32)Timer[i]) < 0) Timer[i] = 0; } - //Phase 3 if (Phase <= PHASE_NORMAL) { @@ -742,7 +663,6 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } else return; } - //Phase 4 if (Phase <= PHASE_DARKNESS) { @@ -755,7 +675,6 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } else return; } - //Phase 5 specific spells all we can if (Phase <= PHASE_ARMAGEDDON) { @@ -770,15 +689,12 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } else return; } - } }; - CreatureAI* GetAI_boss_kiljaeden(Creature* pCreature) { return new boss_kiljaedenAI (pCreature); } - //AI for Kil'jaeden Event Controller struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementAI { @@ -786,18 +702,14 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; Creature* KalecKJ; SummonList Summons; - bool SummonedDeceivers; bool KiljaedenDeath; - uint32 RandomSayTimer; uint32 Phase; uint8 DeceiverDeathCount; - void InitializeAI() { if(pInstance) @@ -805,10 +717,8 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->addUnitState(UNIT_STAT_STUNNED); - ScriptedAI::InitializeAI(); } - void Reset() { Phase = PHASE_DECEIVERS; @@ -820,7 +730,6 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA RandomSayTimer = 30000; Summons.DespawnAll(); } - void JustSummoned(Creature* summoned) { switch(summoned->GetEntry()) @@ -841,7 +750,6 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA } Summons.Summon(summoned); } - void UpdateAI(const uint32 diff) { if (RandomSayTimer < diff && pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) @@ -849,17 +757,14 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), m_creature); RandomSayTimer = 30000; } else RandomSayTimer -= diff; - if (!SummonedDeceivers) { for (uint8 i = 0; i < 3; ++i) m_creature->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i][0], DeceiverLocations[i][1], FLOOR_Z, DeceiverLocations[i][2], TEMPSUMMON_DEAD_DESPAWN, 0); - DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); DoCast(m_creature, SPELL_ANVEENA_ENERGY_DRAIN); SummonedDeceivers = true; } - if (DeceiverDeathCount > 2 && Phase == PHASE_DECEIVERS) { m_creature->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); @@ -868,12 +773,10 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA } } }; - CreatureAI* GetAI_mob_kiljaeden_controller(Creature* pCreature) { return new mob_kiljaeden_controllerAI (pCreature); } - //AI for Hand of the Deceiver struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI { @@ -882,10 +785,8 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI pInstance = c->GetInstanceData(); } ScriptedInstance* pInstance; - uint32 ShadowBoltVolleyTimer; uint32 FelfirePortalTimer; - void Reset() { // TODO: Timers! @@ -894,13 +795,11 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); } - void JustSummoned(Creature* summoned) { summoned->setFaction(m_creature->getFaction()); summoned->SetLevel(m_creature->getLevel()); } - void EnterCombat(Unit* who) { if (pInstance) @@ -911,41 +810,34 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI } m_creature->InterruptNonMeleeSpells(true); } - void JustDied(Unit* killer) { if (!pInstance) return; - if (Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)))) ++(CAST_AI(mob_kiljaeden_controllerAI, Control->AI())->DeceiverDeathCount); } - void UpdateAI(const uint32 diff) { if (!me->isInCombat()) DoCast(m_creature, SPELL_SHADOW_CHANNELING); - if (!UpdateVictim()) return; - // Gain Shadow Infusion at 20% health if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20) && !m_creature->HasAura(SPELL_SHADOW_INFUSION, 0)) DoCast(m_creature, SPELL_SHADOW_INFUSION, true); - // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. if (ShadowBoltVolleyTimer < diff){ DoCast(m_creature->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); ShadowBoltVolleyTimer = 12000; }else ShadowBoltVolleyTimer -= diff; - // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. if (FelfirePortalTimer < diff){ Creature* Portal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000); if (Portal) { std::list::iterator itr; - for(itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) + for (itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) { Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pUnit) @@ -954,46 +846,36 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI } FelfirePortalTimer = 20000; }else FelfirePortalTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_hand_of_the_deceiver(Creature* pCreature) { return new mob_hand_of_the_deceiverAI (pCreature); } - //AI for Felfire Portal struct TRINITY_DLL_DECL mob_felfire_portalAI : public Scripted_NoMovementAI { mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} - uint32 SpawnFiendTimer; - void InitializeAI() { SpawnFiendTimer = 5000; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - ScriptedAI::InitializeAI(); } - // TODO: Timers void Reset() {} - void JustSummoned(Creature* summoned) { summoned->setFaction(m_creature->getFaction()); summoned->SetLevel(m_creature->getLevel()); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (SpawnFiendTimer < diff) { Creature* Fiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000); @@ -1003,44 +885,35 @@ struct TRINITY_DLL_DECL mob_felfire_portalAI : public Scripted_NoMovementAI }else SpawnFiendTimer -= diff; } }; - CreatureAI* GetAI_mob_felfire_portal(Creature* pCreature) { return new mob_felfire_portalAI (pCreature); } - //AI for Felfire Fiend struct TRINITY_DLL_DECL mob_volatile_felfire_fiendAI : public ScriptedAI { mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} - uint32 ExplodeTimer; - bool LockedTarget; - void Reset() { ExplodeTimer = 2000; LockedTarget = false; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage > m_creature->GetHealth()) DoCast(m_creature, SPELL_FELFIRE_FISSION, true); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!LockedTarget) { m_creature->AddThreat(m_creature->getVictim(), 10000000.0f); LockedTarget = true; } - if (ExplodeTimer) { if (ExplodeTimer < diff) @@ -1054,26 +927,21 @@ struct TRINITY_DLL_DECL mob_volatile_felfire_fiendAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_volatile_felfire_fiend(Creature* pCreature) { return new mob_volatile_felfire_fiendAI (pCreature); } - //AI for Armageddon target struct TRINITY_DLL_DECL mob_armageddonAI : public Scripted_NoMovementAI { mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} - uint8 Spell; uint32 Timer; - void Reset() { Spell = 0; Timer = 0; } - void UpdateAI(const uint32 diff) { if (Timer < diff) @@ -1102,12 +970,10 @@ struct TRINITY_DLL_DECL mob_armageddonAI : public Scripted_NoMovementAI } else Timer -=diff; } }; - CreatureAI* GetAI_mob_armageddon(Creature* pCreature) { return new mob_armageddonAI (pCreature); } - //AI for Shield Orbs struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI { @@ -1115,14 +981,12 @@ struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - bool PointReached; bool Clockwise; uint32 Timer; uint32 CheckTimer; ScriptedInstance* pInstance; float x, y, r, c, mx, my; - void InitializeAI() { m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); @@ -1134,12 +998,9 @@ struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI mx = ShieldOrbLocations[0][0]; my = ShieldOrbLocations[0][1]; Clockwise = urand(0,1); - ScriptedAI::InitializeAI(); } - void Reset(){} - void UpdateAI(const uint32 diff) { if (PointReached) @@ -1167,9 +1028,7 @@ struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI DoTeleportTo(x,y,SHIELD_ORB_Z); PointReached = true; } else CheckTimer -= diff; - } - if (Timer < diff) { if (Unit* random = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) @@ -1177,29 +1036,23 @@ struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI Timer = urand(500,1000); } else Timer -= diff; } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - PointReached = true; } }; - CreatureAI* GetAI_mob_shield_orb(Creature* pCreature) { return new mob_shield_orbAI (pCreature); } - //AI for Sinister Reflection struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI { mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} - uint8 Class; uint32 Timer[3]; - void Reset() { Timer[0] = 0; @@ -1207,10 +1060,8 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI Timer[2] = 0; Class = 0; } - void UpdateAI(const uint32 diff) { - if (Class == 0) { Class = m_creature->getVictim()->getClass(); @@ -1239,7 +1090,6 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI break; } } - switch(Class){ case CLASS_DRUID: if (Timer[1] < diff) @@ -1343,66 +1193,53 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI break; } debug_log("Sinister-Timer"); - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) Timer[i] -= diff; } - }; - CreatureAI* GetAI_mob_sinster_reflection(Creature* pCreature) { return new mob_sinster_reflectionAI (pCreature); } - void AddSC_boss_kiljaeden() { Script* newscript; - newscript = new Script; newscript->pGOHello = &GOHello_go_orb_of_the_blue_flight; newscript->Name = "go_orb_of_the_blue_flight"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_kalecgos_kj; newscript->Name = "boss_kalecgos_kj"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_boss_kiljaeden; newscript->Name = "boss_kiljaeden"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_kiljaeden_controller; newscript->Name = "mob_kiljaeden_controller"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_hand_of_the_deceiver; newscript->Name = "mob_hand_of_the_deceiver"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_felfire_portal; newscript->Name = "mob_felfire_portal"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_volatile_felfire_fiend; newscript->Name = "mob_volatile_felfire_fiend"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_armageddon; newscript->Name = "mob_armageddon"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_shield_orb; newscript->Name = "mob_shield_orb"; newscript->RegisterSelf(); - newscript = new Script; newscript->GetAI = &GetAI_mob_sinster_reflection; newscript->Name = "mob_sinster_reflection"; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp index ba95eb51e0f..26f3329e6de 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Muru SD%Complete: 80 SDComment: all sounds, black hole effect triggers to often (46228) */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - // Muru & Entropius's spells enum Spells { SPELL_ENRAGE = 26662, - // Muru's spells SPELL_NEGATIVE_ENERGY = 46009, //(this trigger 46008) SPELL_DARKNESS = 45999, @@ -38,38 +34,30 @@ enum Spells SPELL_SUMNON_FURY_MAGE = 46038, SPELL_SUMMON_VOID_SENTINEL = 45988, SPELL_SUMMON_ENTROPIUS = 46217, - // Entropius's spells SPELL_DARKNESS_E = 46269, SPELL_BLACKHOLE = 46282, SPELL_NEGATIVE_ENERGY_E = 46284, SPELL_ENTROPIUS_SPAWN = 46223, - // Shadowsword Berserker's spells SPELL_FLURRY = 46160, SPELL_DUAL_WIELD = 29651, - // Shadowsword Fury Mage's spells SPELL_FEL_FIREBALL = 46101, SPELL_SPELL_FURY = 46102, - // Void Sentinel's spells SPELL_SHADOW_PULSE = 46087, SPELL_VOID_BLAST = 46161, - // Void Spawn's spells SPELL_SHADOW_BOLT_VOLLEY = 46082, - //Dark Fiend Spells SPELL_DARKFIEND_AOE = 45944, SPELL_DARKFIEND_VISUAL = 45936, SPELL_DARKFIEND_SKIN = 45934, - //Black Hole Spells SPELL_BLACKHOLE_SPAWN = 46242, SPELL_BLACKHOLE_GROW = 46228 }; - enum Creatures { CREATURE_DARKNESS = 25879, @@ -82,14 +70,12 @@ enum Creatures BOSS_MURU = 25741, BOSS_ENTROPIUS = 25840 }; - enum BossTimers{ TIMER_DARKNESS = 0, TIMER_HUMANOIDES = 1, TIMER_PHASE = 2, TIMER_SENTINEL = 3 }; - float DarkFiends[8][4] = { {1819.9, 609.80, 69.74, 1.94}, @@ -101,7 +87,6 @@ float DarkFiends[8][4] = {1823.9 , 639.69, 69.74, 4.12}, {1811.85, 640.46, 69.73, 4.97} }; - float Humanoides[6][5] = { {CREATURE_FURY_MAGE, 1780.16, 666.83, 71.19, 5.21}, @@ -111,7 +96,6 @@ float Humanoides[6][5] = {CREATURE_BERSERKER, 1845.17, 602.63, 71.28, 2.43}, {CREATURE_BERSERKER, 1842.91, 599.93, 71.23, 2.44} }; - uint32 EnrageTimer = 600000; struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI { @@ -119,32 +103,24 @@ struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; SummonList Summons; - uint32 BlackHoleSummonTimer; - void Reset() { BlackHoleSummonTimer = 15000; DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); - Summons.DespawnAll(); - if (pInstance) pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); DoCast(m_creature, SPELL_ENTROPIUS_SPAWN, false); - if (pInstance) pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); } - void JustSummoned(Creature* summoned) { switch(summoned->GetEntry()) @@ -162,93 +138,71 @@ struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); Summons.Summon(summoned); } - void JustDied(Unit* killer) { Summons.DespawnAll(); - if (pInstance) pInstance->SetData(DATA_MURU_EVENT, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (EnrageTimer < diff && !m_creature->HasAura(SPELL_ENRAGE, 0)) { DoCast(m_creature,SPELL_ENRAGE, false); }else EnrageTimer -= diff; - if (BlackHoleSummonTimer < diff) { Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!random) return; - DoCast(random, SPELL_DARKNESS_E, false); - random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!random) return; - random->CastSpell(random, SPELL_BLACKHOLE, false); BlackHoleSummonTimer = 15000; }else BlackHoleSummonTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_entropius(Creature* pCreature) { return new boss_entropiusAI (pCreature); } - struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI { boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; SummonList Summons; - uint8 Phase; uint32 Timer[4]; - bool DarkFiend; - void Reset() { DarkFiend = false; Phase = 1; - EnrageTimer = 600000; Timer[TIMER_DARKNESS] = 45000; Timer[TIMER_HUMANOIDES] = 10000; Timer[TIMER_PHASE] = 2000; Timer[TIMER_SENTINEL] = 31500; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); - Summons.DespawnAll(); - if (pInstance) pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoCastAOE(SPELL_NEGATIVE_ENERGY,false); - if (pInstance) pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage > m_creature->GetHealth() && Phase == 1) @@ -262,7 +216,6 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI if (Phase > 1 && Phase < 4) damage = 0; } - void JustSummoned(Creature* summoned) { switch(summoned->GetEntry()) @@ -277,12 +230,10 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); Summons.Summon(summoned); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Phase == 3) { if (Timer[TIMER_PHASE] HasAura(SPELL_ENRAGE, 0)) { DoCast(m_creature, SPELL_ENRAGE, false); }else EnrageTimer -= diff; - for (uint8 i = 0; i < 4; ++i) { if (Timer[i] < diff) @@ -325,13 +274,13 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI else { DarkFiend = false; - for(uint8 i = 0; i < 8; ++i) + for (uint8 i = 0; i < 8; ++i) m_creature->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_DARKNESS] = 42000; } break; case TIMER_HUMANOIDES: - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) m_creature->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_HUMANOIDES] = 60000; break; @@ -349,59 +298,45 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI break; } } - //Timer - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (i != TIMER_PHASE)Timer[i] -= diff; else if (Phase == 2) Timer[i] -= diff; } } }; - CreatureAI* GetAI_boss_muru(Creature* pCreature) { return new boss_muruAI (pCreature); } - struct TRINITY_DLL_DECL npc_muru_portalAI : public Scripted_NoMovementAI { npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - SummonList Summons; Creature* Muru; - bool SummonSentinel; bool InAction; - uint32 SummonTimer; - void Reset() { SummonTimer = 5000; - InAction = false; SummonSentinel = false; - m_creature->addUnitState(UNIT_STAT_STUNNED); - Summons.DespawnAll(); } - void JustSummoned(Creature* summoned) { if (pInstance) if (Player* Target = Unit::GetPlayer(pInstance->GetData64(DATA_PLAYER_GUID))) summoned->AI()->AttackStart(Target); - Summons.Summon(summoned); } - void SpellHit(Unit* caster, const SpellEntry* Spell) { float x,y,z,o; @@ -419,7 +354,6 @@ struct TRINITY_DLL_DECL npc_muru_portalAI : public Scripted_NoMovementAI break; } } - void UpdateAI(const uint32 diff) { if (!SummonSentinel) @@ -436,39 +370,31 @@ struct TRINITY_DLL_DECL npc_muru_portalAI : public Scripted_NoMovementAI }else SummonTimer -= diff; } }; - CreatureAI* GetAI_npc_muru_portal(Creature* pCreature) { return new npc_muru_portalAI (pCreature); } - struct TRINITY_DLL_DECL npc_dark_fiendAI : public ScriptedAI { npc_dark_fiendAI(Creature *c) : ScriptedAI(c) {} - uint32 WaitTimer; bool InAction; - void Reset() { WaitTimer = 2000; InAction = false; - m_creature->addUnitState(UNIT_STAT_STUNNED); } - void SpellHit(Unit* caster, const SpellEntry* Spell) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) if (Spell->Effect[i] == 38) m_creature->DisappearAndDie(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (WaitTimer < diff) { if (!InAction) @@ -481,7 +407,6 @@ struct TRINITY_DLL_DECL npc_dark_fiendAI : public ScriptedAI } else { - if (m_creature->IsWithinDist(m_creature->getVictim(), 5)) { DoCastAOE(SPELL_DARKFIEND_AOE, false); @@ -492,85 +417,68 @@ struct TRINITY_DLL_DECL npc_dark_fiendAI : public ScriptedAI } else WaitTimer -= diff; } }; - CreatureAI* GetAI_npc_dark_fiend(Creature* pCreature) { return new npc_dark_fiendAI (pCreature); } - struct TRINITY_DLL_DECL npc_void_sentinelAI : public ScriptedAI { npc_void_sentinelAI(Creature *c) : ScriptedAI(c){} - uint32 PulseTimer; uint32 VoidBlastTimer; - void Reset() { PulseTimer = 3000; VoidBlastTimer = 45000; //is this a correct timer? - float x,y,z,o; m_creature->GetHomePosition(x,y,z,o); DoTeleportTo(x,y,71); } - void JustDied(Unit* killer) { for (uint8 i = 0; i < 8; ++i) m_creature->SummonCreature(CREATURE_VOID_SPAWN, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (PulseTimer < diff) { DoCastAOE(SPELL_SHADOW_PULSE, true); PulseTimer = 3000; } else PulseTimer -= diff; - if (VoidBlastTimer < diff) { DoCast(m_creature->getVictim(), SPELL_VOID_BLAST, false); VoidBlastTimer = 45000; } else VoidBlastTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_void_sentinel(Creature* pCreature) { return new npc_void_sentinelAI (pCreature); } - struct TRINITY_DLL_DECL npc_blackholeAI : public ScriptedAI { npc_blackholeAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 DespawnTimer; uint32 SpellTimer; uint8 Phase; uint8 NeedForAHack; - void Reset() { DespawnTimer = 15000; SpellTimer = 5000; Phase = 0; - m_creature->addUnitState(UNIT_STAT_STUNNED); DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); } - void UpdateAI(const uint32 diff) { if (SpellTimer < diff) @@ -607,18 +515,15 @@ struct TRINITY_DLL_DECL npc_blackholeAI : public ScriptedAI return; } } else SpellTimer -= diff; - if (DespawnTimer < diff) m_creature->DisappearAndDie(); else DespawnTimer -= diff; } }; - CreatureAI* GetAI_npc_blackhole(Creature* pCreature) { return new npc_blackholeAI (pCreature); } - void AddSC_boss_muru() { Script *newscript; @@ -626,27 +531,22 @@ void AddSC_boss_muru() newscript->Name = "boss_muru"; newscript->GetAI = &GetAI_boss_muru; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_entropius"; newscript->GetAI = &GetAI_boss_entropius; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_muru_portal"; newscript->GetAI = &GetAI_npc_muru_portal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_dark_fiend"; newscript->GetAI = &GetAI_npc_dark_fiend; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_void_sentinel"; newscript->GetAI = &GetAI_npc_void_sentinel; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_blackhole"; newscript->GetAI = &GetAI_npc_blackhole; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/def_sunwell_plateau.h b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/def_sunwell_plateau.h index f955e8c7e17..bfcb042fc7e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/def_sunwell_plateau.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/def_sunwell_plateau.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SUNWELLPLATEAU_H #define DEF_SUNWELLPLATEAU_H - /*** Encounters ***/ #define DATA_KALECGOS_EVENT 1 #define DATA_BRUTALLUS_EVENT 2 @@ -12,7 +10,6 @@ #define DATA_EREDAR_TWINS_EVENT 4 #define DATA_MURU_EVENT 5 #define DATA_KILJAEDEN_EVENT 6 - /*** Creatures ***/ #define DATA_KALECGOS_DRAGON 7 #define DATA_KALECGOS_HUMAN 8 @@ -27,10 +24,8 @@ #define DATA_KILJAEDEN_CONTROLLER 17 #define DATA_ANVEENA 18 #define DATA_KALECGOS_KJ 19 - /*** GameObjects ***/ #define DATA_GO_FORCEFIELD 20 - /*** Misc ***/ #define DATA_PLAYER_GUID 21 #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp index 4195ebd91a5..ce51643f6de 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp @@ -1,19 +1,15 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - /* ScriptData SDName: Instance_Sunwell_Plateau SD%Complete: 25 SDComment: VERIFY SCRIPT SDCategory: Sunwell_Plateau EndScriptData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - #define MAX_ENCOUNTER 6 - /* Sunwell Plateau: 0 - Kalecgos and Sathrovarr 1 - Brutallus @@ -22,13 +18,10 @@ EndScriptData */ 4 - M'uru 5 - Kil'Jaeden */ - struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance { instance_sunwell_plateau(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - /** Creatures **/ uint64 Kalecgos_Dragon; uint64 Kalecgos_Human; @@ -44,21 +37,17 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance uint64 Anveena; uint64 KalecgosKJ; uint32 SpectralPlayers; - /** GameObjects **/ uint64 ForceField; // Kalecgos Encounter uint64 KalecgosWall[2]; uint64 FireBarrier; // Felmysts Encounter uint64 MurusGate[2]; // Murus Encounter - /*** Misc ***/ uint32 SpectralRealmTimer; std::vector SpectralRealmList; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - /*** Creatures ***/ Kalecgos_Dragon = 0; Kalecgos_Human = 0; @@ -74,7 +63,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance Anveena = 0; KalecgosKJ = 0; SpectralPlayers = 0; - /*** GameObjects ***/ ForceField = 0; FireBarrier = 0; @@ -82,38 +70,31 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance MurusGate[1] = 0; KalecgosWall[0] = 0; KalecgosWall[1] = 0; - /*** Misc ***/ SpectralRealmTimer = 5000; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* plr = itr->getSource(); if (plr && !plr->HasAura(45839,0)) return plr; } } - debug_log("TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); return NULL; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -133,7 +114,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance case 25319: KalecgosKJ = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -154,7 +134,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance break; } } - uint32 GetData(uint32 id) { switch(id) @@ -168,7 +147,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 id) { switch(id) @@ -193,7 +171,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance } return 0; } - void SetData(uint32 id, uint32 data) { switch(id) @@ -239,11 +216,9 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance m_auiEncounter[4] = data; break; case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; } - if (data == DONE) SaveToDB(); } - std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -259,7 +234,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance } return NULL; } - void Load(const char* in) { if (!in) @@ -267,27 +241,23 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5]; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_sunwell_plateau(Map* pMap) { return new instance_sunwell_plateau(pMap); } - void AddSC_instance_sunwell_plateau() { Script *newscript; - newscript = new Script; newscript->Name = "instance_sunwell_plateau"; newscript->GetInstanceData = &GetInstanceData_instance_sunwell_plateau; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.cpp index e68717857cb..88f0a8d9db9 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Sunwell_Plateau SD%Complete: 0 SDComment: Placeholder, Epilogue after Kil'jaeden, Captain Selana Gossips EndScriptData */ - /* ContentData npc_prophet_velen npc_captain_selana EndContentData */ - #include "precompiled.h" #include "def_sunwell_plateau.h" - /*###### ## npc_prophet_velen ######*/ - enum ProphetSpeeches { PROPHET_SAY1 = -1580099, @@ -43,7 +38,6 @@ enum ProphetSpeeches PROPHET_SAY7 = -1580105, PROPHET_SAY8 = -1580106 }; - enum LiadrinnSpeeches { LIADRIN_SAY1 = -1580107, @@ -51,16 +45,13 @@ enum LiadrinnSpeeches LIADRIN_SAY3 = -1580109 }; - /*###### ## npc_captain_selana ######*/ - #define CS_GOSSIP1 "Give me a situation report, Captain." #define CS_GOSSIP2 "What went wrong?" #define CS_GOSSIP3 "Why did they stop?" #define CS_GOSSIP4 "Your insight is appreciated." - void AddSC_sunwell_plateau() { } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/tirisfal_glades.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/tirisfal_glades.cpp index ba2a9cd762a..29c10e34da4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/tirisfal_glades.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/tirisfal_glades.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Tirisfal_Glades SD%Complete: 100 SDComment: Quest support: 590, 1819 SDCategory: Tirisfal Glades EndScriptData */ - /* ContentData npc_calvin_montague go_mausoleum_door go_mausoleum_trigger EndContentData */ - #include "precompiled.h" - /*###### ## npc_calvin_montague ######*/ - enum eCalvin { SAY_COMPLETE = -1000431, @@ -40,54 +35,41 @@ enum eCalvin QUEST_590 = 590, FACTION_HOSTILE = 168 }; - struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI { npc_calvin_montagueAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 m_uiPhase; uint32 m_uiPhaseTimer; uint64 m_uiPlayerGUID; - void Reset() { m_uiPhase = 0; m_uiPhaseTimer = 5000; m_uiPlayerGUID = 0; - me->RestoreFaction(); - if (!m_creature->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE)) m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); } - void EnterCombat(Unit* who) { } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim() || m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 15)) { uiDamage = 0; - me->RestoreFaction(); m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->CombatStop(true); - m_uiPhase = 1; - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) m_uiPlayerGUID = pDoneBy->GetGUID(); } } - void UpdateAI(const uint32 uiDiff) { if (m_uiPhase) @@ -99,7 +81,6 @@ struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI m_uiPhaseTimer -= uiDiff; return; } - switch(m_uiPhase) { case 1: @@ -109,7 +90,6 @@ struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI case 2: if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiPlayerGUID)) CAST_PLR(pUnit)->AreaExploredOrEventHappens(QUEST_590); - m_creature->CastSpell(m_creature,SPELL_DRINK,true); ++m_uiPhase; break; @@ -117,13 +97,10 @@ struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI EnterEvadeMode(); break; } - return; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; @@ -131,7 +108,6 @@ CreatureAI* GetAI_npc_calvin_montague(Creature* pCreature) { return new npc_calvin_montagueAI (pCreature); } - bool QuestAccept_npc_calvin_montague(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_590) @@ -142,12 +118,10 @@ bool QuestAccept_npc_calvin_montague(Player* pPlayer, Creature* pCreature, Quest } return true; } - /*###### ## go_mausoleum_door ## go_mausoleum_trigger ######*/ - enum eMausoleum { QUEST_ULAG = 1819, @@ -155,52 +129,42 @@ enum eMausoleum GO_TRIGGER = 104593, GO_DOOR = 176594 }; - bool GOHello_go_mausoleum_door(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) return false; - if (GameObject* pTrigger = pPlayer->FindNearestGameObject(GO_TRIGGER, 30.0f)) { pTrigger->SetGoState(GO_STATE_READY); pPlayer->SummonCreature(NPC_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); return false; } - return false; } - bool GOHello_go_mausoleum_trigger(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) return false; - if (GameObject* pDoor = pPlayer->FindNearestGameObject(GO_DOOR, 30.0f)) { pGo->SetGoState(GO_STATE_ACTIVE); pDoor->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); return true; } - return false; } - void AddSC_tirisfal_glades() { Script *newscript; - newscript = new Script; newscript->Name = "npc_calvin_montague"; newscript->GetAI = &GetAI_npc_calvin_montague; newscript->pQuestAccept = &QuestAccept_npc_calvin_montague; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_mausoleum_door"; newscript->pGOHello = &GOHello_go_mausoleum_door; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_mausoleum_trigger"; newscript->pGOHello = &GOHello_go_mausoleum_trigger; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp index 203fc8268d5..c22340031bf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp @@ -13,7 +13,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_archaedas SD%Complete: 100 @@ -23,22 +22,16 @@ At 66%, he will awaken the 6 Guardians. At 33%, he will awaken the Vault Walkers On his death the vault door opens. EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!" #define SOUND_AGGRO 5855 - #define SAY_SUMMON "Awake ye servants, defend the discs!" #define SOUND_SUMMON 5856 - #define SAY_SUMMON2 "To my side, brothers. For the makers!" #define SOUND_SUMMON2 5857 - #define SAY_KILL "Reckless mortal." #define SOUND_KILL 5858 - #define SPELL_GROUND_TREMOR 6524 #define SPELL_ARCHAEDAS_AWAKEN 10347 #define SPELL_BOSS_OBJECT_VISUAL 11206 @@ -46,45 +39,36 @@ EndScriptData */ #define SPELL_SUB_BOSS_AGGRO 11568 #define SPELL_AWAKEN_VAULT_WALKER 10258 #define SPELL_AWAKEN_EARTHEN_GUARDIAN 10252 - struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI { boss_archaedasAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - uint32 Tremor_Timer; int32 Awaken_Timer; uint32 WallMinionTimer; bool wakingUp; - bool guardiansAwake; bool vaultWalkersAwake; ScriptedInstance* pInstance; - void Reset() { Tremor_Timer = 60000; Awaken_Timer = 0; WallMinionTimer = 10000; - wakingUp = false; guardiansAwake = false; vaultWalkersAwake = false; - if (pInstance) pInstance->SetData (NULL, 5); // respawn any dead minions m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - } - void ActivateMinion (uint64 guid, bool flag) { Unit *minion = Unit::GetUnit(*m_creature, guid); - if (minion && minion->isAlive()) { DoCast (minion, SPELL_AWAKEN_VAULT_WALKER, flag); @@ -92,14 +76,12 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI } } - void EnterCombat(Unit *who) { m_creature->setFaction (14); m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); } - void SpellHit (Unit* caster, const SpellEntry *spell) { // Being woken up from the altar, start the awaken sequence @@ -110,13 +92,11 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI wakingUp = true; } } - void KilledUnit(Unit *victim) { m_creature->MonsterYell(SAY_KILL,LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_KILL); } - void UpdateAI(const uint32 diff) { if (!pInstance) @@ -130,19 +110,15 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI AttackStart(Unit::GetUnit(*m_creature, pInstance->GetData64(0))); return; // dont want to continue until we finish the AttackStart method } - //Return since we have no target if (!UpdateVictim()) return; - // wake a wall minion if (WallMinionTimer < diff) { pInstance->SetData (NULL, 2); - WallMinionTimer = 10000; } else WallMinionTimer -= diff; - //If we are <66 summon the guardians if (!guardiansAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 66) { ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1 @@ -155,7 +131,6 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_SUMMON); guardiansAwake = true; } - //If we are <33 summon the vault walkers if (!vaultWalkersAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 33) { ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1 @@ -167,19 +142,15 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI vaultWalkersAwake = true; } - if (Tremor_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_GROUND_TREMOR); - //45 seconds until we should cast this agian Tremor_Timer = 45000; }else Tremor_Timer -= diff; - DoMeleeAttackIfReady(); } - void JustDied (Unit *killer) { if (pInstance) { @@ -187,14 +158,11 @@ struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI pInstance->SetData(NULL,4); // deactivate his minions } } - }; - CreatureAI* GetAI_boss_archaedas(Creature* pCreature) { return new boss_archaedasAI (pCreature); } - /* ScriptData SDName: mob_archaedas_minions SD%Complete: 100 @@ -202,37 +170,29 @@ SDComment: These mobs are initially frozen until Archaedas awakens them one at a time. EndScriptData */ - #define SPELL_ARCHAEDAS_AWAKEN 10347 - struct TRINITY_DLL_DECL mob_archaedas_minionsAI : public ScriptedAI { mob_archaedas_minionsAI(Creature *c) : ScriptedAI(c) { pInstance = m_creature->GetInstanceData(); } - uint32 Arcing_Timer; int32 Awaken_Timer; bool wakingUp; - bool amIAwake; ScriptedInstance* pInstance; - void Reset() { Arcing_Timer = 3000; Awaken_Timer = 0; - wakingUp = false; amIAwake = false; - m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); m_creature->RemoveAllAuras(); } - void EnterCombat(Unit *who) { m_creature->setFaction (14); @@ -241,7 +201,6 @@ struct TRINITY_DLL_DECL mob_archaedas_minionsAI : public ScriptedAI m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); amIAwake = true; } - void SpellHit (Unit* caster, const SpellEntry *spell) { // time to wake up, start animation if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN)){ @@ -249,13 +208,11 @@ struct TRINITY_DLL_DECL mob_archaedas_minionsAI : public ScriptedAI wakingUp = true; } } - void MoveInLineOfSight(Unit *who) { if (amIAwake) ScriptedAI::MoveInLineOfSight(who); } - void UpdateAI(const uint32 diff) { // we're still in the awaken animation @@ -268,21 +225,17 @@ struct TRINITY_DLL_DECL mob_archaedas_minionsAI : public ScriptedAI // AttackStart(Unit::GetUnit(*m_creature, pInstance->GetData64(0))); // whoWokeArchaedasGUID return; // dont want to continue until we finish the AttackStart method } - //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_archaedas_minions(Creature* pCreature) { return new mob_archaedas_minionsAI (pCreature); } - /* ScriptData SDName: go_altar_archaedas SD%Complete: 100 @@ -290,22 +243,16 @@ SDComment: Needs 1 person to activate the Archaedas script SDCategory: Uldaman EndScriptData */ - #define OBJECT_ALTAR_OF_ARCHAEDAS 133234 - #define NUMBER_NEEDED_TO_ACTIVATE 1 // as of patch 3.0.8 the altars can be opened by a single player (previously 3) - #define SPELL_BOSS_OBJECT_VISUAL 11206 - //uint64 altarOfArchaedasCount[5]; //int32 altarOfArchaedasCounter=0; - bool GOHello_go_altar_of_archaedas(Player* pPlayer, GameObject* pGo) { //bool alreadyUsed; //pGo->AddUse (); - /* alreadyUsed = false; for (uint32 loop=0; loop<5; loop++) { @@ -314,14 +261,11 @@ bool GOHello_go_altar_of_archaedas(Player* pPlayer, GameObject* pGo) if (!alreadyUsed) altarOfArchaedasCount[altarOfArchaedasCounter++] = pPlayer->GetGUID(); */ - pPlayer->CastSpell (pPlayer, SPELL_BOSS_OBJECT_VISUAL, false); - /* if (altarOfArchaedasCounter < NUMBER_NEEDED_TO_ACTIVATE) { return false; // not enough people yet } - // Check to make sure at least three people are still casting uint32 count=0; Unit *pTarget; @@ -331,42 +275,32 @@ bool GOHello_go_altar_of_archaedas(Player* pPlayer, GameObject* pGo) if (pTarget->IsNonMeleeSpellCasted(true)) count++; if (count >= NUMBER_NEEDED_TO_ACTIVATE) break; } - if (count < NUMBER_NEEDED_TO_ACTIVATE) { return false; // not enough people } */ - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); if (!pInstance) return false; - pInstance->SetData(NULL,0); pInstance->SetData64(0,pPlayer->GetGUID()); // activate archaedas - return false; } - /* ScriptData SDName: mob_stonekeepers SD%Complete: 100 SDComment: After activating the altar of the keepers, the stone keepers will wake up one by one. EndScriptData */ - #include "precompiled.h" - #define SPELL_SELF_DESTRUCT 9874 - struct TRINITY_DLL_DECL mob_stonekeepersAI : public ScriptedAI { mob_stonekeepersAI(Creature *c) : ScriptedAI(c) { pInstance = (m_creature->GetInstanceData()); } - ScriptedInstance* pInstance; - void Reset() { m_creature->setFaction(35); @@ -374,38 +308,30 @@ struct TRINITY_DLL_DECL mob_stonekeepersAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); m_creature->RemoveAllAuras(); } - void EnterCombat(Unit *who) { m_creature->setFaction (14); m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void UpdateAI(const uint32 diff) { - //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit *attacker) { DoCast (m_creature, SPELL_SELF_DESTRUCT,true); if (pInstance) pInstance->SetData(NULL, 1); // activate next stonekeeper } - }; - CreatureAI* GetAI_mob_stonekeepers(Creature* pCreature) { return new mob_stonekeepersAI (pCreature); } - /* ScriptData SDName: go_altar_of_the_keepers SD%Complete: 100 @@ -413,24 +339,17 @@ SDComment: Need 1 person to activate to open the altar. One by one the StoneKee SDCategory: Uldaman EndScriptData */ - #define SPELL_BOSS_OBJECT_VISUAL 11206 - #define NUMBER_NEEDED_TO_ACTIVATE 1 // as of patch 3.0.8 the altars can be opened by a single player (previously 3) - //static uint64 altarOfTheKeeperCount[5]; //static uint32 altarOfTheKeeperCounter=0; - bool GOHello_go_altar_of_the_keepers(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = pPlayer->GetInstanceData(); if (!pInstance) return true; - //bool alreadyUsed; - //pGo->AddUse (); - //alreadyUsed = false; //for (uint32 loop=0; loop<5; ++loop) //{ @@ -440,7 +359,6 @@ bool GOHello_go_altar_of_the_keepers(Player* pPlayer, GameObject* pGo) //if (!alreadyUsed && altarOfTheKeeperCounter < 5) // altarOfTheKeeperCount[altarOfTheKeeperCounter++] = pPlayer->GetGUID(); pPlayer->CastSpell (pPlayer, SPELL_BOSS_OBJECT_VISUAL, false); - //if (altarOfTheKeeperCounter < NUMBER_NEEDED_TO_ACTIVATE) //{ //error_log ("not enough people yet, altarOfTheKeeperCounter = %d", altarOfTheKeeperCounter); @@ -458,7 +376,6 @@ bool GOHello_go_altar_of_the_keepers(Player* pPlayer, GameObject* pGo) if (pTarget->IsNonMeleeSpellCasted(true)) count++; if (count >= NUMBER_NEEDED_TO_ACTIVATE) break; } - if (count < NUMBER_NEEDED_TO_ACTIVATE) { // error_log ("still not enough people"); @@ -469,7 +386,6 @@ bool GOHello_go_altar_of_the_keepers(Player* pPlayer, GameObject* pGo) pInstance->SetData(NULL,1); // activate the Stone Keepers return true; } - void AddSC_boss_archaedas() { Script *newscript; @@ -477,22 +393,18 @@ void AddSC_boss_archaedas() newscript->Name = "boss_archaedas"; newscript->GetAI = &GetAI_boss_archaedas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_altar_of_archaedas"; newscript->pGOHello = &GOHello_go_altar_of_archaedas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_archaedas_minions"; newscript->GetAI = &GetAI_mob_archaedas_minions; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_altar_of_the_keepers"; newscript->pGOHello = &GOHello_go_altar_of_the_keepers; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_stonekeepers"; newscript->GetAI = &GetAI_mob_stonekeepers; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp index 06c0289812b..11ece7039c4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp @@ -13,88 +13,69 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ironaya SD%Complete: 100 SDComment: SDCategory: Uldaman EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1070000 - #define SPELL_ARCINGSMASH 8374 #define SPELL_KNOCKAWAY 10101 #define SPELL_WSTOMP 11876 - struct TRINITY_DLL_DECL boss_ironayaAI : public ScriptedAI { boss_ironayaAI(Creature *c) : ScriptedAI(c) {} - uint32 Arcing_Timer; bool hasCastedWstomp; bool hasCastedKnockaway; - void Reset() { Arcing_Timer = 3000; hasCastedKnockaway = false; hasCastedWstomp = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //If we are <50% hp do knockaway ONCE if (!hasCastedKnockaway && m_creature->GetHealth()*2 < m_creature->GetMaxHealth()) { m_creature->CastSpell(m_creature->getVictim(),SPELL_KNOCKAWAY, true); - // current aggro target is knocked away pick new target Unit* Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); - if (!Target || Target == m_creature->getVictim()) Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); - if (Target) m_creature->TauntApply(Target); - //Shouldn't cast this agian hasCastedKnockaway = true; } - //Arcing_Timer if (Arcing_Timer < diff) { DoCast(m_creature,SPELL_ARCINGSMASH); Arcing_Timer = 13000; }else Arcing_Timer -= diff; - if (!hasCastedWstomp && m_creature->GetHealth()*4 < m_creature->GetMaxHealth()) { DoCast(m_creature,SPELL_WSTOMP); hasCastedWstomp = true; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ironaya(Creature* pCreature) { return new boss_ironayaAI (pCreature); } - void AddSC_boss_ironaya() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp index 21b639e2449..178ea0985b3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp @@ -14,28 +14,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" - #define SPELL_ARCHAEDAS_AWAKEN 10347 #define SPELL_AWAKEN_VAULT_WALKER 10258 - #define ARCHAEDAS_TEMPLE_DOOR 141869 #define ALTAR_OF_ARCHAEDAS 133234 - #define ALTAR_OF_THE_KEEPER_TEMPLE_DOOR 124367 #define ALTAR_OF_THE_KEEPER_TEMPLE 130511 - #define ANCIENT_VAULT_DOOR 124369 - struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance { instance_uldaman(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; - void Initialize() { archaedasGUID = 0; @@ -44,19 +37,16 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance ancientVaultDoor = 0; whoWokeArchaedasGUID = 0; } - uint64 archaedasGUID; uint64 altarOfTheKeeperTempleDoor; uint64 archaedasTempleDoor; uint64 ancientVaultDoor; uint64 whoWokeArchaedasGUID; - std::vector stoneKeeper; std::vector altarOfTheKeeperCount; std::vector vaultWalker; std::vector earthenGuardian; std::vector archaedasWallMinions; // minions lined up around the wall - void OnGameObjectCreate(GameObject* pGo, bool add) { switch (pGo->GetEntry()) @@ -64,11 +54,9 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance case ALTAR_OF_THE_KEEPER_TEMPLE_DOOR: // lock the door altarOfTheKeeperTempleDoor = pGo->GetGUID(); break; - case ARCHAEDAS_TEMPLE_DOOR: archaedasTempleDoor = pGo->GetGUID(); break; - case ANCIENT_VAULT_DOOR: pGo->SetGoState(GO_STATE_READY); pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 33); @@ -76,7 +64,6 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance break; } } - void SetFrozenState(Creature* pCreature) { pCreature->setFaction(35); @@ -85,20 +72,17 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void OpenDoor(uint64 guid) { GameObject* pGo = instance->GetGameObject(guid); if (!pGo) return; - pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 33); pGo->SetGoState(GO_STATE_ACTIVE); } - void ActivateStoneKeepers() { - for(std::vector::iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i) + for (std::vector::iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i) { Creature *target = instance->GetCreature(*i); if (!target || !target->isAlive() || target->getFaction()==14) @@ -111,14 +95,12 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance // if we get this far than all four are dead so open the door SetData (NULL, 0); } - void ActivateWallMinions() { Creature *archaedas = instance->GetCreature(archaedasGUID); if (!archaedas) return; - - for(std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature *target = instance->GetCreature(*i); if (!target || !target->isAlive() || target->getFaction()==14) @@ -128,12 +110,11 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance return; // only want the first one we find } } - // used when Archaedas dies. All active minions must be despawned. void DeActivateMinions() { // first despawn any aggroed wall minions - for(std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature *target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction()!=14) @@ -141,9 +122,8 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance target->setDeathState(JUST_DIED); target->RemoveCorpse(); } - // Vault Walkers - for(std::vector::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) + for (std::vector::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) { Creature *target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction()!=14) @@ -151,9 +131,8 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance target->setDeathState(JUST_DIED); target->RemoveCorpse(); } - // Earthen Guardians - for(std::vector::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) + for (std::vector::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) { Creature *target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction()!=14) @@ -162,24 +141,21 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance target->RemoveCorpse(); } } - void ActivateArchaedas(uint64 target) { Creature *archaedas = instance->GetCreature(archaedasGUID); if (!archaedas) return; - if (Unit *victim = Unit::GetUnit(*archaedas, target)) { archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN,false); whoWokeArchaedasGUID = target; } } - void RespawnMinions() { // first respawn any aggroed wall minions - for(std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (std::vector::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature *target = instance->GetCreature(*i); if (target && target->isDead()) @@ -189,9 +165,8 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance SetFrozenState(target); } } - // Vault Walkers - for(std::vector::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) + for (std::vector::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) { Creature *target = instance->GetCreature(*i); if (target && target->isDead()) @@ -201,9 +176,8 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance SetFrozenState(target); } } - // Earthen Guardians - for(std::vector::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) + for (std::vector::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) { Creature *target = instance->GetCreature(*i); if (target && target->isDead()) @@ -214,7 +188,6 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance } } } - void SetData (uint32 type, uint32 data) { //error_log ("SetData: data = %d", data); @@ -227,7 +200,6 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance if (data==5) RespawnMinions(); } - void SetData64 (uint32 type, uint64 data) { // Archaedas @@ -237,7 +209,6 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch (pCreature->GetEntry()) { @@ -245,30 +216,23 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance SetFrozenState (pCreature); stoneKeeper.push_back(pCreature->GetGUID()); break; - case 7309: // Earthen Custodian archaedasWallMinions.push_back(pCreature->GetGUID()); break; - case 7077: // Earthen Hallshaper archaedasWallMinions.push_back(pCreature->GetGUID()); break; - case 7076: // Earthen Guardian earthenGuardian.push_back(pCreature->GetGUID()); break; - case 10120: // Vault Walker vaultWalker.push_back(pCreature->GetGUID()); break; - case 2748: // Archaedas archaedasGUID = pCreature->GetGUID(); break; - } // end switch } // end OnCreatureCreate - uint64 GetData64 (uint32 identifier) { if (identifier == 0) return whoWokeArchaedasGUID; @@ -276,25 +240,20 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance if (identifier == 2) return vaultWalker[1]; // VaultWalker2 if (identifier == 3) return vaultWalker[2]; // VaultWalker3 if (identifier == 4) return vaultWalker[3]; // VaultWalker4 - if (identifier == 5) return earthenGuardian[0]; if (identifier == 6) return earthenGuardian[1]; if (identifier == 7) return earthenGuardian[2]; if (identifier == 8) return earthenGuardian[3]; if (identifier == 9) return earthenGuardian[4]; if (identifier == 10) return earthenGuardian[5]; - return 0; } // end GetData64 }; - - InstanceData* GetInstanceData_instance_uldaman(Map* pMap) { return new instance_uldaman(pMap); } - void AddSC_instance_uldaman() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/uldaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/uldaman.cpp index 4ba8ed0c65b..3872d9bfa13 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/uldaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/uldaman/uldaman.cpp @@ -13,81 +13,61 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Uldaman SD%Complete: 100 SDComment: Quest support: 2278 + 1 trash mob. SDCategory: Uldaman EndScriptData */ - /* ContentData mob_jadespine_basilisk npc_lore_keeper_of_norgannon EndContentData */ - #include "precompiled.h" - /*###### ## mob_jadespine_basilisk ######*/ - #define SPELL_CSLUMBER 3636 - struct TRINITY_DLL_DECL mob_jadespine_basiliskAI : public ScriptedAI { mob_jadespine_basiliskAI(Creature *c) : ScriptedAI(c) {} - uint32 Cslumber_Timer; - void Reset() { Cslumber_Timer = 2000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Cslumber_Timer if (Cslumber_Timer < diff) { //Cast // DoCast(m_creature->getVictim(),SPELL_CSLUMBER); m_creature->CastSpell(m_creature->getVictim(),SPELL_CSLUMBER, true); - //Stop attacking target thast asleep and pick new target Cslumber_Timer = 28000; - Unit* Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); - if (!Target || Target == m_creature->getVictim()) Target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (Target) m_creature->TauntApply(Target); - }else Cslumber_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_jadespine_basilisk(Creature* pCreature) { return new mob_jadespine_basiliskAI (pCreature); } - /*###### ## npc_lore_keeper_of_norgannon ######*/ - #define GOSSIP_HELLO_KEEPER "Who are the Earthen?" #define GOSSIP_SELECT_KEEPER1 "What is a \"subterranean being matrix\"?" #define GOSSIP_SELECT_KEEPER2 "What are the anomalies you speak of?" @@ -104,17 +84,13 @@ CreatureAI* GetAI_mob_jadespine_basilisk(Creature* pCreature) #define GOSSIP_SELECT_KEEPER13 "Who are the Creators?" #define GOSSIP_SELECT_KEEPER14 "This is a lot to think about." #define GOSSIP_SELECT_KEEPER15 "I will access the discs now." - bool GossipHello_npc_lore_keeper_of_norgannon(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(2278) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KEEPER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1079, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lore_keeper_of_norgannon(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -186,16 +162,13 @@ bool GossipSelect_npc_lore_keeper_of_norgannon(Player* pPlayer, Creature* pCreat } return true; } - void AddSC_uldaman() { Script *newscript; - newscript = new Script; newscript->Name = "mob_jadespine_basilisk"; newscript->GetAI = &GetAI_mob_jadespine_basilisk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lore_keeper_of_norgannon"; newscript->pGossipHello = &GossipHello_npc_lore_keeper_of_norgannon; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/undercity.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/undercity.cpp index ecfd0894ddf..c1c72fd9f9b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/undercity.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/undercity.cpp @@ -13,37 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Undercity SD%Complete: 95 SDComment: Quest support: 6628, 9180(post-event). SDCategory: Undercity EndScriptData */ - /* ContentData npc_lady_sylvanas_windrunner npc_highborne_lamenter npc_parqual_fintallas EndContentData */ - #include "precompiled.h" - /*###### ## npc_lady_sylvanas_windrunner ######*/ - #define SAY_LAMENT_END -1000357 #define EMOTE_LAMENT_END -1000358 - #define SOUND_CREDIT 10896 #define ENTRY_HIGHBORNE_LAMENTER 21628 #define ENTRY_HIGHBORNE_BUNNY 21641 - #define SPELL_HIGHBORNE_AURA 37090 #define SPELL_SYLVANAS_CAST 36568 #define SPELL_RIBBON_OF_SOULS 34432 //the real one to use might be 37099 - float HighborneLoc[4][3]= { {1285.41, 312.47, 0.51}, @@ -51,27 +43,21 @@ float HighborneLoc[4][3]= {1289.66, 309.66, 1.52}, {1292.51, 310.50, 1.99}, }; - #define HIGHBORNE_LOC_Y -61.00 #define HIGHBORNE_LOC_Y_NEW -55.50 - struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI { npc_lady_sylvanas_windrunnerAI(Creature *c) : ScriptedAI(c) {} - uint32 LamentEvent_Timer; bool LamentEvent; uint64 targetGUID; - void Reset() { LamentEvent_Timer = 5000; LamentEvent = false; targetGUID = 0; } - void EnterCombat(Unit *who) {} - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) @@ -82,12 +68,10 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI target->GetMap()->CreatureRelocation(m_creature, target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0, 0.0f); summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); } - summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); targetGUID = summoned->GetGUID(); } } - void UpdateAI(const uint32 diff) { if (LamentEvent) @@ -95,7 +79,6 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI if (LamentEvent_Timer < diff) { DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); - LamentEvent_Timer = 2000; if (!m_creature->HasAura(SPELL_SYLVANAS_CAST)) { @@ -105,10 +88,8 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI } }else LamentEvent_Timer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; @@ -116,7 +97,6 @@ CreatureAI* GetAI_npc_lady_sylvanas_windrunner(Creature* pCreature) { return new npc_lady_sylvanas_windrunnerAI (pCreature); } - bool ChooseReward_npc_lady_sylvanas_windrunner(Player* pPlayer, Creature* pCreature, const Quest *_Quest, uint32 slot) { if (_Quest->GetQuestId() == 9180) @@ -124,27 +104,21 @@ bool ChooseReward_npc_lady_sylvanas_windrunner(Player* pPlayer, Creature* pCreat CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->LamentEvent = true; CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->DoPlaySoundToSet(pCreature,SOUND_CREDIT); pCreature->CastSpell(pCreature,SPELL_SYLVANAS_CAST,false); - - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) pCreature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); } - return true; } - /*###### ## npc_highborne_lamenter ######*/ - struct TRINITY_DLL_DECL npc_highborne_lamenterAI : public ScriptedAI { npc_highborne_lamenterAI(Creature *c) : ScriptedAI(c) {} - uint32 EventMove_Timer; uint32 EventCast_Timer; bool EventMove; bool EventCast; - void Reset() { EventMove_Timer = 10000; @@ -152,9 +126,7 @@ struct TRINITY_DLL_DECL npc_highborne_lamenterAI : public ScriptedAI EventMove = true; EventCast = true; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (EventMove) @@ -181,22 +153,17 @@ CreatureAI* GetAI_npc_highborne_lamenter(Creature* pCreature) { return new npc_highborne_lamenterAI (pCreature); } - /*###### ## npc_parqual_fintallas ######*/ - #define SPELL_MARK_OF_SHAME 6767 - #define GOSSIP_HPF1 "Gul'dan" #define GOSSIP_HPF2 "Kel'Thuzad" #define GOSSIP_HPF3 "Ner'zhul" - bool GossipHello_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasAura(SPELL_MARK_OF_SHAME)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -206,10 +173,8 @@ bool GossipHello_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(5821, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -224,26 +189,21 @@ bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## AddSC ######*/ - void AddSC_undercity() { Script *newscript; - newscript = new Script; newscript->Name = "npc_lady_sylvanas_windrunner"; newscript->GetAI = &GetAI_npc_lady_sylvanas_windrunner; newscript->pChooseReward = &ChooseReward_npc_lady_sylvanas_windrunner; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_highborne_lamenter"; newscript->GetAI = &GetAI_npc_highborne_lamenter; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_parqual_fintallas"; newscript->pGossipHello = &GossipHello_npc_parqual_fintallas; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp index 4181bc89867..bf1bed2152b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp @@ -13,40 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Western_Plaguelands SD%Complete: 90 SDComment: Quest support: 5216, 5219, 5222, 5225, 5229, 5231, 5233, 5235. To obtain Vitreous Focuser (could use more spesifics about gossip items) SDCategory: Western Plaguelands EndScriptData */ - /* ContentData npcs_dithers_and_arbington npc_myranda_the_hag npc_the_scourge_cauldron EndContentData */ - #include "precompiled.h" - /*###### ## npcs_dithers_and_arbington ######*/ - #define GOSSIP_HDA1 "What does the Felstone Field Cauldron need?" #define GOSSIP_HDA2 "What does the Dalson's Tears Cauldron need?" #define GOSSIP_HDA3 "What does the Writhing Haunt Cauldron need?" #define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?" - #define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser" - bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pCreature->isVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -56,10 +48,8 @@ bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); }else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -90,25 +80,20 @@ bool GossipSelect_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreatur } return true; } - /*###### ## npc_myranda_the_hag ######*/ - enum eMyranda { QUEST_SUBTERFUGE = 5862, QUEST_IN_DREAMS = 5944, SPELL_SCARLET_ILLUSION = 17961 }; - #define GOSSIP_ITEM_ILLUSION "I am ready for the illusion, Myranda." - bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION)) { @@ -118,10 +103,8 @@ bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -131,19 +114,14 @@ bool GossipSelect_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature, uint } return true; } - /*###### ## npc_the_scourge_cauldron ######*/ - struct TRINITY_DLL_DECL npc_the_scourge_cauldronAI : public ScriptedAI { npc_the_scourge_cauldronAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} - void EnterCombat(Unit* who) {} - void DoDie() { //summoner dies here @@ -153,12 +131,10 @@ struct TRINITY_DLL_DECL npc_the_scourge_cauldronAI : public ScriptedAI if (rTime<600) m_creature->SetRespawnDelay(600); } - void MoveInLineOfSight(Unit *who) { if (!who || who->GetTypeId() != TYPEID_PLAYER) return; - if (who->GetTypeId() == TYPEID_PLAYER) { switch(m_creature->GetAreaId()) @@ -203,27 +179,22 @@ CreatureAI* GetAI_npc_the_scourge_cauldron(Creature* pCreature) { return new npc_the_scourge_cauldronAI (pCreature); } - /*###### ## ######*/ - void AddSC_western_plaguelands() { Script *newscript; - newscript = new Script; newscript->Name = "npcs_dithers_and_arbington"; newscript->pGossipHello = &GossipHello_npcs_dithers_and_arbington; newscript->pGossipSelect = &GossipSelect_npcs_dithers_and_arbington; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_myranda_the_hag"; newscript->pGossipHello = &GossipHello_npc_myranda_the_hag; newscript->pGossipSelect = &GossipSelect_npc_myranda_the_hag; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_the_scourge_cauldron"; newscript->GetAI = &GetAI_npc_the_scourge_cauldron; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp index 6a1df820efa..c25dd521c68 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Westfall SD%Complete: 90 SDComment: Quest support: 155, 1651 SDCategory: Westfall EndScriptData */ - /* ContentData npc_daphne_stilwell npc_defias_traitor EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_daphne_stilwell ######*/ - enum eEnums { SAY_DS_START = -1000402, @@ -40,20 +35,16 @@ enum eEnums SAY_DS_DOWN_2 = -1000404, SAY_DS_DOWN_3 = -1000405, SAY_DS_PROLOGUE = -1000406, - SPELL_SHOOT = 6660, QUEST_TOME_VALOR = 1651, NPC_DEFIAS_RAIDER = 6180, EQUIP_ID_RIFLE = 2511 }; - struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI { npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} - uint32 uiWPHolder; uint32 uiShootTimer; - void Reset() { if (HasEscortState(STATE_ESCORT_ESCORTING)) @@ -67,19 +58,14 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI } else uiWPHolder = 0; - uiShootTimer = 0; } - void WaypointReached(uint32 uiPoint) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - uiWPHolder = uiPoint; - switch(uiPoint) { case 4: @@ -123,85 +109,66 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI break; } } - void AttackStart(Unit* pWho) { if (!pWho) return; - if (m_creature->Attack(pWho, false)) { m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - m_creature->GetMotionMaster()->MoveChase(pWho, 30.0f); } } - void JustSummoned(Creature* pSummoned) { pSummoned->AI()->AttackStart(m_creature); } - void Update(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) return; - if (uiShootTimer < diff) { uiShootTimer = 1500; - if (!m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DISTANCE)) DoCast(m_creature->getVictim(), SPELL_SHOOT); }else uiShootTimer -= diff; } }; - bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_TOME_VALOR) { DoScriptText(SAY_DS_START, pCreature); - if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwellAI, pCreature->AI())) pEscortAI->Start(true, true, pPlayer->GetGUID()); } - return true; } - CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) { return new npc_daphne_stilwellAI(pCreature); } - /*###### ## npc_defias_traitor ######*/ - #define SAY_START -1000101 #define SAY_PROGRESS -1000102 #define SAY_END -1000103 #define SAY_AGGRO_1 -1000104 #define SAY_AGGRO_2 -1000105 - #define QUEST_DEFIAS_BROTHERHOOD 155 - struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI { npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { case 35: @@ -223,38 +190,30 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), m_creature, who); } - void Reset() {} }; - bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) { if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitorAI, pCreature->AI())) pEscortAI->Start(true, true, pPlayer->GetGUID()); - DoScriptText(SAY_START, pCreature, pPlayer); } - return true; } - CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature) { return new npc_defias_traitorAI(pCreature); } - void AddSC_westfall() { Script *newscript; - newscript = new Script; newscript->Name = "npc_daphne_stilwell"; newscript->GetAI = &GetAI_npc_daphne_stilwell; newscript->pQuestAccept = &QuestAccept_npc_daphne_stilwell; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_defias_traitor"; newscript->GetAI = &GetAI_npc_defias_traitor; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp index d50d0fa2d2d..76bf0e7ee60 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Wetlands SD%Complete: 80 SDComment: Quest support: 1249 SDCategory: Wetlands EndScriptData */ - /* ContentData npc_mikhail npc_tapoke_slim_jahn EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_tapoke_slim_jahn ######*/ - enum eTapokeSlim { QUEST_MISSING_DIPLO_PT11 = 1249, @@ -42,19 +37,15 @@ enum eTapokeSlim NPC_SLIMS_FRIEND = 4971, NPC_TAPOKE_SLIM_JAHN = 4962 }; - struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI { npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } - bool m_bFriendSummoned; - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) m_bFriendSummoned = false; } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -62,43 +53,34 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI case 2: if (m_creature->HasStealthAura()) m_creature->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH); - SetRun(); m_creature->setFaction(FACTION_ENEMY); break; } } - void Aggro(Unit* pWho) { Player* pPlayer = GetPlayerForEscort(); - if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) m_creature->CastSpell(m_creature, SPELL_CALL_FRIENDS, true); - m_bFriendSummoned = true; } } - void JustSummoned(Creature* pSummoned) { if (Player* pPlayer = GetPlayerForEscort()) pSummoned->AI()->AttackStart(pPlayer); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32& uiDamage) { if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) @@ -107,60 +89,47 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI { if (pPlayer->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); - uiDamage = 0; - me->RestoreFaction(); m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - SetRun(false); } } } }; - CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature) { return new npc_tapoke_slim_jahnAI(pCreature); } - /*###### ## npc_mikhail ######*/ - bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) { Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); - if (!pSlim) return false; - if (!pSlim->HasStealthAura()) pSlim->CastSpell(pSlim, SPELL_STEALTH, true); - if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return false; } - /*###### ## AddSC ######*/ - void AddSC_wetlands() { Script *newscript; - newscript = new Script; newscript->Name = "npc_tapoke_slim_jahn"; newscript->GetAI = &GetAI_npc_tapoke_slim_jahn; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_mikhail"; newscript->pQuestAccept = &QuestAccept_npc_mikhail; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp index 8ac1d4166e6..2d2222fcbbd 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_Akilzon SD%Complete: 75% SDComment: Missing timer for Call Lightning and Sound ID's SQLUpdate: #Temporary fix for Soaring Eagles - EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" #include "Weather.h" - #define SPELL_STATIC_DISRUPTION 43622 #define SPELL_STATIC_VISUAL 45265 #define SPELL_CALL_LIGHTNING 43661 //Missing timer @@ -36,7 +32,6 @@ EndScriptData */ #define SPELL_ELECTRICAL_DAMAGE 43657 #define SPELL_ELECTRICAL_OVERLOAD 43658 #define SPELL_EAGLE_SWOOP 44732 - //"Your death gonna be quick, strangers. You shoulda never have come to this place..." #define SAY_ONAGGRO "I be da predator! You da prey..." #define SAY_ONDEATH "You can't... kill... me spirit!" @@ -50,13 +45,11 @@ EndScriptData */ #define SOUND_ONSLAY2 12018 #define SOUND_ONSUMMON 12014 #define SOUND_ONENRAGE 12016 - #define MOB_SOARING_EAGLE 24858 #define SE_LOC_X_MAX 400 #define SE_LOC_X_MIN 335 #define SE_LOC_Y_MAX 1435 #define SE_LOC_Y_MIN 1370 - struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI { boss_akilzonAI(Creature *c) : ScriptedAI(c) @@ -67,51 +60,40 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI pInstance = c->GetInstanceData(); } ScriptedInstance *pInstance; - uint64 BirdGUIDs[8]; uint64 TargetGUID; uint64 CycloneGUID; uint64 CloudGUID; - uint32 StaticDisruption_Timer; uint32 GustOfWind_Timer; uint32 CallLighting_Timer; uint32 ElectricalStorm_Timer; uint32 SummonEagles_Timer; uint32 Enrage_Timer; - uint32 StormCount; uint32 StormSequenceTimer; - bool isRaining; - void Reset() { if (pInstance) pInstance->SetData(DATA_AKILZONEVENT, NOT_STARTED); - StaticDisruption_Timer = (10+rand()%10)*1000; //10 to 20 seconds (bosskillers) GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) CallLighting_Timer = (10+rand()%10)*1000; //totaly random timer. can't find any info on this ElectricalStorm_Timer = 60*1000; //60 seconds(bosskillers) Enrage_Timer = 10*60*1000; //10 minutes till enrage(bosskillers) SummonEagles_Timer = 99999; - TargetGUID = 0; CloudGUID = 0; CycloneGUID = 0; DespawnSummons(); - for(uint8 i = 0; i < 8; ++i) + for (uint8 i = 0; i < 8; ++i) BirdGUIDs[i] = 0; - StormCount = 0; StormSequenceTimer = 0; - isRaining = false; - SetWeather(WEATHER_STATE_FINE, 0.0f); } - void EnterCombat(Unit *who) { m_creature->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); @@ -120,7 +102,6 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_AKILZONEVENT, IN_PROGRESS); } - void JustDied(Unit* Killer) { m_creature->MonsterYell(SAY_ONDEATH,LANG_UNIVERSAL,NULL); @@ -129,7 +110,6 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI pInstance->SetData(DATA_AKILZONEVENT, DONE); DespawnSummons(); } - void KilledUnit(Unit* victim) { switch(rand()%2) @@ -144,7 +124,6 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI break; } } - void DespawnSummons() { for (uint8 i = 0; i < 8; ++i) @@ -157,47 +136,38 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI } } } - void SetWeather(uint32 weather, float grade) { Map* pMap = m_creature->GetMap(); if (!pMap->IsDungeon()) return; - WorldPacket data(SMSG_WEATHER, (4+4+4)); data << uint32(weather) << (float)grade << uint8(0); - pMap->SendToPlayers(&data); } - void HandleStormSequence(Unit *Cloud) // 1: begin, 2-9: tick, 10: end { if (StormCount < 10 && StormCount > 1) { // deal damage int32 bp0 = 800; - for(uint8 i = 2; i < StormCount; ++i) + for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; - CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - std::list tempUnitMap; - { Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(m_creature, m_creature, 999); Trinity::UnitListSearcher searcher(m_creature, tempUnitMap, u_check); - TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *(m_creature->GetMap())); cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); } //dealdamege - for(std::list::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) + for (std::list::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if (!Cloud->IsWithinDist(*i, 6, false)) { @@ -207,7 +177,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI // visual float x,y,z; z = m_creature->GetPositionZ(); - for(uint8 i = 0; i < 5+rand()%5; ++i) + for (uint8 i = 0; i < 5+rand()%5; ++i) { x = 343+rand()%60; y = 1380+rand()%60; @@ -236,12 +206,10 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI } StormSequenceTimer = 1000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (StormCount) { Unit* target = Unit::GetUnit(*m_creature, CloudGUID); @@ -252,20 +220,17 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI } else if (Unit* Cyclone = Unit::GetUnit(*m_creature, CycloneGUID)) Cyclone->CastSpell(target, 25160, true); // keep casting or... - if (StormSequenceTimer < diff) { HandleStormSequence(target); }else StormSequenceTimer -= diff; return; } - if (Enrage_Timer < diff) { m_creature->MonsterYell(SAY_ONENRAGE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONENRAGE); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); Enrage_Timer = 600000; }else Enrage_Timer -= diff; - if (StaticDisruption_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) target = m_creature->getVictim(); @@ -273,28 +238,23 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI m_creature->CastSpell(target, SPELL_STATIC_DISRUPTION, false); m_creature->SetInFront(m_creature->getVictim()); StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s - /*if (float dist = m_creature->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ }else StaticDisruption_Timer -= diff; - if (GustOfWind_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) target = m_creature->getVictim(); DoCast(target, SPELL_GUST_OF_WIND); GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; - if (CallLighting_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CALL_LIGHTNING); CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; - if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } - if (ElectricalStorm_Timer < diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!target) @@ -327,19 +287,16 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI StormCount = 1; StormSequenceTimer = 0; } else ElectricalStorm_Timer -= diff; - if (SummonEagles_Timer < diff) { m_creature->MonsterYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONSUMMON); - float x, y, z; m_creature->GetPosition(x, y, z); - for (uint8 i = 0; i < 8; ++i) { Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); - if (!bird)//they despawned on die + if (!bird) //they despawned on die { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { @@ -359,19 +316,15 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_soaring_eagleAI : public ScriptedAI { mob_soaring_eagleAI(Creature *c) : ScriptedAI(c) {} - uint32 EagleSwoop_Timer; bool arrived; uint32 TargetGUID; - void Reset() { EagleSwoop_Timer = 5000 + rand()%5000; @@ -379,11 +332,8 @@ struct TRINITY_DLL_DECL mob_soaring_eagleAI : public ScriptedAI TargetGUID = 0; m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); } - void EnterCombat(Unit *who) {DoZoneInCombat();} - void MoveInLineOfSight(Unit* who) {} - void MovementInform(uint32, uint32) { arrived = true; @@ -396,12 +346,10 @@ struct TRINITY_DLL_DECL mob_soaring_eagleAI : public ScriptedAI EagleSwoop_Timer = 5000 + rand()%5000; } } - void UpdateAI(const uint32 diff) { if (EagleSwoop_Timer < diff) EagleSwoop_Timer = 0; else EagleSwoop_Timer -= diff; - if (arrived) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -427,27 +375,22 @@ struct TRINITY_DLL_DECL mob_soaring_eagleAI : public ScriptedAI } } }; - //Soaring Eagle CreatureAI* GetAI_mob_soaring_eagle(Creature* pCreature) { return new mob_soaring_eagleAI(pCreature); } - CreatureAI* GetAI_boss_akilzon(Creature* pCreature) { return new boss_akilzonAI(pCreature); } - void AddSC_boss_akilzon() { Script *newscript = NULL; - newscript = new Script; newscript->Name = "boss_akilzon"; newscript->GetAI = &GetAI_boss_akilzon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_akilzon_eagle"; newscript->GetAI = &GetAI_mob_soaring_eagle; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp index 2cced564afb..ff1a26e548c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_Halazzi SD%Complete: 80 SDComment: SDCategory: Zul'Aman EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" //#include "spell.h" - #define YELL_AGGRO "Get on your knees and bow to da fang and claw!" #define SOUND_AGGRO 12020 #define YELL_SABER_ONE "You gonna leave in pieces!" @@ -41,7 +38,6 @@ EndScriptData */ #define SOUND_DEATH 12028 #define YELL_BERSERK "Whatch you be doing? Pissin' yourselves..." #define SOUND_BERSERK 12025 - #define SPELL_DUAL_WIELD 29651 #define SPELL_SABER_LASH 43267 #define SPELL_FRENZY 43139 @@ -53,14 +49,11 @@ EndScriptData */ #define SPELL_SUMMON_LYNX 43143 #define SPELL_SUMMON_TOTEM 43302 #define SPELL_BERSERK 45078 - #define MOB_SPIRIT_LYNX 24143 #define SPELL_LYNX_FRENZY 43290 #define SPELL_SHRED_ARMOR 43243 - #define MOB_TOTEM 24224 #define SPELL_LIGHTNING 43301 - enum PhaseHalazzi { PHASE_NONE = 0, @@ -70,7 +63,6 @@ enum PhaseHalazzi PHASE_MERGE = 4, PHASE_ENRAGE = 5 }; - struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI { boss_halazziAI(Creature *c) : ScriptedAI(c) @@ -81,72 +73,55 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI if (TempSpell && TempSpell->CastingTimeIndex != 5) TempSpell->CastingTimeIndex = 5; // 2000 ms casting time } - ScriptedInstance *pInstance; - uint32 FrenzyTimer; uint32 SaberlashTimer; uint32 ShockTimer; uint32 TotemTimer; uint32 CheckTimer; uint32 BerserkTimer; - uint32 TransformCount; - PhaseHalazzi Phase; - uint64 LynxGUID; - void Reset() { if (pInstance) pInstance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); - TransformCount = 0; BerserkTimer = 600000; CheckTimer = 1000; - DoCast(m_creature, SPELL_DUAL_WIELD, true); - Phase = PHASE_NONE; EnterPhase(PHASE_LYNX); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_HALAZZIEVENT, IN_PROGRESS); - m_creature->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_AGGRO); - EnterPhase(PHASE_LYNX); } - void JustSummoned(Creature* summon) { summon->AI()->AttackStart(m_creature->getVictim()); if (summon->GetEntry() == MOB_SPIRIT_LYNX) LynxGUID = summon->GetGUID(); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth() && Phase != PHASE_ENRAGE) damage = 0; } - void SpellHit(Unit*, const SpellEntry *spell) { if (spell->Id == SPELL_TRANSFORM_SPLIT2) EnterPhase(PHASE_HUMAN); } - void AttackStart(Unit *who) { if (Phase != PHASE_MERGE) ScriptedAI::AttackStart(who); } - void EnterPhase(PhaseHalazzi NextPhase) { switch(NextPhase) @@ -201,12 +176,10 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI } Phase = NextPhase; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (BerserkTimer < diff) { m_creature->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); @@ -214,7 +187,6 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK, true); BerserkTimer = 60000; }else BerserkTimer -= diff; - if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE) { if (SaberlashTimer < diff) @@ -225,13 +197,11 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI //m_creature->RemoveAurasDueToSpell(41296); SaberlashTimer = 30000; }else SaberlashTimer -= diff; - if (FrenzyTimer < diff) { DoCast(m_creature, SPELL_FRENZY); FrenzyTimer = (10+rand()%5)*1000; }else FrenzyTimer -= diff; - if (Phase == PHASE_LYNX) if (CheckTimer < diff) { @@ -240,7 +210,6 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI CheckTimer = 1000; }else CheckTimer -= diff; } - if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE) { if (TotemTimer < diff) @@ -248,7 +217,6 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI DoCast(m_creature, SPELL_SUMMON_TOTEM); TotemTimer = 20000; }else TotemTimer -= diff; - if (ShockTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -260,7 +228,6 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI ShockTimer = 10000 + rand()%5000; } }else ShockTimer -= diff; - if (Phase == PHASE_HUMAN) if (CheckTimer < diff) { @@ -275,7 +242,6 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI CheckTimer = 1000; }else CheckTimer -= diff; } - if (Phase == PHASE_MERGE) { if (CheckTimer < diff) @@ -296,10 +262,8 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI CheckTimer = 1000; }else CheckTimer -= diff; } - DoMeleeAttackIfReady(); } - void KilledUnit(Unit* victim) { switch(rand()%2) @@ -308,85 +272,67 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI m_creature->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_KILL_ONE); break; - case 1: m_creature->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_KILL_TWO); break; } } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_HALAZZIEVENT, DONE); - m_creature->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_DEATH); } }; - // Spirits Lynx AI - struct TRINITY_DLL_DECL boss_spiritlynxAI : public ScriptedAI { boss_spiritlynxAI(Creature *c) : ScriptedAI(c) {} - uint32 FrenzyTimer; uint32 shredder_timer; - void Reset() { FrenzyTimer = (30+rand()%20)*1000; //frenzy every 30-50 seconds shredder_timer = 4000; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth()) damage = 0; } - void AttackStart(Unit *who) { if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) ScriptedAI::AttackStart(who); } - void EnterCombat(Unit *who) {/*DoZoneInCombat();*/} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (FrenzyTimer < diff) { DoCast(m_creature, SPELL_LYNX_FRENZY); FrenzyTimer = (30+rand()%20)*1000; }else FrenzyTimer -= diff; - if (shredder_timer < diff) { DoCast(m_creature->getVictim(), SPELL_SHRED_ARMOR); shredder_timer = 4000; }else shredder_timer -= diff; - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_boss_halazziAI(Creature* pCreature) { return new boss_halazziAI (pCreature); } - CreatureAI* GetAI_boss_spiritlynxAI(Creature* pCreature) { return new boss_spiritlynxAI (pCreature); } - void AddSC_boss_halazzi() { Script *newscript; @@ -394,7 +340,6 @@ void AddSC_boss_halazzi() newscript->Name = "boss_halazzi"; newscript->GetAI = &GetAI_boss_halazziAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_halazzi_lynx"; newscript->GetAI = &GetAI_boss_spiritlynxAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_hexlord.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_hexlord.cpp index d2933de614f..202634abbd1 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_hexlord.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_hexlord.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hex_Lord_Malacrass SD%Complete: SDComment: SDCategory: Zul'Aman EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" - #define YELL_AGGRO "Da shadow gonna fall on you... " #define SOUND_YELL_AGGRO 12041 #define YELL_SPIRIT_BOLTS "Your soul gonna bleed!" @@ -36,36 +33,28 @@ EndScriptData */ #define SOUND_YELL_KILL_TWO 12044 #define YELL_DEATH "Dis not... da end of me..." #define SOUND_YELL_DEATH 12051 - #define SPELL_SPIRIT_BOLTS 43383 #define SPELL_DRAIN_POWER 44131 #define SPELL_SIPHON_SOUL 43501 - #define MOB_TEMP_TRIGGER 23920 - //Defines for various powers he uses after using soul drain - //Druid #define SPELL_DR_LIFEBLOOM 43421 #define SPELL_DR_THORNS 43420 #define SPELL_DR_MOONFIRE 43545 - //Hunter #define SPELL_HU_EXPLOSIVE_TRAP 43444 #define SPELL_HU_FREEZING_TRAP 43447 #define SPELL_HU_SNAKE_TRAP 43449 - //Mage #define SPELL_MG_FIREBALL 41383 #define SPELL_MG_FROSTBOLT 43428 #define SPELL_MG_FROST_NOVA 43426 #define SPELL_MG_ICE_LANCE 43427 - //Paladin #define SPELL_PA_CONSECRATION 43429 #define SPELL_PA_HOLY_LIGHT 43451 #define SPELL_PA_AVENGING_WRATH 43430 - //Priest #define SPELL_PR_HEAL 41372 #define SPELL_PR_MIND_CONTROL 43550 @@ -73,33 +62,26 @@ EndScriptData */ #define SPELL_PR_SW_DEATH 41375 #define SPELL_PR_PSYCHIC_SCREAM 43432 #define SPELL_PR_PAIN_SUPP 44416 - //Rogue #define SPELL_RO_BLIND 43433 #define SPELL_RO_SLICE_DICE 43457 #define SPELL_RO_WOUND_POISON 39665 - //Shaman #define SPELL_SH_FIRE_NOVA 43436 #define SPELL_SH_HEALING_WAVE 43548 #define SPELL_SH_CHAIN_LIGHT 43435 - //Warlock #define SPELL_WL_CURSE_OF_DOOM 43439 #define SPELL_WL_RAIN_OF_FIRE 43440 #define SPELL_WL_UNSTABLE_AFFL 35183 - //Warrior #define SPELL_WR_SPELL_REFLECT 43443 #define SPELL_WR_WHIRLWIND 43442 #define SPELL_WR_MORTAL_STRIKE 43441 - #define ORIENT 1.5696 #define POS_Y 921.2795 #define POS_Z 33.8883 - static float Pos_X[4] = {112.8827, 107.8827, 122.8827, 127.8827}; - static uint32 AddEntryList[8]= { 24240, //Alyson Antille @@ -111,7 +93,6 @@ static uint32 AddEntryList[8]= 24246, //Darkheart 24247 //Koragg }; - enum AbilityTarget { ABILITY_TARGET_SELF = 0, @@ -121,14 +102,12 @@ enum AbilityTarget ABILITY_TARGET_BUFF = 4, ABILITY_TARGET_SPECIAL = 5 }; - struct PlayerAbilityStruct { uint32 spell; AbilityTarget target; uint32 cooldown; }; - static PlayerAbilityStruct PlayerAbility[][3] = { // 1 warrior @@ -172,20 +151,15 @@ static PlayerAbilityStruct PlayerAbility[][3] = {SPELL_DR_THORNS, ABILITY_TARGET_SELF, 10000}, {SPELL_DR_MOONFIRE, ABILITY_TARGET_ENEMY, 8000}} }; - struct TRINITY_DLL_DECL boss_hexlord_addAI : public ScriptedAI { ScriptedInstance* pInstance; - boss_hexlord_addAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - void Reset() {} - void EnterCombat(Unit* who) {DoZoneInCombat();} - void UpdateAI(const uint32 diff) { if (pInstance && pInstance->GetData(DATA_HEXLORDEVENT) != IN_PROGRESS) @@ -193,67 +167,52 @@ struct TRINITY_DLL_DECL boss_hexlord_addAI : public ScriptedAI EnterEvadeMode(); return; } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI { boss_hex_lord_malacrassAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); SelectAddEntry(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; } - ScriptedInstance *pInstance; - uint64 AddGUID[4]; uint32 AddEntry[4]; - uint64 PlayerGUID; - uint32 SpiritBolts_Timer; uint32 DrainPower_Timer; uint32 SiphonSoul_Timer; uint32 PlayerAbility_Timer; uint32 CheckAddState_Timer; uint32 ResetTimer; - uint32 PlayerClass; - Unit* SoulDrainTarget; - void Reset() { if (pInstance) pInstance->SetData(DATA_HEXLORDEVENT, NOT_STARTED); - SpiritBolts_Timer = 20000; DrainPower_Timer = 60000; SiphonSoul_Timer = 100000; PlayerAbility_Timer = 99999; CheckAddState_Timer = 5000; ResetTimer = 5000; - SpawnAdds(); - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 46916); m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); } - void EnterCombat(Unit* who) { if (pInstance) pInstance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS); - DoZoneInCombat(); m_creature->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_YELL_AGGRO); - - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Unit* Temp = Unit::GetUnit((*m_creature),AddGUID[i]); if (Temp && Temp->isAlive()) @@ -265,7 +224,6 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI } } } - void KilledUnit(Unit* victim) { switch(rand()%2) @@ -280,41 +238,33 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI break; } } - void JustDied(Unit* victim) { if (pInstance) pInstance->SetData(DATA_HEXLORDEVENT, DONE); - m_creature->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_YELL_DEATH); - - for(uint8 i = 0; i < 4 ; ++i) + for (uint8 i = 0; i < 4 ; ++i) { Unit* Temp = Unit::GetUnit((*m_creature),AddGUID[i]); if (Temp && Temp->isAlive()) Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - void SelectAddEntry() { std::vector AddList; - - for(uint8 i = 0; i < 8; ++i) + for (uint8 i = 0; i < 8; ++i) AddList.push_back(AddEntryList[i]); - while(AddList.size() > 4) AddList.erase(AddList.begin()+rand()%AddList.size()); - uint8 i = 0; - for(std::vector::iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) + for (std::vector::iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) AddEntry[i] = *itr; } - void SpawnAdds() { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature *pCreature = (Unit::GetCreature((*m_creature), AddGUID[i])); if (!pCreature || !pCreature->isAlive()) @@ -331,12 +281,10 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ResetTimer < diff) { if (m_creature->IsWithinDist3d(119.223,1035.45,29.4481, 10)) @@ -346,10 +294,9 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI } ResetTimer = 5000; }else ResetTimer -= diff; - if (CheckAddState_Timer < diff) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Unit* Temp = Unit::GetUnit((*m_creature),AddGUID[i]); if (Temp && Temp->isAlive() && !Temp->getVictim()) @@ -357,7 +304,6 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI } CheckAddState_Timer = 5000; }else CheckAddState_Timer -= diff; - if (DrainPower_Timer < diff) { m_creature->CastSpell(m_creature, SPELL_DRAIN_POWER, true); @@ -365,7 +311,6 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_YELL_DRAIN_POWER); DrainPower_Timer = 40000 + rand()%15000; // must cast in 60 sec, or buff/debuff will disappear }else DrainPower_Timer -= diff; - if (SpiritBolts_Timer < diff) { if (DrainPower_Timer < 12000) // channel 10 sec @@ -380,7 +325,6 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI PlayerAbility_Timer = 99999; } }else SpiritBolts_Timer -= diff; - if (SiphonSoul_Timer < diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true); @@ -396,11 +340,9 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); trigger->CastSpell(target, SPELL_SIPHON_SOUL, true); trigger->GetMotionMaster()->MoveChase(m_creature); - //m_creature->CastSpell(target, SPELL_SIPHON_SOUL, true); //m_creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID()); //m_creature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL); - PlayerGUID = target->GetGUID(); PlayerAbility_Timer = 8000 + rand()%2000; PlayerClass = target->getClass() - 1; @@ -409,7 +351,6 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI SiphonSoul_Timer = 99999; // buff lasts 30 sec } }else SiphonSoul_Timer -= diff; - if (PlayerAbility_Timer < diff) { //Unit* target = Unit::GetUnit(*m_creature, PlayerGUID); @@ -419,10 +360,8 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI PlayerAbility_Timer = 8000 + rand()%2000; } }else PlayerAbility_Timer -= diff; - DoMeleeAttackIfReady(); } - void UseAbility() { uint32 random = rand()%3; @@ -453,31 +392,23 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI m_creature->CastSpell(target, PlayerAbility[PlayerClass][random].spell, false); } }; - #define SPELL_BLOODLUST 43578 #define SPELL_CLEAVE 15496 - struct TRINITY_DLL_DECL boss_thurgAI : public boss_hexlord_addAI { - boss_thurgAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 bloodlust_timer; uint32 cleave_timer; - void Reset() { bloodlust_timer = 15000; cleave_timer = 10000; - boss_hexlord_addAI::Reset(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (bloodlust_timer < diff) { std::list templist = DoFindFriendlyMissingBuff(50, SPELL_BLOODLUST); @@ -488,43 +419,33 @@ struct TRINITY_DLL_DECL boss_thurgAI : public boss_hexlord_addAI } bloodlust_timer = 12000; }else bloodlust_timer -= diff; - if (cleave_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_CLEAVE, false); cleave_timer = 12000; //3 sec cast }else cleave_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - #define SPELL_FLASH_HEAL 43575 #define SPELL_DISPEL_MAGIC 43577 - struct TRINITY_DLL_DECL boss_alyson_antilleAI : public boss_hexlord_addAI { //Holy Priest boss_alyson_antilleAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 flashheal_timer; uint32 dispelmagic_timer; - void Reset() { flashheal_timer = 2500; dispelmagic_timer = 10000; - //AcquireGUID(); - boss_hexlord_addAI::Reset(); } - void AttackStart(Unit* who) { if (!who) return; - if (who->isTargetableForAttack()) { if (m_creature->Attack(who, false)) @@ -534,12 +455,10 @@ struct TRINITY_DLL_DECL boss_alyson_antilleAI : public boss_hexlord_addAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (flashheal_timer < diff) { Unit* target = DoSelectLowestHpFriendly(99, 30000); @@ -566,44 +485,34 @@ struct TRINITY_DLL_DECL boss_alyson_antilleAI : public boss_hexlord_addAI } flashheal_timer = 2500; }else flashheal_timer -= diff; - /*if (dispelmagic_timer < diff) { if (rand()%2) { Unit* target = SelectTarget(); - m_creature->CastSpell(target, SPELL_DISPEL_MAGIC, false); } else m_creature->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DISPEL_MAGIC, false); - dispelmagic_timer = 12000; }else dispelmagic_timer -= diff;*/ - boss_hexlord_addAI::UpdateAI(diff); } }; - #define SPELL_FIREBOLT 43584 - struct TRINITY_DLL_DECL boss_gazakrothAI : public boss_hexlord_addAI { boss_gazakrothAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 firebolt_timer; - void Reset() { firebolt_timer = 2000; boss_hexlord_addAI::Reset(); } - void AttackStart(Unit* who) { if (!who) return; - if (who->isTargetableForAttack()) { if (m_creature->Attack(who, false)) @@ -613,111 +522,85 @@ struct TRINITY_DLL_DECL boss_gazakrothAI : public boss_hexlord_addAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (firebolt_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_FIREBOLT, false); firebolt_timer = 700; }else firebolt_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - #define SPELL_FLAME_BREATH 43582 #define SPELL_THUNDERCLAP 43583 - struct TRINITY_DLL_DECL boss_lord_raadanAI : public boss_hexlord_addAI { boss_lord_raadanAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 flamebreath_timer; uint32 thunderclap_timer; - void Reset() { flamebreath_timer = 8000; thunderclap_timer = 13000; - boss_hexlord_addAI::Reset(); - } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (thunderclap_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_THUNDERCLAP, false); thunderclap_timer = 12000; }else thunderclap_timer -= diff; - if (flamebreath_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_FLAME_BREATH, false); flamebreath_timer = 12000; }else flamebreath_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - #define SPELL_PSYCHIC_WAIL 43590 - struct TRINITY_DLL_DECL boss_darkheartAI : public boss_hexlord_addAI { boss_darkheartAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 psychicwail_timer; - void Reset() { psychicwail_timer = 8000; - boss_hexlord_addAI::Reset(); - } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (psychicwail_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_PSYCHIC_WAIL, false); psychicwail_timer = 12000; }else psychicwail_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - #define SPELL_VENOM_SPIT 43579 - struct TRINITY_DLL_DECL boss_slitherAI : public boss_hexlord_addAI { boss_slitherAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 venomspit_timer; - void Reset() { venomspit_timer = 5000; boss_hexlord_addAI::Reset(); } - void AttackStart(Unit* who) { if (!who) return; - if (who->isTargetableForAttack()) { if (m_creature->Attack(who, false)) @@ -727,80 +610,64 @@ struct TRINITY_DLL_DECL boss_slitherAI : public boss_hexlord_addAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (venomspit_timer < diff) { if (Unit* victim = SelectUnit(SELECT_TARGET_RANDOM, 0)) m_creature->CastSpell(victim,SPELL_VENOM_SPIT, false); venomspit_timer = 2500; }else venomspit_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - //Fenstalker #define SPELL_VOLATILE_INFECTION 43586 - struct TRINITY_DLL_DECL boss_fenstalkerAI : public boss_hexlord_addAI { boss_fenstalkerAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 volatileinf_timer; - void Reset() { volatileinf_timer = 15000; boss_hexlord_addAI::Reset(); - } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (volatileinf_timer < diff) { // core bug m_creature->getVictim()->CastSpell(m_creature->getVictim(),SPELL_VOLATILE_INFECTION, false); volatileinf_timer = 12000; }else volatileinf_timer -= diff; - boss_hexlord_addAI::UpdateAI(diff); } }; - //Koragg #define SPELL_COLD_STARE 43593 #define SPELL_MIGHTY_BLOW 43592 - struct TRINITY_DLL_DECL boss_koraggAI : public boss_hexlord_addAI { boss_koraggAI(Creature *c) : boss_hexlord_addAI(c) {} - uint32 coldstare_timer; uint32 mightyblow_timer; - void Reset() { coldstare_timer = 15000; mightyblow_timer = 10000; boss_hexlord_addAI::Reset(); - } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (mightyblow_timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_MIGHTY_BLOW, false); @@ -812,51 +679,41 @@ struct TRINITY_DLL_DECL boss_koraggAI : public boss_hexlord_addAI m_creature->CastSpell(victim,SPELL_COLD_STARE, false); coldstare_timer = 12000; } - boss_hexlord_addAI::UpdateAI(diff); } }; - CreatureAI* GetAI_boss_hex_lord_malacrass(Creature* pCreature) { return new boss_hex_lord_malacrassAI (pCreature); } - CreatureAI* GetAI_boss_thurg(Creature* pCreature) { return new boss_thurgAI (pCreature); } - CreatureAI* GetAI_boss_alyson_antille(Creature* pCreature) { return new boss_alyson_antilleAI (pCreature); } - CreatureAI* GetAI_boss_gazakroth(Creature* pCreature) { return new boss_gazakrothAI (pCreature); } - CreatureAI* GetAI_boss_lord_raadan(Creature* pCreature) { return new boss_lord_raadanAI (pCreature); } - CreatureAI* GetAI_boss_darkheart(Creature* pCreature) { return new boss_darkheartAI (pCreature); } - CreatureAI* GetAI_boss_slither(Creature* pCreature) { return new boss_slitherAI (pCreature); } - CreatureAI* GetAI_boss_fenstalker(Creature* pCreature) { return new boss_fenstalkerAI (pCreature); } - CreatureAI* GetAI_boss_koragg(Creature* pCreature) { return new boss_koraggAI (pCreature); @@ -868,42 +725,34 @@ void AddSC_boss_hex_lord_malacrass() newscript->Name = "boss_hexlord_malacrass"; newscript->GetAI = &GetAI_boss_hex_lord_malacrass; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_thurg"; newscript->GetAI = &GetAI_boss_thurg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_gazakroth"; newscript->GetAI = &GetAI_boss_gazakroth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lord_raadan"; newscript->GetAI = &GetAI_boss_lord_raadan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_darkheart"; newscript->GetAI = &GetAI_boss_darkheart; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_slither"; newscript->GetAI = &GetAI_boss_slither; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_fenstalker"; newscript->GetAI = &GetAI_boss_fenstalker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_koragg"; newscript->GetAI = &GetAI_boss_koragg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_alyson_antille"; newscript->GetAI = &GetAI_boss_alyson_antille; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp index d946b26ffdf..b5ae692bc8f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Janalai SD%Complete: 100 SDComment: SDCategory: Zul'Aman EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" #include "GridNotifiers.h" - enum eEnums { SAY_AGGRO = -1568000, @@ -37,7 +34,6 @@ enum eEnums SAY_DEATH = -1568007, SAY_EVENT_STRANGERS = -1568008, SAY_EVENT_FRIENDS = -1568009, - // Jan'alai SPELL_FLAME_BREATH = 43140, SPELL_FIRE_WALL = 43113, @@ -46,34 +42,27 @@ enum eEnums SPELL_TELE_TO_CENTER = 43098, // coord SPELL_HATCH_ALL = 43144, SPELL_BERSERK = 45078, - // -- Fire Bob Spells SPELL_FIRE_BOMB_CHANNEL = 42621, // last forever SPELL_FIRE_BOMB_THROW = 42628, // throw visual SPELL_FIRE_BOMB_DUMMY = 42629, // bomb visual SPELL_FIRE_BOMB_DAMAGE = 42630, - // --Summons MOB_AMANI_HATCHER = 23818, MOB_HATCHLING = 23598, // 42493 MOB_EGG = 23817, MOB_FIRE_BOMB = 23920, - // -- Hatcher Spells SPELL_HATCH_EGG = 43734, // 42471 - // -- Hatchling Spells SPELL_FLAMEBUFFET = 43299 }; - const int area_dx = 44; const int area_dy = 51; - float JanalainPos[1][3] = { {-33.93, 1149.27, 19} }; - float FireWallCoords[4][4] = { {-10.13, 1149.27, 19, 3.1415}, @@ -81,7 +70,6 @@ float FireWallCoords[4][4] = {-54.80, 1150.08, 19, 0}, {-33.93, 1175.68, 19, 1.5*3.1415} }; - float hatcherway[2][5][3] = { { @@ -99,13 +87,11 @@ float hatcherway[2][5][3] = {-34.29,1095.22,19} } }; - struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI { boss_janalaiAI(Creature *c) : ScriptedAI(c) { pInstance =c->GetInstanceData(); - SpellEntry *TempSpell = GET_SPELL(SPELL_HATCH_EGG); if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) { @@ -113,70 +99,53 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI TempSpell->EffectImplicitTargetB[0] = 0; } } - ScriptedInstance *pInstance; - uint32 FireBreathTimer; uint32 BombTimer; uint32 BombSequenceTimer; uint32 BombCount; uint32 HatcherTimer; uint32 EnrageTimer; - bool noeggs; bool enraged; bool isBombing; - bool isFlameBreathing; - uint64 FireBombGUIDs[40]; - void Reset() { if (pInstance) pInstance->SetData(DATA_JANALAIEVENT, NOT_STARTED); - FireBreathTimer = 8000; BombTimer = 30000; BombSequenceTimer = 1000; BombCount = 0; HatcherTimer = 10000; EnrageTimer = MINUTE*5*IN_MILISECONDS; - noeggs = false; isBombing =false; enraged = false; - isFlameBreathing = false; - - for(uint8 i = 0; i < 40; ++i) + for (uint8 i = 0; i < 40; ++i) FireBombGUIDs[i] = 0; - HatchAllEggs(1); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_JANALAIEVENT, DONE); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, m_creature); // DoZoneInCombat(); } - void DamageDeal(Unit* target, uint32 &damage) { if (isFlameBreathing) @@ -185,19 +154,17 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI damage = 0; } } - void FireWall() { uint8 WallNum; Creature* wall = NULL; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (i == 0 || i == 2) WallNum = 3; else WallNum = 2; - - for(uint8 j = 0; j < WallNum; j++) + for (uint8 j = 0; j < WallNum; j++) { if (WallNum == 3) wall = m_creature->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0],FireWallCoords[i][1]+5*(j-1),FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000); @@ -207,47 +174,38 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI } } } - void SpawnBombs() { float dx, dy; - for(int i(0); i < 40; ++i) + for (int i(0); i < 40; ++i) { dx =(rand()%(area_dx))-(area_dx/2); dy =(rand()%(area_dy))-(area_dy/2); - Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); if (bomb) FireBombGUIDs[i] = bomb->GetGUID(); } BombCount = 0; } - bool HatchAllEggs(uint32 uiAction) //1: reset, 2: isHatching all { std::list templist; float x, y, z; m_creature->GetPosition(x, y, z); - { CellPair pair(Trinity::ComputeCellPair(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(m_creature, MOB_EGG, 100); Trinity::CreatureListSearcher searcher(m_creature, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap())); } - //error_log("Eggs %d at middle", templist.size()); if (!templist.size()) return false; - - for(std::list::iterator i = templist.begin(); i != templist.end(); ++i) + for (std::list::iterator i = templist.begin(); i != templist.end(); ++i) { if (uiAction == 1) (*i)->SetDisplayId(10056); @@ -256,34 +214,28 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI } return true; } - void Boom() { std::list templist; float x, y, z; m_creature->GetPosition(x, y, z); - { CellPair pair(Trinity::ComputeCellPair(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(m_creature, MOB_FIRE_BOMB, 100); Trinity::CreatureListSearcher searcher(m_creature, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap())); } - for(std::list::iterator i = templist.begin(); i != templist.end(); ++i) + for (std::list::iterator i = templist.begin(); i != templist.end(); ++i) { (*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true); (*i)->RemoveAllAuras(); } } - void HandleBombSequence() { if (BombCount < 40) @@ -312,7 +264,6 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI EnrageTimer -= 10000; } } - void UpdateAI(const uint32 diff) { if (isFlameBreathing) @@ -322,7 +273,6 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI isFlameBreathing = false; }else return; } - if (isBombing) { if (BombSequenceTimer < diff) @@ -331,14 +281,11 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI }else BombSequenceTimer -= diff; return; } - if (!UpdateVictim()) return; - //enrage if under 25% hp before 5 min. if (!enraged && m_creature->GetHealth() * 4 < m_creature->GetMaxHealth()) EnrageTimer = 0; - if (EnrageTimer < diff) { if (!enraged) @@ -354,11 +301,9 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI EnrageTimer = 300000; } }else EnrageTimer -= diff; - if (BombTimer < diff) { DoScriptText(SAY_FIRE_BOMBS, m_creature); - m_creature->AttackStop(); m_creature->GetMotionMaster()->Clear(); DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); @@ -366,17 +311,15 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_CHANNEL, false); //DoTeleportPlayer(m_creature, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0); //m_creature->CastSpell(m_creature, SPELL_TELE_TO_CENTER, true); - FireWall(); SpawnBombs(); isBombing = true; BombSequenceTimer = 100; - //Teleport every Player into the middle Map* pMap = m_creature->GetMap(); if (!pMap->IsDungeon()) return; Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* i_pl = i->getSource()) if (i_pl->isAlive()) @@ -385,13 +328,11 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI //m_creature->CastSpell(Temp, SPELL_SUMMON_PLAYERS, true); // core bug, spell does not work if too far return; }else BombTimer -= diff; - if (!noeggs) { if (100 * m_creature->GetHealth() < 35 * m_creature->GetMaxHealth()) { DoScriptText(SAY_ALL_EGGS, m_creature); - m_creature->AttackStop(); m_creature->GetMotionMaster()->Clear(); DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); @@ -413,11 +354,8 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI noeggs = true; }else HatcherTimer -= diff; } - EnterEvadeIfOutOfCombatArea(diff); - DoMeleeAttackIfReady(); - if (FireBreathTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -432,55 +370,41 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI }else FireBreathTimer -= diff; } }; - CreatureAI* GetAI_boss_janalaiAI(Creature* pCreature) { return new boss_janalaiAI(pCreature); } - struct TRINITY_DLL_DECL mob_janalai_firebombAI : public ScriptedAI { mob_janalai_firebombAI(Creature *c) : ScriptedAI(c){} - void Reset() {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_FIRE_BOMB_THROW) m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_DUMMY, true); } - void EnterCombat(Unit* who) {} - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) {} }; - CreatureAI* GetAI_mob_janalai_firebombAI(Creature* pCreature) { return new mob_janalai_firebombAI(pCreature); } - struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI { mob_amanishi_hatcherAI(Creature *c) : ScriptedAI(c) { pInstance =c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 waypoint; uint32 HatchNum; uint32 WaitTimer; - bool side; bool hasChangedSide; bool isHatching; - void Reset() { side =(m_creature->GetPositionY() < 1150); @@ -490,31 +414,24 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI WaitTimer = 1; HatchNum = 0; } - bool HatchEggs(uint32 num) { std::list templist; float x, y, z; m_creature->GetPosition(x, y, z); - { CellPair pair(Trinity::ComputeCellPair(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(m_creature, 23817, 50); Trinity::CreatureListSearcher searcher(m_creature, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap())); } - //error_log("Eggs %d at %d", templist.size(), side); - - for(std::list::iterator i = templist.begin(); i != templist.end() && num > 0; ++i) + for (std::list::iterator i = templist.begin(); i != templist.end() && num > 0; ++i) { if ((*i)->GetDisplayId() != 11686) { @@ -522,13 +439,11 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI num--; } } - if (num) return false; // no more templist else return true; } - void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} @@ -543,7 +458,6 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI else WaitTimer = 1; } - void UpdateAI(const uint32 diff) { if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) @@ -552,7 +466,6 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI m_creature->setDeathState(JUST_DIED); return; } - if (!isHatching) { if (WaitTimer) @@ -589,22 +502,18 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_amanishi_hatcherAI(Creature* pCreature) { return new mob_amanishi_hatcherAI(pCreature); } - struct TRINITY_DLL_DECL mob_hatchlingAI : public ScriptedAI { mob_hatchlingAI(Creature *c) : ScriptedAI(c) { pInstance =c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 BuffetTimer; - void Reset() { BuffetTimer = 7000; @@ -612,12 +521,9 @@ struct TRINITY_DLL_DECL mob_hatchlingAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[0][3][2]); else m_creature->GetMotionMaster()->MovePoint(0,hatcherway[1][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[1][3][2]); - m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); } - void EnterCombat(Unit *who) {/*DoZoneInCombat();*/} - void UpdateAI(const uint32 diff) { if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) @@ -626,25 +532,20 @@ struct TRINITY_DLL_DECL mob_hatchlingAI : public ScriptedAI m_creature->setDeathState(JUST_DIED); return; } - if (!UpdateVictim()) return; - if (BuffetTimer < diff) { m_creature->CastSpell(m_creature->getVictim(), SPELL_FLAMEBUFFET, false); BuffetTimer = 10000; }else BuffetTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_hatchlingAI(Creature* pCreature) { return new mob_hatchlingAI(pCreature); } - struct TRINITY_DLL_DECL mob_eggAI : public ScriptedAI { mob_eggAI(Creature *c) : ScriptedAI(c){} @@ -653,7 +554,6 @@ struct TRINITY_DLL_DECL mob_eggAI : public ScriptedAI void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_HATCH_EGG) @@ -663,12 +563,10 @@ struct TRINITY_DLL_DECL mob_eggAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_eggAI(Creature* pCreature) { return new mob_eggAI(pCreature); } - void AddSC_boss_janalai() { Script *newscript; @@ -676,22 +574,18 @@ void AddSC_boss_janalai() newscript->Name = "boss_janalai"; newscript->GetAI = &GetAI_boss_janalaiAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_janalai_firebomb"; newscript->GetAI = &GetAI_mob_janalai_firebombAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_janalai_hatcher"; newscript->GetAI = &GetAI_mob_amanishi_hatcherAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_janalai_hatchling"; newscript->GetAI = &GetAI_mob_hatchlingAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_janalai_egg"; newscript->GetAI = &GetAI_mob_eggAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp index c15df162430..4c1566b6c51 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Nalorakk SD%Complete: 100 SDComment: SDCategory: Zul'Aman EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" #include "GridNotifiers.h" - //Trash Waves float NalorakkWay[8][3] = { @@ -37,7 +34,6 @@ float NalorakkWay[8][3] = {-80.072, 1314.398, 40.87}, {-80.072, 1295.775, 48.60} // waypoint 4 }; - #define YELL_NALORAKK_WAVE1 "Get da move on, guards! It be killin' time!" #define SOUND_NALORAKK_WAVE1 12066 #define YELL_NALORAKK_WAVE2 "Guards, go already! Who you more afraid of, dem... or me?" @@ -46,13 +42,11 @@ float NalorakkWay[8][3] = #define SOUND_NALORAKK_WAVE3 12068 #define YELL_NALORAKK_WAVE4 "I be losin' me patience! Go on: make dem wish dey was never born!" #define SOUND_NALORAKK_WAVE4 12069 - //Unimplemented SoundIDs /* #define SOUND_NALORAKK_EVENT1 12078 #define SOUND_NALORAKK_EVENT2 12079 */ - //General defines #define YELL_AGGRO "You be dead soon enough!" #define SOUND_YELL_AGGRO 12070 @@ -64,31 +58,24 @@ float NalorakkWay[8][3] = #define SOUND_YELL_DEATH 12077 #define YELL_BERSERK "You had your chance, now it be too late!" //Never seen this being used, so just guessing from what I hear. #define SOUND_YELL_BERSERK 12074 - #define SPELL_BERSERK 45078 - //Defines for Troll form #define SPELL_BRUTALSWIPE 42384 #define SPELL_MANGLE 42389 #define SPELL_MANGLEEFFECT 44955 #define SPELL_SURGE 42402 #define SPELL_BEARFORM 42377 - #define YELL_SURGE "I bring da pain!" #define SOUND_YELL_SURGE 12071 - #define YELL_SHIFTEDTOTROLL "Make way for Nalorakk!" #define SOUND_YELL_TOTROLL 12073 - //Defines for Bear form #define SPELL_LACERATINGSLASH 42395 #define SPELL_RENDFLESH 42397 #define SPELL_DEAFENINGROAR 42398 - #define YELL_SHIFTEDTOBEAR "You call on da beast, you gonna get more dan you bargain for!" #define SOUND_YELL_TOBEAR 12072 - struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI { boss_nalorakkAI(Creature *c) : ScriptedAI(c) @@ -97,26 +84,20 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI MovePhase = 0; pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 BrutalSwipe_Timer; uint32 Mangle_Timer; uint32 Surge_Timer; - uint32 LaceratingSlash_Timer; uint32 RendFlesh_Timer; uint32 DeafeningRoar_Timer; - uint32 ShapeShift_Timer; uint32 Berserk_Timer; - bool inBearForm; bool MoveEvent; bool inMove; uint32 MovePhase; uint32 waitTimer; - void Reset() { if (MoveEvent) @@ -131,45 +112,35 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI { (*m_creature).GetMotionMaster()->MovePoint(0,NalorakkWay[7][0],NalorakkWay[7][1],NalorakkWay[7][2]); } - if (pInstance) pInstance->SetData(DATA_NALORAKKEVENT, NOT_STARTED); - Surge_Timer = 15000 + rand()%5000; BrutalSwipe_Timer = 7000 + rand()%5000; Mangle_Timer = 10000 + rand()%5000; ShapeShift_Timer = 45000 + rand()%5000; Berserk_Timer = 600000; - inBearForm = false; m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); } - void SendAttacker(Unit* target) { std::list templist; float x, y, z; m_creature->GetPosition(x, y, z); - { CellPair pair(Trinity::ComputeCellPair(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllFriendlyCreaturesInGrid check(m_creature); Trinity::CreatureListSearcher searcher(m_creature, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap())); } - if (!templist.size()) return; - - for(std::list::iterator i = templist.begin(); i != templist.end(); ++i) + for (std::list::iterator i = templist.begin(); i != templist.end(); ++i) { if ((*i) && m_creature->IsWithinDistInMap((*i),25)) { @@ -178,13 +149,11 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI } } } - void AttackStart(Unit* who) { if (!MoveEvent) ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit *who) { if (!MoveEvent) @@ -204,11 +173,9 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI { m_creature->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE1); - (*m_creature).GetMotionMaster()->MovePoint(1,NalorakkWay[1][0],NalorakkWay[1][1],NalorakkWay[1][2]); MovePhase ++; inMove = true; - SendAttacker(who); } break; @@ -217,11 +184,9 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI { m_creature->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE2); - (*m_creature).GetMotionMaster()->MovePoint(3,NalorakkWay[3][0],NalorakkWay[3][1],NalorakkWay[3][2]); MovePhase ++; inMove = true; - SendAttacker(who); } break; @@ -230,11 +195,9 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI { m_creature->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE3); - (*m_creature).GetMotionMaster()->MovePoint(6,NalorakkWay[6][0],NalorakkWay[6][1],NalorakkWay[6][2]); MovePhase ++; inMove = true; - SendAttacker(who); } break; @@ -242,13 +205,10 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI if (m_creature->IsWithinDistInMap(who, 50)) { SendAttacker(who); - m_creature->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE4); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - MoveEvent = false; } break; @@ -257,26 +217,21 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_NALORAKKEVENT, IN_PROGRESS); - m_creature->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_YELL_AGGRO); DoZoneInCombat(); } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_NALORAKKEVENT, DONE); - m_creature->MonsterYell(YELL_DEATH,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature, SOUND_YELL_DEATH); } - void KilledUnit(Unit* victim) { switch(rand()%2) @@ -291,20 +246,16 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI break; } } - void MovementInform(uint32 type, uint32 id) { if (MoveEvent) { if (type != POINT_MOTION_TYPE) return; - if (!inMove) return; - if (MovePhase != id) return; - switch(MovePhase) { case 2: @@ -328,10 +279,8 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI inMove = false; return; } - } } - void UpdateAI(const uint32 diff) { if (waitTimer) @@ -344,10 +293,8 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI waitTimer = 0; }else waitTimer -= diff; } - if (!UpdateVictim()) return; - if (Berserk_Timer < diff) { DoCast(m_creature, SPELL_BERSERK, true); @@ -355,7 +302,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_YELL_BERSERK); Berserk_Timer = 600000; }else Berserk_Timer -= diff; - if (ShapeShift_Timer < diff) { if (inBearForm) @@ -383,7 +329,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI inBearForm = true; } }else ShapeShift_Timer -= diff; - if (!inBearForm) { if (BrutalSwipe_Timer < diff) @@ -391,7 +336,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_BRUTALSWIPE); BrutalSwipe_Timer = 7000 + rand()%5000; }else BrutalSwipe_Timer -= diff; - if (Mangle_Timer < diff) { if (m_creature->getVictim() && !m_creature->getVictim()->HasAura(SPELL_MANGLEEFFECT)) @@ -401,7 +345,6 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI } else Mangle_Timer = 10000 + rand()%5000; }else Mangle_Timer -= diff; - if (Surge_Timer < diff) { m_creature->MonsterYell(YELL_SURGE, LANG_UNIVERSAL, NULL); @@ -419,29 +362,24 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_LACERATINGSLASH); LaceratingSlash_Timer = 18000 + rand()%5000; }else LaceratingSlash_Timer -= diff; - if (RendFlesh_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_RENDFLESH); RendFlesh_Timer = 5000 + rand()%5000; }else RendFlesh_Timer -= diff; - if (DeafeningRoar_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_DEAFENINGROAR); DeafeningRoar_Timer = 15000 + rand()%5000; }else DeafeningRoar_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_nalorakk(Creature* pCreature) { return new boss_nalorakkAI (pCreature); } - void AddSC_boss_nalorakk() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp index a8df5202e64..1ce3feacdb6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp @@ -13,51 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_ZulJin SD%Complete: 85% SDComment: EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" - //Speech #define YELL_TRANSFORM_TO_LYNX "Let me introduce to you my new bruddahs: fang and claw!" #define SOUND_TRANSFORM_TO_LYNX 12094 - #define YELL_TRANSFORM_TO_BEAR "Got me some new tricks...like me bruddah bear!" #define SOUND_TRANSFORM_TO_BEAR 12092 - #define YELL_TRANSFORM_TO_DRAGONHAWK "Ya don' have to look to da sky to see da dragonhawk!" #define SOUND_TRANSFORM_TO_DRAGONHAWK 12095 - #define YELL_TRANSFORM_TO_EAGLE "Dere be no hidin' from da eagle!" #define SOUND_TRANSFORM_TO_EAGLE 12093 - #define YELL_KILL_ONE "Da Amani de chuka!" #define SOUND_KILL_ONE 12098 - #define YELL_KILL_TWO "Lot more gonna fall like you!" #define SOUND_KILL_TWO 12099 - #define YELL_FIRE_BREATH "Fire kill you just as quick!" #define SOUND_FIRE_BRETH 12096 - #define YELL_AGGRO "Nobody badduh dan me!" #define SOUND_AGGRO 12091 - #define YELL_BERSERK "You too slow! Me too strong!" #define SOUND_BERSERK 12097 - #define YELL_DEATH "Mebbe me fall...but da Amani empire...never gonna die..." #define SOUND_DEATH 12100 - //Still not used, need more info #define YELL_INTRO "Everybody always wanna take from us. Now we gonna start takin' back. Anybody who get in our way...gonna drown in their own blood! De Amani empire be back now...seekin' vengeance. And we gonna start...with you!" #define SOUND_INTRO 12090 - //Spells: // ====== Troll Form #define SPELL_WHIRLWIND 17207 @@ -85,37 +71,30 @@ EndScriptData */ #define SPELL_SUMMON_PILLAR 43216 // summon 24187 #define CREATURE_COLUMN_OF_FIRE 24187 #define SPELL_PILLAR_TRIGGER 43218 // trigger 43217 - //cosmetic #define SPELL_SPIRIT_AURA 42466 #define SPELL_SIPHON_SOUL 43501 - //Transforms: #define SPELL_SHAPE_OF_THE_BEAR 42594 // 15% dmg #define SPELL_SHAPE_OF_THE_EAGLE 42606 #define SPELL_SHAPE_OF_THE_LYNX 42607 // haste melee 30% #define SPELL_SHAPE_OF_THE_DRAGONHAWK 42608 - #define SPELL_BERSERK 45078 - #define PHASE_BEAR 0 #define PHASE_EAGLE 1 #define PHASE_LYNX 2 #define PHASE_DRAGONHAWK 3 #define PHASE_TROLL 4 - //coords for going for changing form #define CENTER_X 120.148811 #define CENTER_Y 703.713684 #define CENTER_Z 45.111477 - struct SpiritInfoStruct { uint32 entry; float x, y, z, orient; }; - static SpiritInfoStruct SpiritInfo[] = { {23878, 147.87, 706.51, 45.11, 3.04}, @@ -123,14 +102,12 @@ static SpiritInfoStruct SpiritInfo[] = {23877, 137.23, 725.98, 45.11, 3.71}, {23879, 104.29, 726.43, 45.11, 5.43} }; - struct TransformStruct { uint32 sound; char* text; uint32 spell, unaura; }; - static TransformStruct Transform[] = { {SOUND_TRANSFORM_TO_BEAR, YELL_TRANSFORM_TO_BEAR, SPELL_SHAPE_OF_THE_BEAR, SPELL_WHIRLWIND}, @@ -138,7 +115,6 @@ static TransformStruct Transform[] = {SOUND_TRANSFORM_TO_LYNX, YELL_TRANSFORM_TO_LYNX, SPELL_SHAPE_OF_THE_LYNX, SPELL_SHAPE_OF_THE_EAGLE}, {SOUND_TRANSFORM_TO_DRAGONHAWK, YELL_TRANSFORM_TO_DRAGONHAWK, SPELL_SHAPE_OF_THE_DRAGONHAWK, SPELL_SHAPE_OF_THE_LYNX} }; - struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI { boss_zuljinAI(Creature *c) : ScriptedAI(c), Summons(m_creature) @@ -146,89 +122,65 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI pInstance = c->GetInstanceData(); } ScriptedInstance *pInstance; - uint64 SpiritGUID[4]; uint64 ClawTargetGUID; uint64 TankGUID; - uint32 Phase; uint32 health_20; - uint32 Intro_Timer; uint32 Berserk_Timer; - uint32 Whirlwind_Timer; uint32 Grievous_Throw_Timer; - uint32 Creeping_Paralysis_Timer; uint32 Overpower_Timer; - uint32 Claw_Rage_Timer; uint32 Lynx_Rush_Timer; uint32 Claw_Counter; uint32 Claw_Loop_Timer; - uint32 Flame_Whirl_Timer; uint32 Flame_Breath_Timer; uint32 Pillar_Of_Fire_Timer; - SummonList Summons; - void Reset() { if (pInstance) pInstance->SetData(DATA_ZULJINEVENT, NOT_STARTED); - Phase = 0; - health_20 = m_creature->GetMaxHealth()*0.2; - Intro_Timer = 37000; Berserk_Timer = 600000; - Whirlwind_Timer = 7000; Grievous_Throw_Timer = 8000; - Creeping_Paralysis_Timer = 7000; Overpower_Timer = 0; - Claw_Rage_Timer = 5000; Lynx_Rush_Timer = 14000; Claw_Loop_Timer = 0; Claw_Counter = 0; - Flame_Whirl_Timer = 5000; Flame_Breath_Timer = 6000; Pillar_Of_Fire_Timer = 7000; - ClawTargetGUID = 0; TankGUID = 0; - Summons.DespawnAll(); - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 47174); //m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218172674); //m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_ZULJINEVENT, IN_PROGRESS); - DoZoneInCombat(); - m_creature->MonsterYell(YELL_INTRO,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature, SOUND_INTRO); SpawnAdds(); EnterPhase(0); } - void KilledUnit(Unit* victim) { if (Intro_Timer) return; - switch(rand()%2) { case 0: @@ -241,20 +193,16 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI break; } } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_ZULJINEVENT, DONE); - m_creature->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_DEATH); Summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE); - if (Unit *Temp = Unit::GetUnit(*m_creature, SpiritGUID[3])) Temp->SetUInt32Value(UNIT_FIELD_BYTES_1,UNIT_STAND_STATE_DEAD); } - void AttackStart(Unit *who) { if (Phase == 2) @@ -262,7 +210,6 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI else ScriptedAI::AttackStart(who); } - void DoMeleeAttackIfReady() { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -283,11 +230,10 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI } } } - void SpawnAdds() { Creature *pCreature = NULL; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { pCreature = m_creature->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); if (pCreature) @@ -299,10 +245,9 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI } } } - void DespawnAdds() { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Unit* Temp = NULL; if (SpiritGUID[i]) @@ -316,17 +261,14 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI SpiritGUID[i] = 0; } } - void JustSummoned(Creature *summon) { Summons.Summon(summon); } - void SummonedCreatureDespawn(Creature *summon) { Summons.Despawn(summon); } - void EnterPhase(uint32 NextPhase) { switch(NextPhase) @@ -355,7 +297,7 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI { m_creature->GetMotionMaster()->Clear(); m_creature->CastSpell(m_creature, SPELL_ENERGY_STORM, true); // enemy aura - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature* Vortex = DoSpawnCreature(CREATURE_FEATHER_VORTEX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (Vortex) @@ -383,18 +325,15 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI } Phase = NextPhase; } - void UpdateAI(const uint32 diff) { if (!TankGUID) { if (!UpdateVictim()) return; - if (m_creature->GetHealth() < health_20 * (4 - Phase)) EnterPhase(Phase + 1); } - if (Berserk_Timer < diff) { m_creature->CastSpell(m_creature, SPELL_BERSERK, true); @@ -402,7 +341,6 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_BERSERK); Berserk_Timer = 60000; }else Berserk_Timer -= diff; - switch (Phase) { case 0: @@ -415,13 +353,11 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI Intro_Timer = 0; }else Intro_Timer -= diff; } - if (Whirlwind_Timer < diff) { DoCast(m_creature, SPELL_WHIRLWIND); Whirlwind_Timer = 15000 + rand()%5000; }else Whirlwind_Timer -= diff; - if (Grievous_Throw_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -429,24 +365,20 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI Grievous_Throw_Timer = 10000; }else Grievous_Throw_Timer -= diff; break; - case 1: if (Creeping_Paralysis_Timer < diff) { DoCast(m_creature, SPELL_CREEPING_PARALYSIS); Creeping_Paralysis_Timer = 20000; }else Creeping_Paralysis_Timer -= diff; - if (Overpower_Timer < diff) { // implemented in DoMeleeAttackIfReady() Overpower_Timer = 0; }else Overpower_Timer -= diff; break; - case 2: return; - case 3: if (Claw_Rage_Timer <= diff) { @@ -496,7 +428,6 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI }else Claw_Loop_Timer -= diff; } //if (TankGUID) }else Claw_Rage_Timer -= diff; - if (Lynx_Rush_Timer <= diff) { if (!TankGUID) @@ -542,7 +473,6 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI } } //if (TankGUID) }else Lynx_Rush_Timer -= diff; - break; case 4: if (Flame_Whirl_Timer < diff) @@ -550,14 +480,12 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI DoCast(m_creature, SPELL_FLAME_WHIRL); Flame_Whirl_Timer = 12000; }Flame_Whirl_Timer -= diff; - if (Pillar_Of_Fire_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SUMMON_PILLAR); Pillar_Of_Fire_Timer = 10000; }else Pillar_Of_Fire_Timer -= diff; - if (Flame_Breath_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -566,35 +494,27 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI Flame_Breath_Timer = 10000; }else Flame_Breath_Timer -= diff; break; - default: break; } - if (!TankGUID) DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_zuljin(Creature* pCreature) { return new boss_zuljinAI (pCreature); } - struct TRINITY_DLL_DECL feather_vortexAI : public ScriptedAI { feather_vortexAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} - void EnterCombat(Unit* target) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_ZAP_INFORM) m_creature->CastSpell(caster, SPELL_ZAP_DAMAGE, true); } - void UpdateAI(const uint32 diff) { //if the vortex reach the target, it change his target to another player @@ -602,12 +522,10 @@ struct TRINITY_DLL_DECL feather_vortexAI : public ScriptedAI AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } }; - CreatureAI* GetAI_feather_vortexAI(Creature* pCreature) { return new feather_vortexAI (pCreature); } - void AddSC_boss_zuljin() { Script *newscript; @@ -615,7 +533,6 @@ void AddSC_boss_zuljin() newscript->Name = "boss_zuljin"; newscript->GetAI = &GetAI_boss_zuljin; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_zuljin_vortex"; newscript->GetAI = &GetAI_feather_vortexAI; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/def_zulaman.h b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/def_zulaman.h index 6fb0ef173bd..082616146c6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/def_zulaman.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/def_zulaman.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_ZULAMAN_H #define DEF_ZULAMAN_H - #define DATA_NALORAKKEVENT 1 #define DATA_AKILZONEVENT 2 #define DATA_JANALAIEVENT 3 @@ -14,6 +12,5 @@ #define DATA_CHESTLOOTED 7 #define TYPE_RAND_VENDOR_1 8 #define TYPE_RAND_VENDOR_2 9 - #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/instance_zulaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/instance_zulaman.cpp index 74186442d9e..327bda17592 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/instance_zulaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/instance_zulaman.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: instance_zulaman SD%Complete: 80 SDComment: SDCategory: Zul'Aman EndScriptData */ - #include "precompiled.h" #include "def_zulaman.h" - #define MAX_ENCOUNTER 6 #define RAND_VENDOR 2 - //187021 //Harkor's Satchel //186648 //Tanzar's Trunk //186672 //Ashli's Bag @@ -39,71 +35,56 @@ struct SHostageInfo uint32 npc, pGo; float x, y, z, o; }; - static SHostageInfo HostageInfo[] = { {23790, 186648, -57, 1343, 40.77, 3.2}, // bear {23999, 187021, 400, 1414, 74.36, 3.3}, // eagle {24001, 186672, -35, 1134, 18.71, 1.9}, // dragonhawk {24024, 186667, 413, 1117, 6.32, 3.1} // lynx - }; - struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance { instance_zulaman(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 HarkorsSatchelGUID; uint64 TanzarsTrunkGUID; uint64 AshlisBagGUID; uint64 KrazsPackageGUID; - uint64 HexLordGateGUID; uint64 ZulJinGateGUID; uint64 AkilzonDoorGUID; uint64 ZulJinDoorGUID; uint64 HalazziDoorGUID; - uint32 QuestTimer; uint16 BossKilled; uint16 QuestMinute; uint16 ChestLooted; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 RandVendor[RAND_VENDOR]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - HarkorsSatchelGUID = 0; TanzarsTrunkGUID = 0; AshlisBagGUID = 0; KrazsPackageGUID = 0; - uint64 HexLordGateGUID = 0; uint64 ZulJinGateGUID = 0; uint64 AkilzonDoorGUID = 0; uint64 HalazziDoorGUID = 0; uint64 ZulJinDoorGUID = 0; - QuestTimer = 0; QuestMinute = 21; BossKilled = 0; ChestLooted = 0; - - for(uint8 i = 0; i < RAND_VENDOR; ++i) + for (uint8 i = 0; i < RAND_VENDOR; ++i) RandVendor[i] = NOT_STARTED; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -116,7 +97,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance default: break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -126,26 +106,21 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance case 186305: HexLordGateGUID = pGo->GetGUID(); break; case 186858: AkilzonDoorGUID = pGo->GetGUID(); break; case 186859: ZulJinDoorGUID = pGo->GetGUID(); break; - case 187021: HarkorsSatchelGUID = pGo->GetGUID(); break; case 186648: TanzarsTrunkGUID = pGo->GetGUID(); break; case 186672: AshlisBagGUID = pGo->GetGUID(); break; case 186667: KrazsPackageGUID = pGo->GetGUID(); break; default: break; - } CheckInstanceStatus(); } - void SummonHostage(uint8 num) { if (!QuestMinute) return; - Map::PlayerList const &PlayerList = instance->GetPlayers(); if (PlayerList.isEmpty()) return; - Map::PlayerList::const_iterator i = PlayerList.begin(); if (Player* i_pl = i->getSource()) { @@ -156,16 +131,13 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance } } } - void CheckInstanceStatus() { if (BossKilled >= 4) HandleGameObject(HexLordGateGUID, true); - if (BossKilled >= 5) HandleGameObject(ZulJinGateGUID, true); } - std::string GetSaveData() { std::ostringstream ss; @@ -175,7 +147,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance //error_log("TSCR: Zul'aman saved, %s.", data); return data; } - void Load(const char* load) { if (!load) return; @@ -192,7 +163,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance QuestMinute = data3; }else error_log("TSCR: Zul'aman: corrupted save data."); } - void SetData(uint32 type, uint32 data) { switch(type) @@ -253,7 +223,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance RandVendor[1] = data; break; } - if (data == DONE) { BossKilled++; @@ -266,7 +235,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance SaveToDB(); } } - uint32 GetData(uint32 type) { switch(type) @@ -283,7 +251,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance default: return 0; } } - void Update(uint32 diff) { if (QuestMinute) @@ -303,12 +270,10 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_zulaman(Map* pMap) { return new instance_zulaman(pMap); } - void AddSC_instance_zulaman() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp index e3142e50540..57ab45ac944 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp @@ -13,42 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Zulaman SD%Complete: 90 SDComment: Forest Frog will turn into different NPC's. Workaround to prevent new entry from running this script SDCategory: Zul'Aman EndScriptData */ - /* ContentData npc_forest_frog EndContentData */ - #include "precompiled.h" #include "def_zulaman.h" - /*###### ## npc_forest_frog ######*/ - #define SPELL_REMOVE_AMANI_CURSE 43732 #define SPELL_PUSH_MOJO 43923 #define ENTRY_FOREST_FROG 24396 - struct TRINITY_DLL_DECL npc_forest_frogAI : public ScriptedAI { npc_forest_frogAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - void Reset() { } - void EnterCombat(Unit *who) { } - void DoSpawnRandom() { if (pInstance) @@ -68,19 +58,15 @@ struct TRINITY_DLL_DECL npc_forest_frogAI : public ScriptedAI case 9: cEntry = 24453; break; //Brennan case 10: cEntry = 24455; break; //Hollee } - if (!pInstance->GetData(TYPE_RAND_VENDOR_1)) if (rand()%10 == 1) cEntry = 24408; //Gunter if (!pInstance->GetData(TYPE_RAND_VENDOR_2)) if (rand()%10 == 1) cEntry = 24409; //Kyren - if (cEntry) m_creature->UpdateEntry(cEntry); - if (cEntry == 24408) pInstance->SetData(TYPE_RAND_VENDOR_1,DONE); if (cEntry == 24409) pInstance->SetData(TYPE_RAND_VENDOR_2,DONE); } } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && m_creature->GetEntry() == ENTRY_FOREST_FROG) @@ -95,16 +81,12 @@ CreatureAI* GetAI_npc_forest_frog(Creature* pCreature) { return new npc_forest_frogAI (pCreature); } - /*###### ## npc_zulaman_hostage ######*/ - #define GOSSIP_HOSTAGE1 "I am glad to help you." - static uint32 HostageEntry[] = {23790, 23999, 24024, 24001}; static uint32 ChestEntry[] = {186648, 187021, 186672, 186667}; - struct TRINITY_DLL_DECL npc_zulaman_hostageAI : public ScriptedAI { npc_zulaman_hostageAI(Creature *c) : ScriptedAI(c) {IsLoot = false;} @@ -122,23 +104,19 @@ struct TRINITY_DLL_DECL npc_zulaman_hostageAI : public ScriptedAI if (IsLoot) m_creature->CastSpell(m_creature, 7, false); } }; - bool GossipHello_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) pPlayer->CLOSE_GOSSIP_MENU(); - if (!pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return true; pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); if (pInstance) { @@ -147,7 +125,7 @@ bool GossipSelect_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature, uint float x, y, z; pCreature->GetPosition(x, y, z); uint32 entry = pCreature->GetEntry(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (HostageEntry[i] == entry) { @@ -167,21 +145,17 @@ bool GossipSelect_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature, uint } return true; } - CreatureAI* GetAI_npc_zulaman_hostage(Creature* pCreature) { return new npc_zulaman_hostageAI(pCreature); } - void AddSC_zulaman() { Script *newscript; - newscript = new Script; newscript->Name = "npc_forest_frog"; newscript->GetAI = &GetAI_npc_forest_frog; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_zulaman_hostage"; newscript->GetAI = &GetAI_npc_zulaman_hostage; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp index 5244e5d3538..4d5af424a2d 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp @@ -13,73 +13,57 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Arlokk SD%Complete: 95 SDComment: Wrong cleave and red aura is missing. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - bool GOHello_go_gong_of_bethekk(Player* pPlayer, GameObject* pGo) { if (ScriptedInstance* m_pInstance = pGo->GetInstanceData()) { if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) return true; - m_pInstance->SetData(TYPE_ARLOKK, IN_PROGRESS); } - return false; } - enum eEnums { SAY_AGGRO = -1309011, SAY_FEAST_PANTHER = -1309012, SAY_DEATH = -1309013, - SPELL_SHADOWWORDPAIN = 23952, SPELL_GOUGE = 24698, SPELL_MARK = 24210, SPELL_CLEAVE = 26350, //Perhaps not right. Not a red aura... SPELL_PANTHER_TRANSFORM = 24190, - MODEL_ID_NORMAL = 15218, MODEL_ID_PANTHER = 15215, MODEL_ID_BLANK = 11686, - NPC_ZULIAN_PROWLER = 15101 }; - struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI { boss_arlokkAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 m_uiShadowWordPain_Timer; uint32 m_uiGouge_Timer; uint32 m_uiMark_Timer; uint32 m_uiCleave_Timer; uint32 m_uiVanish_Timer; uint32 m_uiVisible_Timer; - uint32 m_uiSummon_Timer; uint32 m_uiSummonCount; - Unit* m_pMarkedTarget; - bool m_bIsPhaseTwo; bool m_bIsVanished; - void Reset() { m_uiShadowWordPain_Timer = 8000; @@ -88,66 +72,50 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI m_uiCleave_Timer = 4000; m_uiVanish_Timer = 60000; m_uiVisible_Timer = 6000; - m_uiSummon_Timer = 5000; m_uiSummonCount = 0; - m_bIsPhaseTwo = false; m_bIsVanished = false; - m_pMarkedTarget = NULL; - m_creature->SetDisplayId(MODEL_ID_NORMAL); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_ARLOKK, NOT_STARTED); - //we should be summoned, so despawn m_creature->ForcedDespawn(); } - void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); - m_creature->SetDisplayId(MODEL_ID_NORMAL); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (m_pInstance) m_pInstance->SetData(TYPE_ARLOKK, DONE); } - void DoSummonPhanters() { if (m_pMarkedTarget) DoScriptText(SAY_FEAST_PANTHER, m_creature, m_pMarkedTarget); - m_creature->SummonCreature(NPC_ZULIAN_PROWLER, -11532.7998, -1649.6734, 41.4800, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); m_creature->SummonCreature(NPC_ZULIAN_PROWLER, -11532.9970, -1606.4840, 41.2979, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); } - void JustSummoned(Creature* pSummoned) { if (m_pMarkedTarget) pSummoned->AI()->AttackStart(m_pMarkedTarget); - ++m_uiSummonCount; } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - if (!m_bIsPhaseTwo) { if (m_uiShadowWordPain_Timer < uiDiff) @@ -157,16 +125,13 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI } else m_uiShadowWordPain_Timer -= uiDiff; - if (m_uiMark_Timer < uiDiff) { m_pMarkedTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (m_pMarkedTarget) DoCast(m_pMarkedTarget, SPELL_MARK); else error_log("TSCR: boss_arlokk could not accuire m_pMarkedTarget."); - m_uiMark_Timer = 15000; } else @@ -182,20 +147,16 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI } else m_uiCleave_Timer -= uiDiff; - //Gouge_Timer if (m_uiGouge_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_GOUGE); - DoModifyThreatPercent(m_creature->getVictim(),-80); - m_uiGouge_Timer = 17000+rand()%10000; } else m_uiGouge_Timer -= uiDiff; } - if (m_uiSummonCount <= 30) { if (m_uiSummon_Timer < uiDiff) @@ -206,24 +167,19 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI else m_uiSummon_Timer -= uiDiff; } - if (m_uiVanish_Timer < uiDiff) { //Invisble Model m_creature->SetDisplayId(MODEL_ID_BLANK); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->AttackStop(); DoResetThreat(); - m_bIsVanished = true; - m_uiVanish_Timer = 45000; m_uiVisible_Timer = 6000; } else m_uiVanish_Timer -= uiDiff; - if (m_bIsVanished) { if (m_uiVisible_Timer < uiDiff) @@ -231,15 +187,12 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI //The Panther Model m_creature->SetDisplayId(MODEL_ID_PANTHER); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); m_creature->UpdateDamagePhysical(BASE_ATTACK); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) AttackStart(pTarget); - m_bIsPhaseTwo = true; m_bIsVanished = false; } @@ -250,21 +203,17 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_arlokk(Creature* pCreature) { return new boss_arlokkAI (pCreature); } - void AddSC_boss_arlokk() { Script *newscript; - newscript = new Script; newscript->Name = "go_gong_of_bethekk"; newscript->pGOHello = &GOHello_go_gong_of_bethekk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_arlokk"; newscript->GetAI = &GetAI_boss_arlokk; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_gahzranka.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_gahzranka.cpp index 3de88e3af0f..abcc3d71632 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_gahzranka.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_gahzranka.cpp @@ -13,67 +13,55 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gahz'ranka SD%Complete: 85 SDComment: Massive Geyser with knockback not working. Spell buggy. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" - #define SPELL_FROSTBREATH 16099 #define SPELL_MASSIVEGEYSER 22421 //Not working. Cause its a summon... #define SPELL_SLAM 24326 - struct TRINITY_DLL_DECL boss_gahzrankaAI : public ScriptedAI { boss_gahzrankaAI(Creature *c) : ScriptedAI(c) {} uint32 Frostbreath_Timer; uint32 MassiveGeyser_Timer; uint32 Slam_Timer; - void Reset() { Frostbreath_Timer = 8000; MassiveGeyser_Timer = 25000; Slam_Timer = 17000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Frostbreath_Timer if (Frostbreath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBREATH); Frostbreath_Timer = 7000 + rand()%4000; }else Frostbreath_Timer -= diff; - //MassiveGeyser_Timer if (MassiveGeyser_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MASSIVEGEYSER); DoResetThreat(); - MassiveGeyser_Timer = 22000 + rand()%10000; }else MassiveGeyser_Timer -= diff; - //Slam_Timer if (Slam_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SLAM); Slam_Timer = 12000 + rand()%8000; }else Slam_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -81,7 +69,6 @@ CreatureAI* GetAI_boss_gahzranka(Creature* pCreature) { return new boss_gahzrankaAI (pCreature); } - void AddSC_boss_gahzranka() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_grilek.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_grilek.cpp index 6475f7ab4e5..957105f2b75 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_grilek.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_grilek.cpp @@ -13,67 +13,52 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Grilek SD%Complete: 100 SDComment: SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SPELL_AVARTAR 24646 //The Enrage Spell #define SPELL_GROUNDTREMOR 6524 - struct TRINITY_DLL_DECL boss_grilekAI : public ScriptedAI { boss_grilekAI(Creature *c) : ScriptedAI(c) {} - uint32 Avartar_Timer; uint32 GroundTremor_Timer; - void Reset() { Avartar_Timer = 15000 + rand()%10000; GroundTremor_Timer = 8000 + rand()%8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Avartar_Timer if (Avartar_Timer < diff) { - DoCast(m_creature, SPELL_AVARTAR); Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,1); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-50); if (target) AttackStart(target); - Avartar_Timer = 25000 + rand()%10000; }else Avartar_Timer -= diff; - //GroundTremor_Timer if (GroundTremor_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_GROUNDTREMOR); GroundTremor_Timer = 12000 + rand()%4000; }else GroundTremor_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -81,7 +66,6 @@ CreatureAI* GetAI_boss_grilek(Creature* pCreature) { return new boss_grilekAI (pCreature); } - void AddSC_boss_grilek() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hakkar.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hakkar.cpp index be73374aafc..644a8018d89 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hakkar.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hakkar.cpp @@ -13,64 +13,52 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hakkar SD%Complete: 95 SDComment: Blood siphon spell buggy cause of Core Issue. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309020 #define SAY_FLEEING -1309021 #define SAY_MINION_DESTROY -1309022 //where does it belong? #define SAY_PROTECT_ALTAR -1309023 //where does it belong? - #define SPELL_BLOODSIPHON 24322 #define SPELL_CORRUPTEDBLOOD 24328 #define SPELL_CAUSEINSANITY 24327 //Not working disabled. #define SPELL_WILLOFHAKKAR 24178 #define SPELL_ENRAGE 24318 - // The Aspects of all High Priests #define SPELL_ASPECT_OF_JEKLIK 24687 #define SPELL_ASPECT_OF_VENOXIS 24688 #define SPELL_ASPECT_OF_MARLI 24686 #define SPELL_ASPECT_OF_THEKAL 24689 #define SPELL_ASPECT_OF_ARLOKK 24690 - struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI { boss_hakkarAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - ScriptedInstance *m_pInstance; - uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; uint32 CauseInsanity_Timer; uint32 WillOfHakkar_Timer; uint32 Enrage_Timer; - uint32 CheckJeklik_Timer; uint32 CheckVenoxis_Timer; uint32 CheckMarli_Timer; uint32 CheckThekal_Timer; uint32 CheckArlokk_Timer; - uint32 AspectOfJeklik_Timer; uint32 AspectOfVenoxis_Timer; uint32 AspectOfMarli_Timer; uint32 AspectOfThekal_Timer; uint32 AspectOfArlokk_Timer; - bool Enraged; - void Reset() { BloodSiphon_Timer = 90000; @@ -78,70 +66,57 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI CauseInsanity_Timer = 17000; WillOfHakkar_Timer = 17000; Enrage_Timer = 600000; - CheckJeklik_Timer = 1000; CheckVenoxis_Timer = 2000; CheckMarli_Timer = 3000; CheckThekal_Timer = 4000; CheckArlokk_Timer = 5000; - AspectOfJeklik_Timer = 4000; AspectOfVenoxis_Timer = 7000; AspectOfMarli_Timer = 12000; AspectOfThekal_Timer = 8000; AspectOfArlokk_Timer = 18000; - Enraged = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //BloodSiphon_Timer if (BloodSiphon_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLOODSIPHON); BloodSiphon_Timer = 90000; }else BloodSiphon_Timer -= diff; - //CorruptedBlood_Timer if (CorruptedBlood_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CORRUPTEDBLOOD); CorruptedBlood_Timer = 30000 + rand()%15000; }else CorruptedBlood_Timer -= diff; - //CauseInsanity_Timer /*if (CauseInsanity_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_CAUSEINSANITY); - CauseInsanity_Timer = 35000 + rand()%8000; }else CauseInsanity_Timer -= diff;*/ - //WillOfHakkar_Timer if (WillOfHakkar_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_WILLOFHAKKAR); - WillOfHakkar_Timer = 25000 + rand()%10000; }else WillOfHakkar_Timer -= diff; - if (!Enraged && Enrage_Timer < diff) { DoCast(m_creature, SPELL_ENRAGE); Enraged = true; }else Enrage_Timer -= diff; - //Checking if Jeklik is dead. If not we cast her Aspect if (CheckJeklik_Timer < diff) { @@ -158,7 +133,6 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI } CheckJeklik_Timer = 1000; }else CheckJeklik_Timer -= diff; - //Checking if Venoxis is dead. If not we cast his Aspect if (CheckVenoxis_Timer < diff) { @@ -175,7 +149,6 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI } CheckVenoxis_Timer = 1000; }else CheckVenoxis_Timer -= diff; - //Checking if Marli is dead. If not we cast her Aspect if (CheckMarli_Timer < diff) { @@ -188,12 +161,10 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_ASPECT_OF_MARLI); AspectOfMarli_Timer = 10000; }else AspectOfMarli_Timer -= diff; - } } CheckMarli_Timer = 1000; }else CheckMarli_Timer -= diff; - //Checking if Thekal is dead. If not we cast his Aspect if (CheckThekal_Timer < diff) { @@ -210,7 +181,6 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI } CheckThekal_Timer = 1000; }else CheckThekal_Timer -= diff; - //Checking if Arlokk is dead. If yes we cast her Aspect if (CheckArlokk_Timer < diff) { @@ -222,23 +192,19 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI { DoCast(m_creature,SPELL_ASPECT_OF_ARLOKK); DoResetThreat(); - AspectOfArlokk_Timer = 10000 + rand()%5000; }else AspectOfArlokk_Timer -= diff; } } CheckArlokk_Timer = 1000; }else CheckArlokk_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_hakkar(Creature* pCreature) { return new boss_hakkarAI (pCreature); } - void AddSC_boss_hakkar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hazzarah.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hazzarah.cpp index 0b11bd59d6c..f07106df754 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hazzarah.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_hazzarah.cpp @@ -13,79 +13,65 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hazzarah SD%Complete: 100 SDComment: SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SPELL_MANABURN 26046 #define SPELL_SLEEP 24664 - struct TRINITY_DLL_DECL boss_hazzarahAI : public ScriptedAI { boss_hazzarahAI(Creature *c) : ScriptedAI(c) {} - uint32 ManaBurn_Timer; uint32 Sleep_Timer; uint32 Illusions_Timer; Creature* Illusion; - void Reset() { ManaBurn_Timer = 4000 + rand()%6000; Sleep_Timer = 10000 + rand()%8000; Illusions_Timer = 10000 + rand()%8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //ManaBurn_Timer if (ManaBurn_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MANABURN); ManaBurn_Timer = 8000 + rand()%8000; }else ManaBurn_Timer -= diff; - //Sleep_Timer if (Sleep_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SLEEP); Sleep_Timer = 12000 + rand()%8000; }else Sleep_Timer -= diff; - //Illusions_Timer if (Illusions_Timer < diff) { //We will summon 3 illusions that will spawn on a random gamer and attack this gamer //We will just use one model for the beginning Unit* target = NULL; - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (!target) return; - Illusion = m_creature->SummonCreature(15163,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); if (Illusion) (Illusion->AI())->AttackStart(target); } - Illusions_Timer = 15000 + rand()%10000; }else Illusions_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -93,7 +79,6 @@ CreatureAI* GetAI_boss_hazzarah(Creature* pCreature) { return new boss_hazzarahAI (pCreature); } - void AddSC_boss_hazzarah() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jeklik.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jeklik.cpp index 27d9fc56443..39ed24ede8b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jeklik.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jeklik.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Jeklik SD%Complete: 85 SDComment: Problem in finding the right flying batriders for spawning and making them fly. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309002 #define SAY_RAIN_FIRE -1309003 #define SAY_DEATH -1309004 - #define SPELL_CHARGE 22911 #define SPELL_SONICBURST 23918 #define SPELL_SCREECH 6605 @@ -36,20 +32,15 @@ EndScriptData */ #define SPELL_CHAIN_MIND_FLAY 26044 //Right ID unknown. So disabled #define SPELL_GREATERHEAL 23954 #define SPELL_BAT_FORM 23966 - // Batriders Spell - #define SPELL_BOMB 40332 //Wrong ID but Magmadars bomb is not working... - struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI { boss_jeklikAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - ScriptedInstance *m_pInstance; - uint32 Charge_Timer; uint32 SonicBurst_Timer; uint32 Screech_Timer; @@ -59,9 +50,7 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI uint32 ChainMindFlay_Timer; uint32 GreaterHeal_Timer; uint32 SpawnFlyingBats_Timer; - bool PhaseTwo; - void Reset() { Charge_Timer = 20000; @@ -73,29 +62,23 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI ChainMindFlay_Timer = 26000; GreaterHeal_Timer = 50000; SpawnFlyingBats_Timer = 10000; - PhaseTwo = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); DoCast(m_creature,SPELL_BAT_FORM); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_JEKLIK, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->getVictim() && m_creature->isAlive()) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 50)) @@ -107,44 +90,34 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI DoCast(target,SPELL_CHARGE); AttackStart(target); } - Charge_Timer = 15000 + rand()%15000; }else Charge_Timer -= diff; - if (SonicBurst_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SONICBURST); SonicBurst_Timer = 8000 + rand()%5000; }else SonicBurst_Timer -= diff; - if (Screech_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SCREECH); Screech_Timer = 18000 + rand()%8000; }else Screech_Timer -= diff; - if (SpawnBats_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* Bat = NULL; Bat = m_creature->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); - Bat = m_creature->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); - Bat = m_creature->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); - Bat = m_creature->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); - Bat = m_creature->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); - SpawnBats_Timer = 60000; }else SpawnBats_Timer -= diff; } @@ -160,37 +133,31 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI ShadowWordPain_Timer = 12000 + rand()%6000; } }ShadowWordPain_Timer -=diff; - if (MindFlay_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MIND_FLAY); MindFlay_Timer = 16000; }MindFlay_Timer -=diff; - if (ChainMindFlay_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature->getVictim(), SPELL_CHAIN_MIND_FLAY); ChainMindFlay_Timer = 15000 + rand()%15000; }ChainMindFlay_Timer -=diff; - if (GreaterHeal_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature,SPELL_GREATERHEAL); GreaterHeal_Timer = 25000 + rand()%10000; }GreaterHeal_Timer -=diff; - if (SpawnFlyingBats_Timer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!target) return; - Creature* FlyingBat = m_creature->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (FlyingBat) FlyingBat->AI()->AttackStart(target); - SpawnFlyingBats_Timer = 10000 + rand()%5000; }else SpawnFlyingBats_Timer -=diff; } @@ -201,12 +168,10 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI PhaseTwo = true; } } - DoMeleeAttackIfReady(); } } }; - //Flying Bat struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI { @@ -214,27 +179,20 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI { m_pInstance = c->GetInstanceData(); } - ScriptedInstance *m_pInstance; - uint32 Bomb_Timer; uint32 Check_Timer; - void Reset() { Bomb_Timer = 2000; Check_Timer = 1000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) {} - void UpdateAI (const uint32 diff) { if (!UpdateVictim()) return; - //Bomb_Timer if (Bomb_Timer < diff) { @@ -244,7 +202,6 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI Bomb_Timer = 5000; } }else Bomb_Timer -= diff; - //Check_Timer if (Check_Timer < diff) { @@ -257,24 +214,19 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI return; } } - Check_Timer = 1000; }else Check_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_jeklik(Creature* pCreature) { return new boss_jeklikAI (pCreature); } - CreatureAI* GetAI_mob_batrider(Creature* pCreature) { return new mob_batriderAI (pCreature); } - void AddSC_boss_jeklik() { Script *newscript; @@ -282,7 +234,6 @@ void AddSC_boss_jeklik() newscript->Name = "boss_jeklik"; newscript->GetAI = &GetAI_boss_jeklik; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_batrider"; newscript->GetAI = &GetAI_mob_batrider; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jindo.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jindo.cpp index 3fa3090abdb..09700f4193e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jindo.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_jindo.cpp @@ -13,42 +13,33 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Jin'do the Hexxer SD%Complete: 85 SDComment: Mind Control not working because of core bug. Shades visible for all. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309014 - #define SPELL_BRAINWASHTOTEM 24262 #define SPELL_POWERFULLHEALINGWARD 24309 //We will not use this spell. We will summon a totem by script cause the spell totems will not cast. #define SPELL_HEX 24053 #define SPELL_DELUSIONSOFJINDO 24306 #define SPELL_SHADEOFJINDO 24308 //We will not use this spell. We will summon a shade by script. - //Healing Ward Spell #define SPELL_HEAL 38588 //Totems are not working right. Right heal spell ID is 24311 but this spell is not casting... - //Shade of Jindo Spell #define SPELL_SHADOWSHOCK 19460 #define SPELL_INVISIBLE 24699 - struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI { boss_jindoAI(Creature *c) : ScriptedAI(c) {} - uint32 BrainWashTotem_Timer; uint32 HealingWard_Timer; uint32 Hex_Timer; uint32 Delusions_Timer; uint32 Teleport_Timer; - void Reset() { BrainWashTotem_Timer = 20000; @@ -57,24 +48,20 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI Delusions_Timer = 10000; Teleport_Timer = 5000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //BrainWashTotem_Timer if (BrainWashTotem_Timer < diff) { DoCast(m_creature, SPELL_BRAINWASHTOTEM); BrainWashTotem_Timer = 18000 + rand()%8000; }else BrainWashTotem_Timer -= diff; - //HealingWard_Timer if (HealingWard_Timer < diff) { @@ -82,33 +69,26 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI m_creature->SummonCreature(14987, m_creature->GetPositionX()+3, m_creature->GetPositionY()-2, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,30000); HealingWard_Timer = 14000 + rand()%6000; }else HealingWard_Timer -= diff; - //Hex_Timer if (Hex_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_HEX); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-80); - Hex_Timer = 12000 + rand()%8000; }else Hex_Timer -= diff; - //Casting the delusion curse with a shade. So shade will attack the same target with the curse. if (Delusions_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { DoCast(target, SPELL_DELUSIONSOFJINDO); - Creature *Shade = m_creature->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Shade) Shade->AI()->AttackStart(target); } - Delusions_Timer = 4000 + rand()%8000; }else Delusions_Timer -= diff; - //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer if (Teleport_Timer < diff) { @@ -117,10 +97,8 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI if (target && target->GetTypeId() == TYPEID_PLAYER) { DoTeleportPlayer(target, -11583.7783,-1249.4278,77.5471,4.745); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(target,-100); - Creature *Skeletons; Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) @@ -150,14 +128,11 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI if (Skeletons) Skeletons->AI()->AttackStart(target); } - Teleport_Timer = 15000 + rand()%8000; }else Teleport_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Healing Ward struct TRINITY_DLL_DECL mob_healing_wardAI : public ScriptedAI { @@ -165,20 +140,15 @@ struct TRINITY_DLL_DECL mob_healing_wardAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 Heal_Timer; - ScriptedInstance *pInstance; - void Reset() { Heal_Timer = 2000; } - void EnterCombat(Unit *who) { } - void UpdateAI (const uint32 diff) { //Heal_Timer @@ -192,71 +162,56 @@ struct TRINITY_DLL_DECL mob_healing_wardAI : public ScriptedAI } Heal_Timer = 3000; }else Heal_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Shade of Jindo struct TRINITY_DLL_DECL mob_shade_of_jindoAI : public ScriptedAI { mob_shade_of_jindoAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowShock_Timer; - void Reset() { ShadowShock_Timer = 1000; m_creature->CastSpell(m_creature, SPELL_INVISIBLE,true); } - void EnterCombat(Unit *who) { } - void UpdateAI (const uint32 diff) { - //ShadowShock_Timer if (ShadowShock_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWSHOCK); ShadowShock_Timer = 2000; }else ShadowShock_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_jindo(Creature* pCreature) { return new boss_jindoAI (pCreature); } - CreatureAI* GetAI_mob_healing_ward(Creature* pCreature) { return new mob_healing_wardAI (pCreature); } - CreatureAI* GetAI_mob_shade_of_jindo(Creature* pCreature) { return new mob_shade_of_jindoAI (pCreature); } - void AddSC_boss_jindo() { Script *newscript; - newscript = new Script; newscript->Name = "boss_jindo"; newscript->GetAI = &GetAI_boss_jindo; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_healing_ward"; newscript->GetAI = &GetAI_mob_healing_ward; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shade_of_jindo"; newscript->GetAI = &GetAI_mob_shade_of_jindo; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp index 0408cdc1e95..c15a9a12904 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp @@ -13,23 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Mandokir SD%Complete: 90 SDComment: Ohgan function needs improvements. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309015 #define SAY_DING_KILL -1309016 #define SAY_GRATS_JINDO -1309017 #define SAY_WATCH -1309018 #define SAY_WATCH_WHISPER -1309019 //is this text for real? easter egg? - #define SPELL_CHARGE 24315 #define SPELL_CLEAVE 20691 #define SPELL_FEAR 29321 @@ -38,17 +34,14 @@ EndScriptData */ #define SPELL_ENRAGE 23537 #define SPELL_WATCH 24314 #define SPELL_LEVEL_UP 24312 - //Ohgans Spells #define SPELL_SUNDERARMOR 24317 - struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI { boss_mandokirAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - uint32 KillCount; uint32 Watch_Timer; uint32 TargetInRange; @@ -60,16 +53,12 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI float targetX; float targetY; float targetZ; - ScriptedInstance *m_pInstance; - bool endWatch; bool someWatched; bool RaptorDead; bool CombatStart; - uint64 WatchTarget; - void Reset() { KillCount = 0; @@ -79,32 +68,25 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI Fear_Timer = 1000; MortalStrike_Timer = 1000; Check_Timer = 1000; - targetX = 0.0; targetY = 0.0; targetZ = 0.0; TargetInRange = 0; - WatchTarget = 0; - someWatched = false; endWatch = false; RaptorDead = false; CombatStart = false; - DoCast(m_creature, 23243); } - void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) { ++KillCount; - if (KillCount == 3) { DoScriptText(SAY_DING_KILL, m_creature); - if (m_pInstance) { uint64 JindoGUID = m_pInstance->GetData64(DATA_JINDO); @@ -122,35 +104,29 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->getVictim() && m_creature->isAlive()) { if (!CombatStart) { //At combat Start Mandokir is mounted so we must unmount it first m_creature->Unmount(); - //And summon his raptor m_creature->SummonCreature(14988, m_creature->getVictim()->GetPositionX(), m_creature->getVictim()->GetPositionY(), m_creature->getVictim()->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 35000); CombatStart = true; } - if (Watch_Timer < diff) //Every 20 Sec Mandokir will check this { if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him { Unit* pUnit = Unit::GetUnit(*m_creature, WatchTarget); - if (pUnit && ( targetX != pUnit->GetPositionX() || targetY != pUnit->GetPositionY() || @@ -172,7 +148,6 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI someWatched = false; Watch_Timer = 20000; }else Watch_Timer -= diff; - if ((Watch_Timer < 8000) && !someWatched) //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target { if (Unit* p = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -184,7 +159,6 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI endWatch = true; } } - if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position { Unit* pUnit = Unit::GetUnit(*m_creature, WatchTarget); @@ -196,7 +170,6 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI } endWatch = false; } - if (!someWatched) { //Cleave @@ -205,33 +178,27 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //Whirlwind if (Whirlwind_Timer < diff) { DoCast(m_creature,SPELL_WHIRLWIND); Whirlwind_Timer = 18000; }else Whirlwind_Timer -= diff; - //If more then 3 targets in melee range mandokir will cast fear if (Fear_Timer < diff) { TargetInRange = 0; - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); - for(; i != m_creature->getThreatManager().getThreatList().end(); ++i) + for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid()); if (pUnit && m_creature->IsWithinMeleeRange(pUnit)) TargetInRange++; } - if (TargetInRange > 3) DoCast(m_creature->getVictim(),SPELL_FEAR); - Fear_Timer = 4000; }else Fear_Timer -=diff; - //Mortal Strike if target below 50% hp if (m_creature->getVictim() && m_creature->getVictim()->GetHealth() < m_creature->getVictim()->GetMaxHealth()*0.5) { @@ -256,15 +223,12 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI } } } - Check_Timer = 1000; }else Check_Timer -= diff; - DoMeleeAttackIfReady(); } } }; - //Ohgan struct TRINITY_DLL_DECL mob_ohganAI : public ScriptedAI { @@ -272,59 +236,47 @@ struct TRINITY_DLL_DECL mob_ohganAI : public ScriptedAI { m_pInstance = c->GetInstanceData(); } - uint32 SunderArmor_Timer; ScriptedInstance *m_pInstance; - void Reset() { SunderArmor_Timer = 5000; } - void EnterCombat(Unit *who) {} - void JustDied(Unit* Killer) { if (m_pInstance) m_pInstance->SetData(TYPE_OHGAN, DONE); } - void UpdateAI (const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //SunderArmor_Timer if (SunderArmor_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SUNDERARMOR); SunderArmor_Timer = 10000 + rand()%5000; }else SunderArmor_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_mandokir(Creature* pCreature) { return new boss_mandokirAI (pCreature); } - CreatureAI* GetAI_mob_ohgan(Creature* pCreature) { return new mob_ohganAI (pCreature); } - void AddSC_boss_mandokir() { Script *newscript; - newscript = new Script; newscript->Name = "boss_mandokir"; newscript->GetAI = &GetAI_boss_mandokir; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ohgan"; newscript->GetAI = &GetAI_mob_ohgan; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp index ef29657f559..6c39a2b1f10 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp @@ -13,40 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Marli SD%Complete: 80 SDComment: Charging healers and casters not working. Perhaps wrong Spell Timers. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309005 #define SAY_TRANSFORM -1309006 #define SAY_SPIDER_SPAWN -1309007 #define SAY_DEATH -1309008 - #define SPELL_CHARGE 22911 #define SPELL_ASPECT_OF_MARLI 24686 // A stun spell #define SPELL_ENVOLWINGWEB 24110 #define SPELL_POISONVOLLEY 24099 #define SPELL_SPIDER_FORM 24084 - //The Spider Spells #define SPELL_LEVELUP 24312 //Not right Spell. - struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI { boss_marliAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - ScriptedInstance *m_pInstance; - uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; uint32 SpawnSpider_Timer; @@ -54,11 +46,9 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI uint32 Aspect_Timer; uint32 Transform_Timer; uint32 TransformBack_Timer; - Creature *Spider; bool Spawned; bool PhaseTwo; - void Reset() { SpawnStartSpiders_Timer = 1000; @@ -68,28 +58,23 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI Aspect_Timer = 12000; Transform_Timer = 45000; TransformBack_Timer = 25000; - Spawned = false; PhaseTwo = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); if (m_pInstance) m_pInstance->SetData(TYPE_MARLI, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->getVictim() && m_creature->isAlive()) { if (PoisonVolley_Timer < diff) @@ -97,21 +82,17 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_POISONVOLLEY); PoisonVolley_Timer = 10000 + rand()%10000; }else PoisonVolley_Timer -= diff; - if (!PhaseTwo && Aspect_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ASPECT_OF_MARLI); Aspect_Timer = 13000 + rand()%5000; }else Aspect_Timer -= diff; - if (!Spawned && SpawnStartSpiders_Timer < diff) { DoScriptText(SAY_SPIDER_SPAWN, m_creature); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if (!target) return; - Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); @@ -124,22 +105,18 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); - Spawned = true; }else SpawnStartSpiders_Timer -= diff; - if (SpawnSpider_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if (!target) return; - Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); SpawnSpider_Timer = 12000 + rand()%5000; }else SpawnSpider_Timer -= diff; - if (!PhaseTwo && Transform_Timer < diff) { DoScriptText(SAY_TRANSFORM, m_creature); @@ -149,14 +126,11 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); m_creature->UpdateDamagePhysical(BASE_ATTACK); DoCast(m_creature->getVictim(),SPELL_ENVOLWINGWEB); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-100); - PhaseTwo = true; Transform_Timer = 35000 + rand()%25000; }else Transform_Timer -= diff; - if (PhaseTwo) { if (Charge_Timer < diff) @@ -178,10 +152,8 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI //m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); AttackStart(target); } - Charge_Timer = 8000; }else Charge_Timer -= diff; - if (TransformBack_Timer < diff) { m_creature->SetDisplayId(15220); @@ -189,70 +161,55 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); m_creature->UpdateDamagePhysical(BASE_ATTACK); - PhaseTwo = false; TransformBack_Timer = 25000 + rand()%15000; }else TransformBack_Timer -= diff; - } - DoMeleeAttackIfReady(); } } }; - //Spawn of Marli struct TRINITY_DLL_DECL mob_spawn_of_marliAI : public ScriptedAI { mob_spawn_of_marliAI(Creature *c) : ScriptedAI(c) {} - uint32 LevelUp_Timer; - void Reset() { LevelUp_Timer = 3000; } - void EnterCombat(Unit *who) { } - void UpdateAI (const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //LevelUp_Timer if (LevelUp_Timer < diff) { DoCast(m_creature,SPELL_LEVELUP); LevelUp_Timer = 3000; }else LevelUp_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_marli(Creature* pCreature) { return new boss_marliAI (pCreature); } - CreatureAI* GetAI_mob_spawn_of_marli(Creature* pCreature) { return new mob_spawn_of_marliAI (pCreature); } - void AddSC_boss_marli() { Script *newscript; - newscript = new Script; newscript->Name = "boss_marli"; newscript->GetAI = &GetAI_boss_marli; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_spawn_of_marli"; newscript->GetAI = &GetAI_mob_spawn_of_marli; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_renataki.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_renataki.cpp index bc6be61e253..49feb913ed8 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_renataki.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_renataki.cpp @@ -13,35 +13,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Renataki SD%Complete: 100 SDComment: SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SPELL_AMBUSH 24337 #define SPELL_THOUSANDBLADES 24649 - #define EQUIP_ID_MAIN_HAND 0 //was item display id 31818, but this id does not exist - struct TRINITY_DLL_DECL boss_renatakiAI : public ScriptedAI { boss_renatakiAI(Creature *c) : ScriptedAI(c) {} - uint32 Invisible_Timer; uint32 Ambush_Timer; uint32 Visible_Timer; uint32 Aggro_Timer; uint32 ThousandBlades_Timer; - bool Invisible; bool Ambushed; - void Reset() { Invisible_Timer = 8000 + rand()%10000; @@ -49,34 +41,26 @@ struct TRINITY_DLL_DECL boss_renatakiAI : public ScriptedAI Visible_Timer = 4000; Aggro_Timer = 15000 + rand()%10000; ThousandBlades_Timer = 4000 + rand()%4000; - Invisible = false; Ambushed = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Invisible_Timer if (Invisible_Timer < diff) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); m_creature->SetDisplayId(11686); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Invisible = true; - Invisible_Timer = 15000 + rand()%15000; }else Invisible_Timer -= diff; - if (Invisible) { if (Ambush_Timer < diff) @@ -88,51 +72,40 @@ struct TRINITY_DLL_DECL boss_renatakiAI : public ScriptedAI DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); DoCast(target,SPELL_AMBUSH); } - Ambushed = true; Ambush_Timer = 3000; }else Ambush_Timer -= diff; } - if (Ambushed) { if (Visible_Timer < diff) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); - m_creature->SetDisplayId(15268); SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Invisible = false; - Visible_Timer = 4000; }else Visible_Timer -= diff; } - //Resetting some aggro so he attacks other gamers if (!Invisible) if (Aggro_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,1); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-50); - if (target) AttackStart(target); - Aggro_Timer = 7000 + rand()%13000; }else Aggro_Timer -= diff; - if (!Invisible) if (ThousandBlades_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_THOUSANDBLADES); ThousandBlades_Timer = 7000 + rand()%5000; }else ThousandBlades_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -140,7 +113,6 @@ CreatureAI* GetAI_boss_renataki(Creature* pCreature) { return new boss_renatakiAI (pCreature); } - void AddSC_boss_renataki() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp index a0693a0cdc4..3127d1e0ec0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Thekal SD%Complete: 95 SDComment: Almost finished. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_AGGRO -1309009 #define SAY_DEATH -1309010 - #define SPELL_MORTALCLEAVE 22859 #define SPELL_SILENCE 23207 #define SPELL_FRENZY 23342 @@ -36,27 +32,23 @@ EndScriptData */ #define SPELL_SUMMONTIGERS 24183 #define SPELL_TIGER_FORM 24169 #define SPELL_RESURRECT 24173 //We will not use this spell. - //Zealot Lor'Khan Spells #define SPELL_SHIELD 25020 #define SPELL_BLOODLUST 24185 #define SPELL_GREATERHEAL 24208 #define SPELL_DISARM 22691 - //Zealot Lor'Khan Spells #define SPELL_SWEEPINGSTRIKES 18765 #define SPELL_SINISTERSTRIKE 15667 #define SPELL_GOUGE 24698 #define SPELL_KICK 15614 #define SPELL_BLIND 21060 - struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI { boss_thekalAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - uint32 MortalCleave_Timer; uint32 Silence_Timer; uint32 Frenzy_Timer; @@ -66,12 +58,10 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI uint32 SummonTigers_Timer; uint32 Check_Timer; uint32 Resurrect_Timer; - ScriptedInstance *m_pInstance; bool Enraged; bool PhaseTwo; bool WasDead; - void Reset() { MortalCleave_Timer = 4000; @@ -83,35 +73,29 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI SummonTigers_Timer = 25000; Check_Timer = 10000; Resurrect_Timer = 10000; - Enraged = false; PhaseTwo = false; WasDead = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); if (m_pInstance) m_pInstance->SetData(TYPE_THEKAL, DONE); } - void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_THEKAL, NOT_STARTED); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Check_Timer for the death of LorKhan and Zath. if (!WasDead && Check_Timer < diff) { @@ -126,11 +110,9 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI pLorKhan->setFaction(14); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); - m_pInstance->SetData(TYPE_LORKHAN, DONE); } } - if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) { //Resurrect Zath @@ -141,39 +123,31 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI pZath->setFaction(14); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); - m_pInstance->SetData(TYPE_ZATH, DONE); } } } - Check_Timer = 5000; }else Check_Timer -= diff; - if (!PhaseTwo && MortalCleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALCLEAVE); MortalCleave_Timer = 15000 + rand()%5000; }else MortalCleave_Timer -= diff; - if (!PhaseTwo && Silence_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); Silence_Timer = 20000 + rand()%5000; }else Silence_Timer -= diff; - if (!PhaseTwo && !WasDead && m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.05) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->AttackStop(); - if (m_pInstance) m_pInstance->SetData(TYPE_THEKAL, SPECIAL); - WasDead=true; } - //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. if (!PhaseTwo && WasDead) { @@ -192,12 +166,10 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI PhaseTwo = true; }else Resurrect_Timer -= diff; } - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() == 100) && WasDead) { WasDead = false; } - if (PhaseTwo) { if (Charge_Timer < diff) @@ -208,40 +180,32 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI DoResetThreat(); AttackStart(target); } - Charge_Timer = 15000 + rand()%7000; }else Charge_Timer -= diff; - if (Frenzy_Timer < diff) { DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 30000; }else Frenzy_Timer -= diff; - if (ForcePunch_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); ForcePunch_Timer = 16000 + rand()%5000; }else ForcePunch_Timer -= diff; - if (SummonTigers_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUMMONTIGERS); SummonTigers_Timer = 10000 + rand()%4000; }else SummonTigers_Timer -= diff; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11) && !Enraged) { DoCast(m_creature, SPELL_ENRAGE); Enraged = true; } } - DoMeleeAttackIfReady(); - } }; - //Zealot Lor'Khan struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI { @@ -249,17 +213,13 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI { m_pInstance = c->GetInstanceData(); } - uint32 Shield_Timer; uint32 BloodLust_Timer; uint32 GreaterHeal_Timer; uint32 Disarm_Timer; uint32 Check_Timer; - bool FakeDeath; - ScriptedInstance *m_pInstance; - void Reset() { Shield_Timer = 1000; @@ -267,39 +227,31 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI GreaterHeal_Timer = 32000; Disarm_Timer = 6000; Check_Timer = 10000; - FakeDeath = false; - if (m_pInstance) m_pInstance->SetData(TYPE_LORKHAN, NOT_STARTED); - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) { } - void UpdateAI (const uint32 diff) { if (!UpdateVictim()) return; - //Shield_Timer if (Shield_Timer < diff) { DoCast(m_creature,SPELL_SHIELD); Shield_Timer = 61000; }else Shield_Timer -= diff; - //BloodLust_Timer if (BloodLust_Timer < diff) { DoCast(m_creature,SPELL_BLOODLUST); BloodLust_Timer = 20000+rand()%8000; }else BloodLust_Timer -= diff; - //Casting Greaterheal to Thekal or Zath if they are in meele range. if (GreaterHeal_Timer < diff) { @@ -307,10 +259,8 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI { Unit *pThekal = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_THEKAL)); Unit *pZath = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ZATH)); - if (!pThekal || !pZath) return; - switch(rand()%2) { case 0: @@ -323,17 +273,14 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI break; } } - GreaterHeal_Timer = 15000+rand()%5000; }else GreaterHeal_Timer -= diff; - //Disarm_Timer if (Disarm_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DISARM); Disarm_Timer = 15000+rand()%10000; }else Disarm_Timer -= diff; - //Check_Timer for the death of LorKhan and Zath. if (!FakeDeath && Check_Timer < diff) { @@ -350,7 +297,6 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); } } - if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) { //Resurrect Zath @@ -363,27 +309,21 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI } } } - Check_Timer = 5000; }else Check_Timer -= diff; - if (m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.05) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->setFaction(35); m_creature->AttackStop(); - if (m_pInstance) m_pInstance->SetData(TYPE_LORKHAN, SPECIAL); - FakeDeath = true; } - DoMeleeAttackIfReady(); } }; - //Zealot Zath struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI { @@ -391,18 +331,14 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI { m_pInstance = c->GetInstanceData(); } - uint32 SweepingStrikes_Timer; uint32 SinisterStrike_Timer; uint32 Gouge_Timer; uint32 Kick_Timer; uint32 Blind_Timer; uint32 Check_Timer; - bool FakeDeath; - ScriptedInstance *m_pInstance; - void Reset() { SweepingStrikes_Timer = 13000; @@ -411,64 +347,51 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI Kick_Timer = 18000; Blind_Timer = 5000; Check_Timer = 10000; - FakeDeath = false; - if (m_pInstance) m_pInstance->SetData(TYPE_ZATH, NOT_STARTED); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) { } - void UpdateAI (const uint32 diff) { if (!UpdateVictim()) return; - //SweepingStrikes_Timer if (SweepingStrikes_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SWEEPINGSTRIKES); SweepingStrikes_Timer = 22000+rand()%4000; }else SweepingStrikes_Timer -= diff; - //SinisterStrike_Timer if (SinisterStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE); SinisterStrike_Timer = 8000+rand()%8000; }else SinisterStrike_Timer -= diff; - //Gouge_Timer if (Gouge_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_GOUGE); - if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-100); - Gouge_Timer = 17000+rand()%10000; }else Gouge_Timer -= diff; - //Kick_Timer if (Kick_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KICK); Kick_Timer = 15000+rand()%10000; }else Kick_Timer -= diff; - //Blind_Timer if (Blind_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLIND); Blind_Timer = 10000+rand()%10000; }else Blind_Timer -= diff; - //Check_Timer for the death of LorKhan and Zath. if (!FakeDeath && Check_Timer < diff) { @@ -485,7 +408,6 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); } } - if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) { //Resurrect Thekal @@ -498,56 +420,44 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI } } } - Check_Timer = 5000; }else Check_Timer -= diff; - if (m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.05) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->setFaction(35); m_creature->AttackStop(); - if (m_pInstance) m_pInstance->SetData(TYPE_ZATH, SPECIAL); - FakeDeath = true; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_thekal(Creature* pCreature) { return new boss_thekalAI (pCreature); } - CreatureAI* GetAI_mob_zealot_lorkhan(Creature* pCreature) { return new mob_zealot_lorkhanAI (pCreature); } - CreatureAI* GetAI_mob_zealot_zath(Creature* pCreature) { return new mob_zealot_zathAI (pCreature); } - void AddSC_boss_thekal() { Script *newscript; - newscript = new Script; newscript->Name = "boss_thekal"; newscript->GetAI = &GetAI_boss_thekal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_zealot_lorkhan"; newscript->GetAI = &GetAI_mob_zealot_lorkhan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_zealot_zath"; newscript->GetAI = &GetAI_mob_zealot_zath; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp index 2ff7597f0fa..65dc89a3362 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp @@ -13,20 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Venoxis SD%Complete: 100 SDComment: SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SAY_TRANSFORM -1309000 #define SAY_DEATH -1309001 - #define SPELL_HOLY_FIRE 23860 #define SPELL_HOLY_WRATH 28883 //Not sure if this or 23979 #define SPELL_VENOMSPIT 23862 @@ -36,16 +32,13 @@ EndScriptData */ #define SPELL_RENEW 23895 #define SPELL_BERSERK 23537 #define SPELL_DISPELL 23859 - struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI { boss_venoxisAI(Creature *c) : ScriptedAI(c) { m_pInstance = c->GetInstanceData(); } - ScriptedInstance *m_pInstance; - uint32 HolyFire_Timer; uint32 HolyWrath_Timer; uint32 VenomSpit_Timer; @@ -54,10 +47,8 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI uint32 HolyNova_Timer; uint32 Dispell_Timer; uint32 TargetInRange; - bool PhaseTwo; bool InBerserk; - void Reset() { HolyFire_Timer = 10000; @@ -68,27 +59,22 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI HolyNova_Timer = 5000; Dispell_Timer = 35000; TargetInRange = 0; - PhaseTwo = false; InBerserk= false; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); if (m_pInstance) m_pInstance->SetData(TYPE_VENOXIS, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 50)) { if (Dispell_Timer < diff) @@ -96,29 +82,25 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI DoCast(m_creature, SPELL_DISPELL); Dispell_Timer = 15000 + rand()%15000; }else Dispell_Timer -= diff; - if (Renew_Timer < diff) { DoCast(m_creature, SPELL_RENEW); Renew_Timer = 20000 + rand()%10000; }else Renew_Timer -= diff; - if (HolyWrath_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_HOLY_WRATH); HolyWrath_Timer = 15000 + rand()%10000; }else HolyWrath_Timer -= diff; - if (HolyNova_Timer < diff) { TargetInRange = 0; - for(uint8 i=0; i<10; ++i) + for (uint8 i=0; i<10; ++i) { if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,i)) if (m_creature->IsWithinMeleeRange(target)) TargetInRange++; } - if (TargetInRange > 1) { DoCast(m_creature->getVictim(),SPELL_HOLY_NOVA); @@ -128,14 +110,11 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI { HolyNova_Timer = 2000; } - }else HolyNova_Timer -= diff; - if (HolyFire_Timer < diff && TargetInRange < 3) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, SPELL_HOLY_FIRE); - HolyFire_Timer = 8000; }else HolyFire_Timer -= diff; } @@ -154,21 +133,17 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI DoResetThreat(); PhaseTwo = true; } - if (PhaseTwo && PoisonCloud_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_POISON_CLOUD); PoisonCloud_Timer = 15000; }PoisonCloud_Timer -=diff; - if (PhaseTwo && VenomSpit_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, SPELL_VENOMSPIT); - VenomSpit_Timer = 15000 + rand()%5000; }else VenomSpit_Timer -= diff; - if (PhaseTwo && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11)) { if (!InBerserk) @@ -182,12 +157,10 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_venoxis(Creature* pCreature) { return new boss_venoxisAI (pCreature); } - void AddSC_boss_venoxis() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_wushoolay.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_wushoolay.cpp index 4ba494a2b0a..bc4af57b510 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_wushoolay.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/boss_wushoolay.cpp @@ -13,59 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Wushoolay SD%Complete: 100 SDComment: SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - #define SPELL_LIGHTNINGCLOUD 25033 #define SPELL_LIGHTNINGWAVE 24819 - struct TRINITY_DLL_DECL boss_wushoolayAI : public ScriptedAI { boss_wushoolayAI(Creature *c) : ScriptedAI(c) {} - uint32 LightningCloud_Timer; uint32 LightningWave_Timer; - void Reset() { LightningCloud_Timer = 5000 + rand()%5000; LightningWave_Timer = 8000 + rand()%8000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //LightningCloud_Timer if (LightningCloud_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_LIGHTNINGCLOUD); LightningCloud_Timer = 15000 + rand()%5000; }else LightningCloud_Timer -= diff; - //LightningWave_Timer if (LightningWave_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) DoCast(target,SPELL_LIGHTNINGWAVE); - LightningWave_Timer = 12000 + rand()%4000; }else LightningWave_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -73,7 +61,6 @@ CreatureAI* GetAI_boss_wushoolay(Creature* pCreature) { return new boss_wushoolayAI (pCreature); } - void AddSC_boss_wushoolay() { Script *newscript; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/def_zulgurub.h b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/def_zulgurub.h index bf55a54c1d5..773076effa8 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/def_zulgurub.h +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/def_zulgurub.h @@ -1,14 +1,11 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_ZULGURUB_H #define DEF_ZULGURUB_H - enum eTypes { MAX_ENCOUNTERS = 8, - TYPE_ARLOKK = 1, TYPE_JEKLIK = 2, TYPE_VENOXIS = 3, @@ -17,12 +14,10 @@ enum eTypes TYPE_THEKAL = 6, TYPE_ZATH = 7, TYPE_LORKHAN = 8, - DATA_JINDO = 10, DATA_LORKHAN = 11, DATA_THEKAL = 12, DATA_ZATH = 13 }; - #endif diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/instance_zulgurub.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/instance_zulgurub.cpp index 03b3e64c5e6..311083b270a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/instance_zulgurub.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulgurub/instance_zulgurub.cpp @@ -13,46 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_ZulGurub SD%Complete: 80 SDComment: Missing reset function after killing a boss for Ohgan, Thekal. SDCategory: Zul'Gurub EndScriptData */ - #include "precompiled.h" #include "def_zulgurub.h" - struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance { instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. uint32 m_auiEncounter[MAX_ENCOUNTERS]; - //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. uint64 m_uiLorKhanGUID; uint64 m_uiZathGUID; uint64 m_uiThekalGUID; uint64 m_uiJindoGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiLorKhanGUID = 0; m_uiZathGUID = 0; m_uiThekalGUID = 0; m_uiJindoGUID = 0; } - bool IsEncounterInProgress() const { //not active in Zul'Gurub return false; } - void OnCreatureCreate(Creature* pCreature) { switch(pCreature->GetEntry()) @@ -63,7 +54,6 @@ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance case 11380: m_uiJindoGUID = pCreature->GetGUID(); break; } } - void SetData(uint32 uiType, uint32 uiData) { switch(uiType) @@ -71,37 +61,29 @@ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance case TYPE_ARLOKK: m_auiEncounter[0] = uiData; break; - case TYPE_JEKLIK: m_auiEncounter[1] = uiData; break; - case TYPE_VENOXIS: m_auiEncounter[2] = uiData; break; - case TYPE_MARLI: m_auiEncounter[3] = uiData; break; - case TYPE_THEKAL: m_auiEncounter[4] = uiData; break; - case TYPE_LORKHAN: m_auiEncounter[5] = uiData; break; - case TYPE_ZATH: m_auiEncounter[6] = uiData; break; - case TYPE_OHGAN: m_auiEncounter[7] = uiData; break; } } - uint32 GetData(uint32 uiType) { switch(uiType) @@ -125,7 +107,6 @@ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 uiData) { switch(uiData) @@ -142,12 +123,10 @@ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_zulgurub(Map* pMap) { return new instance_zulgurub(pMap); } - void AddSC_instance_zulgurub() { Script *newscript; diff --git a/src/bindings/scripts/scripts/examples/example_creature.cpp b/src/bindings/scripts/scripts/examples/example_creature.cpp index c932f3387f9..bd82225f599 100644 --- a/src/bindings/scripts/scripts/examples/example_creature.cpp +++ b/src/bindings/scripts/scripts/examples/example_creature.cpp @@ -13,28 +13,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Example_Creature SD%Complete: 100 SDComment: Short custom scripting example SDCategory: Script Examples EndScriptData */ - #include "precompiled.h" - // **** This script is designed as an example for others to build on **** // **** Please modify whatever you'd like to as this script is only for developement **** - // **** Script Info **** // This script is written in a way that it can be used for both friendly and hostile monsters // Its primary purpose is to show just how much you can really do with scripts // I recommend trying it out on both an agressive NPC and on friendly npc - // **** Quick Info **** // Functions with Handled Function marked above them are functions that are called automatically by the core // Functions that are marked Custom Function are functions I've created to simplify code - enum eEnums { //List of text id's. The text is stored in database, also in a localized version @@ -50,7 +44,6 @@ enum eEnums SAY_PHASE = -1999907, SAY_DANCE = -1999908, SAY_SALUTE = -1999909, - //List of spells. Not required to define them in this way, but will make it easier to maintain in case spellId change SPELL_BUFF = 25661, SPELL_ONE = 12555, @@ -59,23 +52,18 @@ enum eEnums SPELL_THREE = 26027, SPELL_ENRAGE = 23537, SPELL_BESERK = 32309, - FACTION_WORGEN = 24 }; - //List of gossip item texts. Items will appear in the gossip window. #define GOSSIP_ITEM "I'm looking for a fight" - struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI { //*** HANDLED FUNCTION *** //This is the constructor, called only once when the Creature is first created example_creatureAI(Creature *c) : ScriptedAI(c) {Reset();} - //*** CUSTOM VARIABLES **** //These variables are for use only by this individual script. //Nothing else will ever call them but us. - uint32 m_uiSay_Timer; //Timer for random chat uint32 m_uiRebuff_Timer; //Timer for rebuffing uint32 m_uiSpell_1_Timer; //Timer for spell 1 when in combat @@ -84,7 +72,6 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI uint32 m_uiBeserk_Timer; //Timer until we go into Beserk (enraged) mode uint32 m_uiPhase; //The current battle phase we are in uint32 m_uiPhase_Timer; //Timer until phase transition - //*** HANDLED FUNCTION *** //This is called whenever the core decides we need to evade void Reset() @@ -96,7 +83,6 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI m_uiSpell_3_Timer = 19000; //19 seconds m_uiBeserk_Timer = 120000; //2 minutes } - //*** HANDLED FUNCTION *** //Attack Start is called whenever someone hits us. void EnterCombat(Unit* pWho) @@ -104,12 +90,10 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI //Say some stuff DoScriptText(SAY_AGGRO, m_creature, pWho); } - //Our Recive emote function void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) { m_creature->HandleEmoteCommand(uiTextEmote); - switch(uiTextEmote) { case TEXTEMOTE_DANCE: @@ -120,7 +104,6 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI break; } } - //*** HANDLED FUNCTION *** //Update AI is called Every single map update (roughly once every 100ms if a player is within the grid) void UpdateAI(const uint32 uiDiff) @@ -133,12 +116,10 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI { //Random switch between 5 outcomes DoScriptText(RAND(SAY_RANDOM_0,SAY_RANDOM_1,SAY_RANDOM_2,SAY_RANDOM_3,SAY_RANDOM_4), m_creature); - m_uiSay_Timer = 45000; //Say something agian in 45 seconds } else m_uiSay_Timer -= uiDiff; - //Rebuff timer if (m_uiRebuff_Timer < uiDiff) { @@ -148,11 +129,9 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI else m_uiRebuff_Timer -= uiDiff; } - //Return since we have no target if (!UpdateVictim()) return; - //Spell 1 timer if (m_uiSpell_1_Timer < uiDiff) { @@ -161,12 +140,10 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_ONE_ALT); else if (m_creature->IsWithinDist(m_creature->getVictim(), 25.0f)) DoCast(m_creature->getVictim(), SPELL_ONE); - m_uiSpell_1_Timer = 5000; } else m_uiSpell_1_Timer -= uiDiff; - //Spell 2 timer if (m_uiSpell_2_Timer < uiDiff) { @@ -176,7 +153,6 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI } else m_uiSpell_2_Timer -= uiDiff; - //Beserk timer if (m_uiPhase > 1) { @@ -185,18 +161,15 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI { //Cast spell one on our current target. DoCast(m_creature->getVictim(), SPELL_THREE); - m_uiSpell_3_Timer = 19000; } else m_uiSpell_3_Timer -= uiDiff; - if (m_uiBeserk_Timer < uiDiff) { //Say our line then cast uber death spell DoScriptText(SAY_BESERK, m_creature, m_creature->getVictim()); DoCast(m_creature->getVictim(), SPELL_BESERK); - //Cast our beserk spell agian in 12 seconds if we didn't kill everyone m_uiBeserk_Timer = 12000; } @@ -215,18 +188,15 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI else m_uiPhase_Timer -= uiDiff; } - DoMeleeAttackIfReady(); } }; - //This is the GetAI method used by all scripts that involve AI //It is called every time a new Creature using this script is created CreatureAI* GetAI_example_creature(Creature* pCreature) { return new example_creatureAI (pCreature); } - //This function is called when the player clicks an option on the gossip menu bool GossipSelect_example_creature(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { @@ -237,25 +207,20 @@ bool GossipSelect_example_creature(Player* pPlayer, Creature* pCreature, uint32 pCreature->setFaction(FACTION_WORGEN); pCreature->AI()->AttackStart(pPlayer); } - return true; } - //This function is called when the player opens the gossip menu bool GossipHello_example_creature(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; } - //This is the actual function called only once durring InitScripts() //It must define all handled functions that are to be run in this script void AddSC_example_creature() { Script* newscript; - newscript = new Script; newscript->Name = "example_creature"; newscript->GetAI = &GetAI_example_creature; diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index 027268a9325..973d870a9da 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Example_Escort SD%Complete: 100 SDComment: Script used for testing escortAI SDCategory: Script Examples EndScriptData */ - #include "precompiled.h" #include "escort_ai.h" - enum eEnums { NPC_FELBOAR = 21878, - SPELL_DEATH_COIL = 33130, SPELL_ELIXIR_OF_FORTITUDE = 3593, SPELL_BLUE_FIREWORK = 11540, - SAY_AGGRO1 = -1999910, SAY_AGGRO2 = -1999911, SAY_WP_1 = -1999912, @@ -45,24 +40,19 @@ enum eEnums SAY_RAND_1 = -1999920, SAY_RAND_2 = -1999921 }; - #define GOSSIP_ITEM_1 "Click to Test Escort(Attack, Run)" #define GOSSIP_ITEM_2 "Click to Test Escort(NoAttack, Walk)" #define GOSSIP_ITEM_3 "Click to Test Escort(NoAttack, Run)" - struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { // CreatureAI functions example_escortAI(Creature* pCreature) : npc_escortAI(pCreature) { } - uint32 m_uiDeathCoilTimer; uint32 m_uiChatTimer; - void JustSummoned(Creature* pSummoned) { pSummoned->AI()->AttackStart(m_creature); } - // Pure Virtual Functions (Have to be implemented) void WaypointReached(uint32 uiWP) { @@ -86,7 +76,6 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI break; } } - void EnterCombat(Unit* pWho) { if (HasEscortState(STATE_ESCORT_ESCORTING)) @@ -97,13 +86,11 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI else DoScriptText(SAY_AGGRO2, m_creature); } - void Reset() { m_uiDeathCoilTimer = 4000; m_uiChatTimer = 4000; } - void JustDied(Unit* pKiller) { if (HasEscortState(STATE_ESCORT_ESCORTING)) @@ -122,12 +109,10 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI else DoScriptText(SAY_DEATH_3, m_creature); } - void UpdateAI(const uint32 uiDiff) { //Must update npc_escortAI npc_escortAI::UpdateAI(uiDiff); - //Combat check if (m_creature->getVictim()) { @@ -157,7 +142,6 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI DoScriptText(SAY_RAND_2, m_creature); m_creature->CastSpell(m_creature, SPELL_ELIXIR_OF_FORTITUDE, false); } - m_uiChatTimer = 12000; } else @@ -166,57 +150,45 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI } } }; - CreatureAI* GetAI_example_escort(Creature* pCreature) { return new example_escortAI(pCreature); } - bool GossipHello_example_escort(Player* pPlayer, Creature* pCreature) { pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); pCreature->prepareGossipMenu(pPlayer, 0); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pCreature->sendPreparedGossip(pPlayer); - return true; } - bool GossipSelect_example_escort(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { npc_escortAI* pEscortAI = CAST_AI(example_escortAI, pCreature->AI()); - switch(uiAction) { case GOSSIP_ACTION_INFO_DEF+1: pPlayer->CLOSE_GOSSIP_MENU(); - if (pEscortAI) pEscortAI->Start(true, true, pPlayer->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: pPlayer->CLOSE_GOSSIP_MENU(); - if (pEscortAI) pEscortAI->Start(false, false, pPlayer->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: pPlayer->CLOSE_GOSSIP_MENU(); - if (pEscortAI) pEscortAI->Start(false, true, pPlayer->GetGUID()); break; default: return false; // nothing defined -> trinity core handling } - return true; // no default handling -> prevent trinity core handling } - void AddSC_example_escort() { Script *newscript; diff --git a/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp b/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp index 9a51d4d4c9a..80f8ff3325a 100644 --- a/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp +++ b/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp @@ -13,41 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Example_Gossip_Codebox SD%Complete: 100 SDComment: Show a codebox in gossip option SDCategory: Script Examples EndScriptData */ - #include "precompiled.h" #include - enum eEnums { SPELL_POLYMORPH = 12826, SPELL_MARK_OF_THE_WILD = 26990, - SAY_NOT_INTERESTED = -1999922, SAY_WRONG = -1999923, SAY_CORRECT = -1999924 }; - #define GOSSIP_ITEM_1 "A quiz: what's your name?" #define GOSSIP_ITEM_2 "I'm not interested" - //This function is called when the player opens the gossip menubool bool GossipHello_example_gossip_codebox(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); - return true; } - //This function is called when the player clicks an option on the gossip menubool bool GossipSelect_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { @@ -56,10 +47,8 @@ bool GossipSelect_example_gossip_codebox(Player* pPlayer, Creature* pCreature, u DoScriptText(SAY_NOT_INTERESTED, pCreature); pPlayer->CLOSE_GOSSIP_MENU(); } - return true; } - bool GossipSelectWithCode_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) { if (uiSender == GOSSIP_SENDER_MAIN) @@ -78,18 +67,14 @@ bool GossipSelectWithCode_example_gossip_codebox(Player* pPlayer, Creature* pCre pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD, true); } pPlayer->CLOSE_GOSSIP_MENU(); - return true; } } - return false; } - void AddSC_example_gossip_codebox() { Script* newscript; - newscript = new Script; newscript->Name = "example_gossip_codebox"; newscript->pGossipHello = &GossipHello_example_gossip_codebox; diff --git a/src/bindings/scripts/scripts/examples/example_misc.cpp b/src/bindings/scripts/scripts/examples/example_misc.cpp index 667c30ad1b6..a68a4a59729 100644 --- a/src/bindings/scripts/scripts/examples/example_misc.cpp +++ b/src/bindings/scripts/scripts/examples/example_misc.cpp @@ -13,54 +13,44 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Example_Misc SD%Complete: 100 SDComment: Item, Areatrigger and other small code examples SDCategory: Script Examples EndScriptData */ - #include "precompiled.h" - enum eSay { SAY_HI = -1999925 }; - bool AT_example_areatrigger(Player* pPlayer, AreaTriggerEntry *pAt) { DoScriptText(SAY_HI, pPlayer); return true; } - extern void LoadDatabase(); bool ItemUse_example_item(Player* pPlayer, Item* pItem, SpellCastTargets const& scTargets) { LoadDatabase(); return true; } - bool GOHello_example_go_teleporter(Player* pPlayer, GameObject* pGo) { pPlayer->TeleportTo(0, 1807.07f, 336.105f, 70.3975f, 0.0f); return false; } - void AddSC_example_misc() { Script* newscript; - newscript = new Script; newscript->Name = "example_areatrigger"; newscript->pAreaTrigger = &AT_example_areatrigger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "example_item"; newscript->pItemUse = &ItemUse_example_item; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "example_go_teleporter"; newscript->pGOHello = &GOHello_example_go_teleporter; diff --git a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp index 7bb193b98be..1f71cc3a05a 100644 --- a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp @@ -13,57 +13,44 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Ashenvale SD%Complete: 70 SDComment: Quest support: 6544, 6482 SDCategory: Ashenvale Forest EndScriptData */ - /* ContentData npc_torek npc_ruul_snowhoof EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*#### # npc_torek ####*/ - #define SAY_READY -1000106 #define SAY_MOVE -1000107 #define SAY_PREPARE -1000108 #define SAY_WIN -1000109 #define SAY_END -1000110 - #define SPELL_REND 11977 #define SPELL_THUNDERCLAP 8078 - #define QUEST_TOREK_ASSULT 6544 - #define ENTRY_SPLINTERTREE_RAIDER 12859 #define ENTRY_DURIEL 12860 #define ENTRY_SILVERWING_SENTINEL 12896 #define ENTRY_SILVERWING_WARRIOR 12897 - struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI { npc_torekAI(Creature *c) : npc_escortAI(c) {} - uint32 Rend_Timer; uint32 Thunderclap_Timer; bool Completed; - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { case 1: @@ -89,36 +76,29 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI break; } } - void Reset() { Rend_Timer = 5000; Thunderclap_Timer = 8000; Completed = false; } - void EnterCombat(Unit* who) { } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) return; - if (Rend_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_REND); Rend_Timer = 20000; }else Rend_Timer -= diff; - if (Thunderclap_Timer < diff) { DoCast(m_creature,SPELL_THUNDERCLAP); @@ -126,7 +106,6 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI }else Thunderclap_Timer -= diff; } }; - bool QuestAccept_npc_torek(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_TOREK_ASSULT) @@ -134,37 +113,28 @@ bool QuestAccept_npc_torek(Player* pPlayer, Creature* pCreature, Quest const* qu //TODO: find companions, make them follow Torek, at any time (possibly done by mangos/database in future?) DoScriptText(SAY_READY, pCreature, pPlayer); pCreature->setFaction(113); - if (npc_escortAI* pEscortAI = CAST_AI(npc_torekAI, pCreature->AI())) pEscortAI->Start(true, true, pPlayer->GetGUID()); } - return true; } - CreatureAI* GetAI_npc_torek(Creature* pCreature) { return new npc_torekAI(pCreature); } - /*#### # npc_ruul_snowhoof ####*/ - #define QUEST_FREEDOM_TO_RUUL 6482 #define GO_CAGE 178147 - struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI { npc_ruul_snowhoofAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: { @@ -183,62 +153,50 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI m_creature->SummonCreature(3921, 3506.265625, -490.531006, 186.740128, 4.239277, TEMPSUMMON_DEAD_DESPAWN, 60000); m_creature->SummonCreature(3926, 3503.682373, -489.393799, 186.629684, 4.349232, TEMPSUMMON_DEAD_DESPAWN, 60000); break; - case 21:{ if (pPlayer) pPlayer->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, m_creature); - break; } } } - void EnterCombat(Unit* who) {} - void Reset() { GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20); if (Cage) Cage->SetGoState(GO_STATE_READY); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); } }; - bool QuestAccept_npc_ruul_snowhoof(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL) { pCreature->setFaction(113); - if (npc_escortAI* pEscortAI = CAST_AI(npc_ruul_snowhoofAI, (pCreature->AI()))) pEscortAI->Start(true, false, pPlayer->GetGUID()); } return true; } - CreatureAI* GetAI_npc_ruul_snowhoofAI(Creature* pCreature) { return new npc_ruul_snowhoofAI(pCreature); } - void AddSC_ashenvale() { Script *newscript; - newscript = new Script; newscript->Name = "npc_torek"; newscript->GetAI = &GetAI_npc_torek; newscript->pQuestAccept = &QuestAccept_npc_torek; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ruul_snowhoof"; newscript->GetAI = &GetAI_npc_ruul_snowhoofAI; diff --git a/src/bindings/scripts/scripts/kalimdor/azshara.cpp b/src/bindings/scripts/scripts/kalimdor/azshara.cpp index d0d7fad255c..c9d03c7a2a4 100644 --- a/src/bindings/scripts/scripts/kalimdor/azshara.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azshara.cpp @@ -13,44 +13,35 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Azshara SD%Complete: 90 SDComment: Quest support: 2744, 3141, 9364, 10994 SDCategory: Azshara EndScriptData */ - /* ContentData mobs_spitelashes npc_loramus_thalipedes mob_rizzle_sprysprocket mob_depth_charge EndContentData */ - #include "precompiled.h" #include "World.h" #include "WorldPacket.h" - /*###### ## mobs_spitelashes ######*/ - struct TRINITY_DLL_DECL mobs_spitelashesAI : public ScriptedAI { mobs_spitelashesAI(Creature *c) : ScriptedAI(c) {} - uint32 morphtimer; bool spellhit; - void Reset() { morphtimer = 0; spellhit = false; } - void EnterCombat(Unit *who) { } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { if (!spellhit && @@ -62,7 +53,6 @@ struct TRINITY_DLL_DECL mobs_spitelashesAI : public ScriptedAI DoCast(m_creature,29124); //become a sheep } } - void UpdateAI(const uint32 diff) { // we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons @@ -83,7 +73,6 @@ struct TRINITY_DLL_DECL mobs_spitelashesAI : public ScriptedAI } if (!UpdateVictim()) return; - //TODO: add abilities for the different creatures DoMeleeAttackIfReady(); } @@ -92,11 +81,9 @@ CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) { return new mobs_spitelashesAI (pCreature); } - /*###### ## npc_loramus_thalipedes ######*/ - #define GOSSIP_HELLO_LT1 "Can you help me?" #define GOSSIP_HELLO_LT2 "Tell me your story" #define GOSSIP_SELECT_LT1 "Please continue" @@ -104,23 +91,17 @@ CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) #define GOSSIP_SELECT_LT3 "Indeed" #define GOSSIP_SELECT_LT4 "I will do this with or your help, Loramus" #define GOSSIP_SELECT_LT5 "Yes" - bool GossipHello_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -129,7 +110,6 @@ bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, u pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->AreaExploredOrEventHappens(2744); break; - case GOSSIP_ACTION_INFO_DEF+2: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); pPlayer->SEND_GOSSIP_MENU(1813, pCreature->GetGUID()); @@ -157,11 +137,9 @@ bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, u } return true; } - /*#### # mob_rizzle_sprysprocket ####*/ - #define MOB_DEPTH_CHARGE 23025 #define SPELL_RIZZLE_BLACKJACK 39865 #define SPELL_RIZZLE_ESCAPE 39871 @@ -169,16 +147,12 @@ bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, u #define SPELL_DEPTH_CHARGE_TRAP 38576 #define SPELL_PERIODIC_DEPTH_CHARGE 39912 #define SPELL_GIVE_SOUTHFURY_MOONSTONE 39886 - #define SAY_RIZZLE_START -1000245 #define SAY_RIZZLE_GRENADE -1000246 #define SAY_RIZZLE_FINAL -1000247 - #define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go." - //next message must be send to player when Rizzle jump into river, not implemented #define MSG_ESCAPE_NOTICE "Rizzle Sprysprocket takes the Southfury moonstone and escapes into the river. Follow her!" - float WPs[58][4] = { //pos_x pos_y pos_z orien @@ -241,25 +215,20 @@ float WPs[58][4] = {1927.09, -3679.56, 33.9118, 3.42}, {1873.57, -3695.32, 33.9118, 3.44} }; - struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI { mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {} - uint32 spellEscape_Timer; uint32 Teleport_Timer; uint32 Check_Timer; uint32 Grenade_Timer; uint32 Must_Die_Timer; uint32 CurrWP; - uint64 PlayerGUID; - bool Must_Die; bool Escape; bool ContinueWP; bool Reached; - void Reset() { spellEscape_Timer = 1300; @@ -268,15 +237,12 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Grenade_Timer = 30000; Must_Die_Timer = 3000; CurrWP = 0; - PlayerGUID = 0; - Must_Die = false; Escape = false; ContinueWP = false; Reached = false; } - void UpdateAI(const uint32 diff) { if (Must_Die) @@ -285,18 +251,15 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI m_creature->ForcedDespawn(); return; } else Must_Die_Timer -= diff; - if (!Escape) { if (!PlayerGUID) return; - if (spellEscape_Timer < diff) { DoCast(m_creature, SPELL_RIZZLE_ESCAPE, false); spellEscape_Timer = 10000; } else spellEscape_Timer -= diff; - if (Teleport_Timer < diff) { //temp solution - unit can't be teleported by core using spelleffect 5, only players @@ -316,16 +279,13 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); Escape = true; } else Teleport_Timer -= diff; - return; } - if (ContinueWP) { m_creature->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); ContinueWP = false; } - if (Grenade_Timer < diff) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); @@ -336,7 +296,6 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI } Grenade_Timer = 30000; } else Grenade_Timer -= diff; - if (Check_Timer < diff) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); @@ -345,7 +304,6 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI m_creature->ForcedDespawn(); return; } - if (m_creature->IsWithinDist(pPlayer, 10) && m_creature->GetPositionX() > pPlayer->GetPositionX() && !Reached) { DoScriptText(SAY_RIZZLE_FINAL, m_creature); @@ -355,12 +313,9 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI m_creature->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); Reached = true; } - Check_Timer = 1000; } else Check_Timer -= diff; - } - void SendText(const char *text, Player* pPlayer) { WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size @@ -368,12 +323,10 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI if (pPlayer) pPlayer->GetSession()->SendPacket(&data); } - void AttackStart(Unit *who) { if (!who || PlayerGUID) return; - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); @@ -382,26 +335,20 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI return; } } - void EnterCombat(Unit* who) {} - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == 57) { m_creature->ForcedDespawn(); return; } - ++CurrWP; ContinueWP = true; } - }; - bool GossipHello_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) @@ -410,7 +357,6 @@ bool GossipHello_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10811, pCreature->GetGUID()); return true; } - bool GossipSelect_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && pPlayer->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) @@ -422,23 +368,18 @@ bool GossipSelect_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature, } return true; } - CreatureAI* GetAI_mob_rizzle_sprysprocket(Creature* pCreature) { return new mob_rizzle_sprysprocketAI (pCreature); } - /*#### # mob_depth_charge ####*/ - struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI { mob_depth_chargeAI(Creature *c) : ScriptedAI(c) {} - bool we_must_die; uint32 must_die_timer; - void Reset() { m_creature->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); @@ -446,7 +387,6 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI we_must_die = false; must_die_timer = 1000; } - void UpdateAI(const uint32 diff) { if (we_must_die) @@ -456,12 +396,10 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI } else must_die_timer -= diff; return; } - void MoveInLineOfSight(Unit *who) { if (!who) return; - if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 5)) { DoCast(who, SPELL_DEPTH_CHARGE_TRAP); @@ -469,45 +407,37 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI return; } } - void AttackStart(Unit *who) { return; } - void EnterCombat(Unit* who) { return; } }; - CreatureAI* GetAI_mob_depth_charge(Creature* pCreature) { return new mob_depth_chargeAI (pCreature); } - void AddSC_azshara() { Script *newscript; - newscript = new Script; newscript->Name = "mobs_spitelashes"; newscript->GetAI = &GetAI_mobs_spitelashes; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_loramus_thalipedes"; newscript->pGossipHello = &GossipHello_npc_loramus_thalipedes; newscript->pGossipSelect = &GossipSelect_npc_loramus_thalipedes; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_rizzle_sprysprocket"; newscript->GetAI = &GetAI_mob_rizzle_sprysprocket; newscript->pGossipHello = &GossipHello_mob_rizzle_sprysprocket; newscript->pGossipSelect = &GossipSelect_mob_rizzle_sprysprocket; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_depth_charge"; newscript->GetAI = &GetAI_mob_depth_charge; diff --git a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp index 76d7ff0e4af..9dfd5f1cdfa 100644 --- a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Azuremyst_Isle SD%Complete: 75 SDComment: Quest support: 9283, 9537, 9582, 9554, 9531, 9303(special flight path, proper model for mount missing). Injured Draenei cosmetic only SDCategory: Azuremyst Isle EndScriptData */ - /* ContentData npc_draenei_survivor npc_engineer_spark_overgrind @@ -29,90 +27,68 @@ npc_magwin npc_geezle mob_nestlewood_owlkin EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include - /*###### ## npc_draenei_survivor ######*/ - enum eEnums { SAY_HEAL1 = -1000248, SAY_HEAL2 = -1000249, SAY_HEAL3 = -1000250, SAY_HEAL4 = -1000251, - SAY_HELP1 = -1000252, SAY_HELP2 = -1000253, SAY_HELP3 = -1000254, SAY_HELP4 = -1000255, - SPELL_IRRIDATION = 35046, SPELL_STUNNED = 28630 }; - struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI { npc_draenei_survivorAI(Creature *c) : ScriptedAI(c) {} - uint64 pCaster; - uint32 SayThanksTimer; uint32 RunAwayTimer; uint32 SayHelpTimer; - bool CanSayHelp; - void Reset() { pCaster = 0; - SayThanksTimer = 0; RunAwayTimer = 0; SayHelpTimer = 10000; - CanSayHelp = true; - m_creature->CastSpell(m_creature, SPELL_IRRIDATION, true); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); m_creature->SetHealth(int(m_creature->GetMaxHealth()*.1)); m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); } - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit *who) { if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsFriendlyTo(who) && m_creature->IsWithinDistInMap(who, 25.0f)) { //Random switch between 4 texts DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), m_creature, who); - SayHelpTimer = 20000; CanSayHelp = false; } } - void SpellHit(Unit *Caster, const SpellEntry *Spell) { if (Spell->SpellFamilyFlags[2] & 0x080000000) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); m_creature->SetStandState(UNIT_STAND_STATE_STAND); - m_creature->CastSpell(m_creature, SPELL_STUNNED, true); - pCaster = Caster->GetGUID(); - SayThanksTimer = 5000; } } - void UpdateAI(const uint32 diff) { if (SayThanksTimer) @@ -120,34 +96,26 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI if (SayThanksTimer <= diff) { m_creature->RemoveAurasDueToSpell(SPELL_IRRIDATION); - if (Player* pPlayer = Unit::GetPlayer(pCaster)) { DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), m_creature, pPlayer); - pPlayer->TalkedToCreature(m_creature->GetEntry(),m_creature->GetGUID()); } - m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MovePoint(0, -4115.053711f, -13754.831055f, 73.508949f); - RunAwayTimer = 10000; SayThanksTimer = 0; }else SayThanksTimer -= diff; - return; } - if (RunAwayTimer) { if (RunAwayTimer <= diff) m_creature->ForcedDespawn(); else RunAwayTimer -= diff; - return; } - if (SayHelpTimer < diff) { CanSayHelp = true; @@ -159,61 +127,47 @@ CreatureAI* GetAI_npc_draenei_survivor(Creature* pCreature) { return new npc_draenei_survivorAI (pCreature); } - /*###### ## npc_engineer_spark_overgrind ######*/ - enum eOvergrind { SAY_TEXT = -1000256, SAY_EMOTE = -1000257, ATTACK_YELL = -1000258, - AREA_COVE = 3579, AREA_ISLE = 3639, QUEST_GNOMERCY = 9537, FACTION_HOSTILE = 14, SPELL_DYNAMITE = 7978 }; - #define GOSSIP_FIGHT "Traitor! You will be brought to justice!" - struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI { npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) { NormFaction = c->getFaction(); NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); - if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) IsTreeEvent = true; } - uint32 NormFaction; uint32 NpcFlags; - uint32 Dynamite_Timer; uint32 Emote_Timer; - bool IsTreeEvent; - void Reset() { Dynamite_Timer = 8000; Emote_Timer = 120000 + rand()%30000; - m_creature->setFaction(NormFaction); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); - IsTreeEvent = false; } - void EnterCombat(Unit* who) { DoScriptText(ATTACK_YELL, m_creature, who); } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat() && !IsTreeEvent) @@ -227,34 +181,27 @@ struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI } else if (IsTreeEvent) return; - if (!UpdateVictim()) return; - if (Dynamite_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_DYNAMITE); Dynamite_Timer = 8000; } else Dynamite_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_engineer_spark_overgrind(Creature* pCreature) { return new npc_engineer_spark_overgrindAI (pCreature); } - bool GossipHello_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -265,15 +212,12 @@ bool GossipSelect_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreat } return true; } - /*###### ## npc_injured_draenei ######*/ - struct TRINITY_DLL_DECL npc_injured_draeneiAI : public ScriptedAI { npc_injured_draeneiAI(Creature *c) : ScriptedAI(c) {} - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); @@ -284,29 +228,23 @@ struct TRINITY_DLL_DECL npc_injured_draeneiAI : public ScriptedAI case 1: m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); break; } } - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit *who) { return; //ignore everyone around them (won't aggro anything) } - void UpdateAI(const uint32 diff) { return; } - }; CreatureAI* GetAI_npc_injured_draenei(Creature* pCreature) { return new npc_injured_draeneiAI (pCreature); } - /*###### ## npc_magwin ######*/ - enum eMagwin { SAY_START = -1000111, @@ -315,22 +253,17 @@ enum eMagwin SAY_END1 = -1000114, SAY_END2 = -1000115, EMOTE_HUG = -1000116, - QUEST_A_CRY_FOR_SAY_HELP = 9528 }; - struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI { npc_magwinAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: @@ -349,15 +282,12 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI break; } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature, who); } - void Reset() { } }; - bool QuestAccept_npc_magwin(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP) @@ -368,22 +298,17 @@ bool QuestAccept_npc_magwin(Player* pPlayer, Creature* pCreature, Quest const* q } return true; } - CreatureAI* GetAI_npc_magwinAI(Creature* pCreature) { return new npc_magwinAI(pCreature); } - /*###### ## npc_geezle ######*/ - enum eGeezle { QUEST_TREES_COMPANY = 9531, - SPELL_TREE_DISGUISE = 30298, - GEEZLE_SAY_1 = -1000259, SPARK_SAY_2 = -1000260, SPARK_SAY_3 = -1000261, @@ -391,35 +316,25 @@ enum eGeezle SPARK_SAY_5 = -1000263, SPARK_SAY_6 = -1000264, GEEZLE_SAY_7 = -1000265, - EMOTE_SPARK = -1000266, - MOB_SPARK = 17243, GO_NAGA_FLAG = 181694 }; - static float SparkPos[3] = {-5029.91, -11291.79, 8.096}; - struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI { npc_geezleAI(Creature *c) : ScriptedAI(c) {} - uint64 SparkGUID; - uint32 Step; uint32 SayTimer; - bool EventStarted; - void Reset() { SparkGUID = 0; Step = 0; StartEvent(); } - void EnterCombat(Unit* who){} - void StartEvent() { Step = 0; @@ -433,11 +348,9 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI } SayTimer = 8000; } - uint32 NextStep(uint32 Step) { Creature* Spark = Unit::GetCreature(*m_creature, SparkGUID); - switch(Step) { case 0: @@ -477,7 +390,6 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI default: return 99999999; } } - // will complete Tree's company quest for all nearby players that are disguised as trees void CompleteQuest() { @@ -486,8 +398,7 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI Trinity::AnyPlayerInObjectRangeCheck checker(m_creature, radius); Trinity::PlayerListSearcher searcher(m_creature, players, checker); m_creature->VisitNearbyWorldObject(radius, searcher); - - for(std::list::iterator itr = players.begin(); itr != players.end(); ++itr) + for (std::list::iterator itr = players.begin(); itr != players.end(); ++itr) { if((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE &&(*itr)->HasAuraEffect(SPELL_TREE_DISGUISE,3) ) @@ -496,15 +407,13 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI } } } - void DespawnNagaFlag(bool despawn) { std::list FlagList; m_creature->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 100.0f); - if (!FlagList.empty()) { - for(std::list::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + for (std::list::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) { if (despawn) { @@ -515,7 +424,6 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI } } else error_log("SD2 ERROR: FlagList is empty!"); } - void UpdateAI(const uint32 diff) { if (SayTimer < diff) @@ -527,34 +435,27 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI }else SayTimer -= diff; } }; - CreatureAI* GetAI_npc_geezleAI(Creature* pCreature) { return new npc_geezleAI(pCreature); } - /*###### ## mob_nestlewood_owlkin ######*/ - enum eOwlkin { SPELL_INOCULATE_OWLKIN = 29528, ENTRY_OWLKIN = 16518, ENTRY_OWLKIN_INOC = 16534 }; - struct TRINITY_DLL_DECL npc_nestlewood_owlkinAI : public ScriptedAI { npc_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {} - uint32 DespawnTimer; - void Reset() { DespawnTimer = 0; } - void UpdateAI(const uint32 diff) { //timer gets adjusted by the triggered aura effect @@ -567,19 +468,15 @@ struct TRINITY_DLL_DECL npc_nestlewood_owlkinAI : public ScriptedAI return; }else DespawnTimer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_nestlewood_owlkinAI(Creature* pCreature) { return new npc_nestlewood_owlkinAI (pCreature); } - bool EffectDummyCreature_npc_nestlewood_owlkin(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) { //always check spellid and effectindex @@ -587,50 +484,40 @@ bool EffectDummyCreature_npc_nestlewood_owlkin(Unit *pCaster, uint32 spellId, ui { if (pCreatureTarget->GetEntry() != ENTRY_OWLKIN) return true; - pCreatureTarget->UpdateEntry(ENTRY_OWLKIN_INOC); - //set despawn timer, since we want to remove Creature after a short time CAST_AI(npc_nestlewood_owlkinAI, pCreatureTarget->AI())->DespawnTimer = 15000; - //always return true when we are handling this spell and effect return true; } return false; } - void AddSC_azuremyst_isle() { Script *newscript; - newscript = new Script; newscript->Name = "npc_draenei_survivor"; newscript->GetAI = &GetAI_npc_draenei_survivor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_engineer_spark_overgrind"; newscript->GetAI = &GetAI_npc_engineer_spark_overgrind; newscript->pGossipHello = &GossipHello_npc_engineer_spark_overgrind; newscript->pGossipSelect = &GossipSelect_npc_engineer_spark_overgrind; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_injured_draenei"; newscript->GetAI = &GetAI_npc_injured_draenei; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_magwin"; newscript->GetAI = &GetAI_npc_magwinAI; newscript->pQuestAccept = &QuestAccept_npc_magwin; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_geezle"; newscript->GetAI = &GetAI_npc_geezleAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_nestlewood_owlkin"; newscript->GetAI = &GetAI_npc_nestlewood_owlkinAI; diff --git a/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/def_blackfathom_deeps.h b/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/def_blackfathom_deeps.h index 097554708b7..20cf6610a94 100644 --- a/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/def_blackfathom_deeps.h +++ b/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/def_blackfathom_deeps.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_BFD_H #define DEF_BFD_H - enum eEnums { DATA_SHRINE1 = 1, @@ -15,9 +13,7 @@ enum eEnums DATA_SHRINE_OF_GELIHAST = 6, DATA_ALTAR_OF_THE_DEEPS = 7, DATA_MAINDOOR = 8, - TYPE_KELRIS = 10, TYPE_SHRINE = 11 }; - #endif diff --git a/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp b/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp index 0845396ffa3..36277c56450 100644 --- a/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp +++ b/src/bindings/scripts/scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp @@ -13,28 +13,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Blackfathom_Deeps SD%Complete: 50 SDComment: SDCategory: Blackfathom Deeps EndScriptData */ - #include "precompiled.h" #include "def_blackfathom_deeps.h" - #define MAX_ENCOUNTER 2 - /* Encounter 0 = Twilight Lord Kelris Encounter 1 = Shrine event Must kill twilight lord for shrine event to be possible */ - struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance { instance_blackfathom_deeps(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 m_uiTwilightLordKelrisGUID; uint64 m_uiShrine1GUID; uint64 m_uiShrine2GUID; @@ -43,13 +37,10 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance uint64 m_uiShrineOfGelihastGUID; uint64 m_uiAltarOfTheDeepsGUID; uint64 m_uiMainDoorGUID; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiTwilightLordKelrisGUID = 0; m_uiShrine1GUID = 0; m_uiShrine2GUID = 0; @@ -59,13 +50,11 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance m_uiAltarOfTheDeepsGUID = 0; m_uiMainDoorGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { if (pCreature->GetEntry() == 4832) m_uiTwilightLordKelrisGUID = pCreature->GetGUID(); } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -79,7 +68,6 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance case 21117: m_uiMainDoorGUID = pGo->GetGUID(); break; } } - void SetData(uint32 uiType, uint32 uiData) { switch(uiType) @@ -92,7 +80,6 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance break; } } - uint32 GetData(uint32 uiType) { switch(uiType) @@ -102,10 +89,8 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance case TYPE_SHRINE: return m_auiEncounter[1]; } - return 0; } - uint64 GetData64(uint32 uiData) { switch(uiData) @@ -125,10 +110,8 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance case DATA_MAINDOOR: return m_uiMainDoorGUID; } - return 0; } - void CheckFires() { GameObject *pShrine1 = instance->GetGameObject(m_uiShrine1GUID); @@ -142,16 +125,13 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance HandleGameObject(m_uiMainDoorGUID,true); } }; - InstanceData* GetInstanceData_instance_blackfathom_deeps(Map* pMap) { return new instance_blackfathom_deeps(pMap); } - bool GoHello_fire(Player *pPlayer, GameObject* pGo) { ScriptedInstance *pInstance = pGo->GetInstanceData(); - if (pInstance) { pGo->SetGoState(GO_STATE_ACTIVE); @@ -159,7 +139,6 @@ bool GoHello_fire(Player *pPlayer, GameObject* pGo) } return false; } - void AddSC_instance_blackfathom_deeps() { Script *newscript; @@ -167,7 +146,6 @@ void AddSC_instance_blackfathom_deeps() newscript->Name = "instance_blackfathom_deeps"; newscript->GetInstanceData = &GetInstanceData_instance_blackfathom_deeps; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_blackfathom_fire"; newscript->pGOHello = &GoHello_fire; diff --git a/src/bindings/scripts/scripts/kalimdor/bloodmyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/bloodmyst_isle.cpp index 5dce0a0e9d9..774094b49ac 100644 --- a/src/bindings/scripts/scripts/kalimdor/bloodmyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/bloodmyst_isle.cpp @@ -13,44 +13,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Bloodmyst_Isle SD%Complete: 80 SDComment: Quest support: 9670, 9756(gossip items text needed). SDCategory: Bloodmyst Isle EndScriptData */ - /* ContentData mob_webbed_creature npc_captured_sunhawk_agent EndContentData */ - #include "precompiled.h" - /*###### ## mob_webbed_creature ######*/ - //possible creatures to be spawned const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; - struct TRINITY_DLL_DECL mob_webbed_creatureAI : public ScriptedAI { mob_webbed_creatureAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void EnterCombat(Unit* who) { } - void JustDied(Unit* Killer) { uint32 spawnCreatureID = 0; - switch(rand()%3) { case 0: @@ -63,7 +53,6 @@ struct TRINITY_DLL_DECL mob_webbed_creatureAI : public ScriptedAI spawnCreatureID = possibleSpawns[rand()%31]; break; } - if (spawnCreatureID) m_creature->SummonCreature(spawnCreatureID, 0.0f, 0.0f, 0.0f, m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); } @@ -72,20 +61,16 @@ CreatureAI* GetAI_mob_webbed_creature(Creature* pCreature) { return new mob_webbed_creatureAI (pCreature); } - /*###### ## npc_captured_sunhawk_agent ######*/ - #define C_SUNHAWK_TRIGGER 17974 - #define GOSSIP_HELLO_CSA "[PH] " #define GOSSIP_SELECT_CSA1 "[PH] " #define GOSSIP_SELECT_CSA2 "[PH] " #define GOSSIP_SELECT_CSA3 "[PH] " #define GOSSIP_SELECT_CSA4 "[PH] " #define GOSSIP_SELECT_CSA5 "[PH] " - bool GossipHello_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature) { if (pPlayer->HasAura(31609) && pPlayer->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE) @@ -95,10 +80,8 @@ bool GossipHello_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature } else pPlayer->SEND_GOSSIP_MENU(9134, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -130,16 +113,13 @@ bool GossipSelect_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreatur } return true; } - void AddSC_bloodmyst_isle() { Script *newscript; - newscript = new Script; newscript->Name = "mob_webbed_creature"; newscript->GetAI = &GetAI_mob_webbed_creature; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_captured_sunhawk_agent"; newscript->pGossipHello = &GossipHello_npc_captured_sunhawk_agent; diff --git a/src/bindings/scripts/scripts/kalimdor/boss_azuregos.cpp b/src/bindings/scripts/scripts/kalimdor/boss_azuregos.cpp index 56efc4f71cf..629541b0d91 100644 --- a/src/bindings/scripts/scripts/kalimdor/boss_azuregos.cpp +++ b/src/bindings/scripts/scripts/kalimdor/boss_azuregos.cpp @@ -13,18 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Azuregos SD%Complete: 90 SDComment: Teleport not included, spell reflect not effecting dots (Core problem) SDCategory: Azshara EndScriptData */ - #include "precompiled.h" - #define SAY_TELEPORT -1000100 - #define SPELL_MARKOFFROST 23182 #define SPELL_MANASTORM 21097 #define SPELL_CHILL 21098 @@ -32,11 +28,9 @@ EndScriptData */ #define SPELL_REFLECT 22067 #define SPELL_CLEAVE 8255 //Perhaps not right ID #define SPELL_ENRAGE 23537 - struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI { boss_azuregosAI(Creature *c) : ScriptedAI(c) {} - uint32 MarkOfFrost_Timer; uint32 ManaStorm_Timer; uint32 Chill_Timer; @@ -46,7 +40,6 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI uint32 Cleave_Timer; uint32 Enrage_Timer; bool Enraged; - void Reset() { MarkOfFrost_Timer = 35000; @@ -59,15 +52,12 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI Enrage_Timer = 0; Enraged = false; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Teleport_Timer < diff) { DoScriptText(SAY_TELEPORT, m_creature); @@ -81,32 +71,27 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI DoTeleportPlayer(pUnit, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()+3, pUnit->GetOrientation()); } } - DoResetThreat(); Teleport_Timer = 30000; }else Teleport_Timer -= diff; - // //MarkOfFrost_Timer // if (MarkOfFrost_Timer < diff) // { // DoCast(m_creature->getVictim(),SPELL_MARKOFFROST); // MarkOfFrost_Timer = 25000; // }else MarkOfFrost_Timer -= diff; - //Chill_Timer if (Chill_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CHILL); Chill_Timer = 13000 + rand()%12000; }else Chill_Timer -= diff; - //Breath_Timer if (Breath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBREATH); Breath_Timer = 10000 + rand()%5000; }else Breath_Timer -= diff; - //ManaStorm_Timer if (ManaStorm_Timer < diff) { @@ -114,28 +99,24 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI DoCast(target,SPELL_MANASTORM); ManaStorm_Timer = 7500 + rand()%5000; }else ManaStorm_Timer -= diff; - //Reflect_Timer if (Reflect_Timer < diff) { DoCast(m_creature,SPELL_REFLECT); Reflect_Timer = 20000 + rand()%15000; }else Reflect_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //Enrage_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26 && !Enraged) { DoCast(m_creature, SPELL_ENRAGE); Enraged = true; } - DoMeleeAttackIfReady(); } }; @@ -143,7 +124,6 @@ CreatureAI* GetAI_boss_azuregos(Creature* pCreature) { return new boss_azuregosAI (pCreature); } - void AddSC_boss_azuregos() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp index 3d9c1c3fcbf..830b3f55e08 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp @@ -5,19 +5,16 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_CURSE_OF_EXERTION 52772 #define SPELL_TIME_WARP 52766 //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. #define SPELL_TIME_STOP 58848 //Stops time in a 50 yard sphere for 2 sec. #define SPELL_WOUNDING_STRIKE_N 52771 //Used only on the tank #define SPELL_WOUNDING_STRIKE_H 58830 - //not in db //Say #define SAY_INTRO -1595000 //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own." @@ -29,18 +26,14 @@ update creature_template set scriptname = '' where entry = ''; #define SAY_SLAY_2 -1595006 //"This is the hour of our greatest triumph!" #define SAY_SLAY_3 -1595007 //"You were destined to fail. " #define SAY_DEATH -1595008 //"*gurgles*" - struct TRINITY_DLL_DECL boss_epochAI : public ScriptedAI { boss_epochAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) @@ -48,33 +41,26 @@ struct TRINITY_DLL_DECL boss_epochAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_epoch(Creature* pCreature) { return new boss_epochAI (pCreature); } - void AddSC_boss_epoch() { Script *newscript; - newscript = new Script; newscript->Name = "boss_epoch"; newscript->GetAI = &GetAI_boss_epoch; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp index b94d01ce4de..9d6375b870a 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp @@ -5,12 +5,10 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_mal_ganis' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_CARRION_SWARM_N 52720 //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec. #define SPELL_CARRION_SWARM_H 58852 @@ -18,7 +16,6 @@ update creature_template set scriptname = 'boss_mal_ganis' where entry = ''; #define SPELL_MIND_BLAST_H 58850 #define SPELL_SLEEP 52721 //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. #define SPELL_VAMPIRIC_TOUCH 52723 //Heals the caster for half the damage dealt by a melee attack. - //not in db //Yell Mal'ganis #define SAY_INTRO_1 -1595009 @@ -38,27 +35,22 @@ update creature_template set scriptname = 'boss_mal_ganis' where entry = ''; #define SAY_15HEALTH -1595023 #define SAY_ESCAPE_SPEECH_1 -1595024 #define SAY_ESCAPE_SPEECH_2 -1595025 - struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI { boss_mal_ganisAI(Creature *c) : ScriptedAI(c) {} - bool yelled, yelled2, yelled3; - void Reset() { yelled = false; yelled2 = false; yelled3 = false; } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) @@ -66,7 +58,6 @@ struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if (!yelled) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30) @@ -75,7 +66,6 @@ struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI yelled = true; } } - if (!yelled2) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 15) @@ -84,12 +74,10 @@ struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI yelled2 = true; } } - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 1) { //Handle Escape Event } - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) {} @@ -97,20 +85,16 @@ struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), m_creature); } }; - CreatureAI* GetAI_boss_mal_ganis(Creature* pCreature) { return new boss_mal_ganisAI (pCreature); } - void AddSC_boss_mal_ganis() { Script *newscript; - newscript = new Script; newscript->Name = "boss_mal_ganis"; newscript->GetAI = &GetAI_boss_mal_ganis; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp index 261ed4a5ca0..2a14cec9350 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp @@ -5,19 +5,16 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_meathook' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spell #define SPELL_CONSTRICTING_CHAINS_N 52696 //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec. #define SPELL_CONSTRICTING_CHAINS_H 58823 #define SPELL_DISEASE_EXPULSION_N 52666 //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec. #define SPELL_DISEASE_EXPULSION_H 58824 #define SPELL_FRENZY 58841 //Increases the caster's Physical damage by 10% for 30 sec. - //not in db //Yell #define SAY_AGGRO -1595026 @@ -26,29 +23,23 @@ update creature_template set scriptname = 'boss_meathook' where entry = ''; #define SAY_SLAY_3 -1595029 #define SAY_SPAWN -1595030 #define SAY_DEATH -1595031 - struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI { boss_meathookAI(Creature *c) : ScriptedAI(c) {} - uint32 Chain_Timer, Disease_Timer, Frenzy_Timer; - void Reset() { Chain_Timer = 12000 + rand()%5000; //seen on video 13, 17, 15, 12, 16 Disease_Timer = 2000 + rand()%1000; //approx 3s Frenzy_Timer = 20000 + rand()%10000; //made it up } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} - std::list pList; void MoveInLineOfSight(Unit* who, const uint32 diff) { @@ -57,76 +48,62 @@ struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI pList.append(who); }*/ } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Disease_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_DISEASE_EXPULSION_N); Disease_Timer = 1500 + rand()%2500; }else Disease_Timer -= diff; - if (Frenzy_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FRENZY); Frenzy_Timer = 20000 + rand()%10000; }else Frenzy_Timer -= diff; - if (Chain_Timer < diff) { - /* std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator itr; - int st=0; - for(itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) + for (itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) { //st++; m_creature->getThreatManager(). } Unit* targets[st]; int st2=0; - for(int i=1; i<=st; ++i){ + for (int i=1; i<=st; ++i){ if (!IsWithinLOSInMap(targets[i]) st2++; } Unit* targets_out_of_LOS[st2];*/ - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CONSTRICTING_CHAINS_N); //anyone but the tank Chain_Timer = 2000 + rand()%1000; }else Chain_Timer -= diff; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_meathook(Creature* pCreature) { return new boss_meathookAI (pCreature); } - void AddSC_boss_meathook() { Script *newscript; - newscript = new Script; newscript->Name = "boss_meathook"; newscript->GetAI = &GetAI_boss_meathook; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp index 2982eb5a1b8..6829cd70dd2 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp @@ -5,12 +5,10 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_salramm' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_CURSE_OF_TWISTED_FLESH 58845 #define SPELL_EXPLODE_GHOUL_N 52480 @@ -19,7 +17,6 @@ update creature_template set scriptname = 'boss_salramm' where entry = ''; #define SPELL_SHADOW_BOLT_H 58828 #define SPELL_STEAL_FLESH 52708 #define SPELL_SUMMON_GHOULS 52451 - //not in db //Yell #define SAY_AGGRO -1595032 @@ -35,17 +32,14 @@ update creature_template set scriptname = 'boss_salramm' where entry = ''; #define SAY_STEAL_FLESH_3 -1595042 #define SAY_SUMMON_GHOULS_1 -1595043 #define SAY_SUMMON_GHOULS_2 -1595044 - struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI { boss_salrammAI(Creature *c) : ScriptedAI(c) {} - uint32 Curse_flesh_Timer, Explode_ghoul_Timer, Shadow_bolt_Timer, Steal_flesh_Timer, Summon_ghouls_Timer; - void Reset() { Curse_flesh_Timer = 30000; //30s DBM @@ -54,10 +48,8 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI Steal_flesh_Timer = 12345; Summon_ghouls_Timer = 19000 + rand()%5000; //on a video approx 24s after aggro } - void EnterCombat(Unit* who) {DoScriptText(SAY_AGGRO, m_creature);} - void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) @@ -65,16 +57,13 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0); - //Curse of twisted flesh timer if (Curse_flesh_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSE_OF_TWISTED_FLESH); Curse_flesh_Timer = 37000; }else Curse_flesh_Timer -= diff; - //Shadow bolt timer if (Shadow_bolt_Timer < diff) { @@ -82,7 +71,6 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI DoCast(random_target,SPELL_SHADOW_BOLT_N); Shadow_bolt_Timer = 8000 + rand()%4000; }else Shadow_bolt_Timer -= diff; - //Steal Flesh timer if (Steal_flesh_Timer < diff) { @@ -102,7 +90,6 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI DoCast(random_target,SPELL_STEAL_FLESH); Steal_flesh_Timer = 10000; }else Steal_flesh_Timer -= diff; - //Summon ghouls timer if (Summon_ghouls_Timer < diff) { @@ -119,31 +106,24 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI DoCast(random_target,SPELL_SUMMON_GHOULS); Summon_ghouls_Timer = 10000; }else Summon_ghouls_Timer -= diff; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) {DoScriptText(SAY_DEATH, m_creature);} - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_salramm(Creature* pCreature) { return new boss_salrammAI (pCreature); } - void AddSC_boss_salramm() { Script *newscript; - newscript = new Script; newscript->Name = "boss_salramm"; newscript->GetAI = &GetAI_boss_salramm; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h index 849549e8f99..ae7e93dc32b 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h @@ -1,4 +1,3 @@ #ifndef DEF_CULLING_OF_STRATHOLME_H #define DEF_CULLING_OF_STRATHOLME_H - #endif diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp index 35ee68ea991..81abb37776c 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp @@ -1,16 +1,13 @@ #include "precompiled.h" #include "def_culling_of_stratholme.h" - struct TRINITY_DLL_DECL instance_culling_of_stratholme : public ScriptedInstance { instance_culling_of_stratholme(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; }; - InstanceData* GetInstanceData_instance_culling_of_stratholme(Map* pMap) { return new instance_culling_of_stratholme(pMap); } - void AddSC_instance_culling_of_stratholme() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_aeonus.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_aeonus.cpp index ea3bdc45a6f..b743501788d 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_aeonus.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_aeonus.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Aeonus SD%Complete: 80 SDComment: Some spells not implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ - #include "precompiled.h" #include "def_dark_portal.h" - enum eEnums { SAY_ENTER = -1269012, @@ -33,14 +30,12 @@ enum eEnums SAY_SLAY2 = -1269016, SAY_DEATH = -1269017, EMOTE_FRENZY = -1269018, - SPELL_CLEAVE = 40504, SPELL_TIME_STOP = 31422, SPELL_ENRAGE = 37605, SPELL_SAND_BREATH = 31473, H_SPELL_SAND_BREATH = 39049 }; - struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI { boss_aeonusAI(Creature *c) : ScriptedAI(c) @@ -48,26 +43,21 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = m_creature->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; bool HeroicMode; - uint32 SandBreath_Timer; uint32 TimeStop_Timer; uint32 Frenzy_Timer; - void Reset() { SandBreath_Timer = 15000+rand()%15000; TimeStop_Timer = 10000+rand()%5000; Frenzy_Timer = 30000+rand()%15000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void MoveInLineOfSight(Unit *who) { //Despawn Time Keeper @@ -79,46 +69,38 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { pInstance->SetData(TYPE_RIFT,DONE); pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed } } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Sand Breath if (SandBreath_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SAND_BREATH, H_SPELL_SAND_BREATH)); SandBreath_Timer = 15000+rand()%10000; }else SandBreath_Timer -= diff; - //Time Stop if (TimeStop_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_TIME_STOP); TimeStop_Timer = 20000+rand()%15000; }else TimeStop_Timer -= diff; - //Frenzy if (Frenzy_Timer < diff) { @@ -126,16 +108,13 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI DoCast(m_creature, SPELL_ENRAGE); Frenzy_Timer = 20000+rand()%15000; }else Frenzy_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_aeonus(Creature* pCreature) { return new boss_aeonusAI (pCreature); } - void AddSC_boss_aeonus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp index eb0471fc278..f5dce6ba27c 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Chrono_Lord_Deja SD%Complete: 65 SDComment: All abilities not implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ - #include "precompiled.h" #include "def_dark_portal.h" - enum eEnums { SAY_ENTER = -1269006, @@ -32,7 +29,6 @@ enum eEnums SAY_SLAY1 = -1269009, SAY_SLAY2 = -1269010, SAY_DEATH = -1269011, - SPELL_ARCANE_BLAST = 31457, H_SPELL_ARCANE_BLAST = 38538, SPELL_ARCANE_DISCHARGE = 31472, @@ -40,7 +36,6 @@ enum eEnums SPELL_TIME_LAPSE = 31467, SPELL_ATTRACTION = 38540 //Not Implemented (Heroic mode) }; - struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI { boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) @@ -48,15 +43,12 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; bool HeroicMode; - uint32 ArcaneBlast_Timer; uint32 TimeLapse_Timer; uint32 Attraction_Timer; uint32 ArcaneDischarge_Timer; - void Reset() { ArcaneBlast_Timer = 18000+rand()%5000; @@ -64,12 +56,10 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI ArcaneDischarge_Timer = 20000+rand()%10000; Attraction_Timer = 25000+rand()%10000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void MoveInLineOfSight(Unit *who) { //Despawn Time Keeper @@ -81,36 +71,29 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - ScriptedAI::MoveInLineOfSight(who); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_RIFT,SPECIAL); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Arcane Blast if (ArcaneBlast_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_ARCANE_BLAST, H_SPELL_ARCANE_BLAST)); ArcaneBlast_Timer = 15000+rand()%10000; }else ArcaneBlast_Timer -= diff; - //Arcane Discharge if (ArcaneDischarge_Timer < diff) { @@ -118,7 +101,6 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI DoCast(target,HEROIC(SPELL_ARCANE_DISCHARGE, H_SPELL_ARCANE_DISCHARGE)); ArcaneDischarge_Timer = 20000+rand()%10000; }else ArcaneDischarge_Timer -= diff; - //Time Lapse if (TimeLapse_Timer < diff) { @@ -126,7 +108,6 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI DoCast(m_creature, SPELL_TIME_LAPSE); TimeLapse_Timer = 15000+rand()%10000; }else TimeLapse_Timer -= diff; - if (HeroicMode) { if (Attraction_Timer < diff) @@ -135,16 +116,13 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI Attraction_Timer = 25000+rand()%10000; }else Attraction_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_chrono_lord_deja(Creature* pCreature) { return new boss_chrono_lord_dejaAI (pCreature); } - void AddSC_boss_chrono_lord_deja() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_temporus.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_temporus.cpp index 5b09e4cb117..fda6c49ae94 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_temporus.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/boss_temporus.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Temporus SD%Complete: 75 SDComment: More abilities need to be implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ - #include "precompiled.h" #include "def_dark_portal.h" - enum eEnums { SAY_ENTER = -1269000, @@ -32,14 +29,12 @@ enum eEnums SAY_SLAY1 = -1269003, SAY_SLAY2 = -1269004, SAY_DEATH = -1269005, - SPELL_HASTE = 31458, SPELL_MORTAL_WOUND = 31464, SPELL_WING_BUFFET = 31475, H_SPELL_WING_BUFFET = 38593, SPELL_REFLECT = 38592 //Not Implemented (Heroic mod) }; - struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI { boss_temporusAI(Creature *c) : ScriptedAI(c) @@ -47,15 +42,12 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; bool HeroicMode; - uint32 Haste_Timer; uint32 SpellReflection_Timer; uint32 MortalWound_Timer; uint32 WingBuffet_Timer; - void Reset() { Haste_Timer = 15000+rand()%8000; @@ -63,25 +55,20 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI MortalWound_Timer = 8000; WingBuffet_Timer = 25000+rand()%10000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_RIFT,SPECIAL); } - void MoveInLineOfSight(Unit *who) { //Despawn Time Keeper @@ -90,41 +77,34 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI if (m_creature->IsWithinDistInMap(who,20.0f)) { DoScriptText(SAY_BANISH, m_creature); - m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - ScriptedAI::MoveInLineOfSight(who); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Attack Haste if (Haste_Timer < diff) { DoCast(m_creature, SPELL_HASTE); Haste_Timer = 20000+rand()%5000; }else Haste_Timer -= diff; - //MortalWound_Timer if (MortalWound_Timer < diff) { DoCast(m_creature, SPELL_MORTAL_WOUND); MortalWound_Timer = 10000+rand()%10000; }else MortalWound_Timer -= diff; - //Wing ruffet if (WingBuffet_Timer < diff) { DoCast(m_creature,HEROIC(SPELL_WING_BUFFET, H_SPELL_WING_BUFFET)); WingBuffet_Timer = 20000+rand()%10000; }else WingBuffet_Timer -= diff; - if (HeroicMode) { if (SpellReflection_Timer < diff) @@ -133,16 +113,13 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI SpellReflection_Timer = 25000+rand()%10000; }else SpellReflection_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_temporus(Creature* pCreature) { return new boss_temporusAI (pCreature); } - void AddSC_boss_temporus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp index 6984f287950..b8721cd8666 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp @@ -13,23 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Dark_Portal SD%Complete: 30 SDComment: Misc NPC's and mobs for instance. Most here far from complete. SDCategory: Caverns of Time, The Dark Portal EndScriptData */ - /* ContentData npc_medivh_bm npc_time_rift npc_saat EndContentData */ - #include "precompiled.h" #include "def_dark_portal.h" - #define SAY_ENTER -1269020 //where does this belong? #define SAY_INTRO -1269021 #define SAY_WEAK75 -1269022 @@ -39,62 +35,46 @@ EndContentData */ #define SAY_WIN -1269026 #define SAY_ORCS_ENTER -1269027 #define SAY_ORCS_ANSWER -1269028 - #define SPELL_CHANNEL 31556 #define SPELL_PORTAL_RUNE 32570 //aura(portal on ground effect) - #define SPELL_BLACK_CRYSTAL 32563 //aura #define SPELL_PORTAL_CRYSTAL 32564 //summon - #define SPELL_BANISH_PURPLE 32566 //aura #define SPELL_BANISH_GREEN 32567 //aura - #define SPELL_CORRUPT 31326 #define SPELL_CORRUPT_AEONUS 37853 - #define C_COUNCIL_ENFORCER 17023 - struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI { npc_medivh_bmAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 SpellCorrupt_Timer; uint32 Check_Timer; - bool Life75; bool Life50; bool Life25; - void Reset() { SpellCorrupt_Timer = 0; - if (!pInstance) return; - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) m_creature->CastSpell(m_creature,SPELL_CHANNEL,true); else if (m_creature->HasAura(SPELL_CHANNEL)) m_creature->RemoveAura(SPELL_CHANNEL); - m_creature->CastSpell(m_creature,SPELL_PORTAL_RUNE,true); } - void MoveInLineOfSight(Unit *who) { if (!pInstance) return; - if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 10.0f)) { if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS || pInstance->GetData(TYPE_MEDIVH) == DONE) return; - DoScriptText(SAY_INTRO, m_creature); pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); m_creature->CastSpell(m_creature,SPELL_CHANNEL,false); @@ -104,7 +84,6 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI { if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) return; - uint32 entry = who->GetEntry(); if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) { @@ -118,48 +97,37 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI } } } - void AttackStart(Unit *who) { //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) //return; - //ScriptedAI::AttackStart(who); } - void EnterCombat(Unit *who) {} - void SpellHit(Unit* caster, const SpellEntry* spell) { if (SpellCorrupt_Timer) return; - if (spell->Id == SPELL_CORRUPT_AEONUS) SpellCorrupt_Timer = 1000; - if (spell->Id == SPELL_CORRUPT) SpellCorrupt_Timer = 3000; } - void JustDied(Unit* Killer) { if (Killer->GetEntry() == m_creature->GetEntry()) return; - DoScriptText(SAY_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!pInstance) return; - if (SpellCorrupt_Timer) { if (SpellCorrupt_Timer <= diff) { pInstance->SetData(TYPE_MEDIVH,SPECIAL); - if (m_creature->HasAura(SPELL_CORRUPT_AEONUS)) SpellCorrupt_Timer = 1000; else if (m_creature->HasAura(SPELL_CORRUPT)) @@ -168,15 +136,12 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI SpellCorrupt_Timer = 0; }else SpellCorrupt_Timer -= diff; } - if (Check_Timer) { if (Check_Timer <= diff) { uint32 pct = pInstance->GetData(DATA_SHIELD); - Check_Timer = 5000; - if (Life25 && pct <= 25) { DoScriptText(SAY_WEAK25, m_creature); @@ -192,7 +157,6 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI DoScriptText(SAY_WEAK75, m_creature); Life75 = false; } - //if we reach this it means event was running but at some point reset. if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) { @@ -201,159 +165,122 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI m_creature->Respawn(); return; } - if (pInstance->GetData(TYPE_RIFT) == DONE) { DoScriptText(SAY_WIN, m_creature); Check_Timer = 0; - if (m_creature->HasAura(SPELL_CHANNEL)) m_creature->RemoveAura(SPELL_CHANNEL); - //TODO: start the post-event here pInstance->SetData(TYPE_MEDIVH,DONE); } }else Check_Timer -= diff; } - //if (!UpdateVictim()) //return; - //DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_medivh_bm(Creature* pCreature) { return new npc_medivh_bmAI (pCreature); } - struct Wave { uint32 PortalMob[4]; //spawns for portal waves (in order) }; - static Wave PortalWaves[]= { {C_ASSAS, C_WHELP, C_CHRON, 0}, {C_EXECU, C_CHRON, C_WHELP, C_ASSAS}, {C_EXECU, C_VANQU, C_CHRON, C_ASSAS} }; - struct TRINITY_DLL_DECL npc_time_riftAI : public ScriptedAI { npc_time_riftAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 TimeRiftWave_Timer; uint8 mRiftWaveCount; uint8 mPortalCount; uint8 mWaveId; - void Reset() { - TimeRiftWave_Timer = 15000; mRiftWaveCount = 0; - if (!pInstance) return; - mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); - if (mPortalCount < 6) mWaveId = 0; else if (mPortalCount > 12) mWaveId = 2; else mWaveId = 1; - } void EnterCombat(Unit *who) {} - void DoSummonAtRift(uint32 creature_entry) { if (!creature_entry) return; - if (pInstance && pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) { m_creature->InterruptNonMeleeSpells(true); m_creature->RemoveAllAuras(); return; } - Position pos; m_creature->GetRandomNearPosition(pos, 10.0f); - //normalize Z-level if we can, if rift is not at ground level. pos.m_positionZ = std::max(m_creature->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); - if(Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) if (Unit *temp = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0)) Summon->AddThreat(temp,0.0f); } - void DoSelectSummon() { uint32 entry = 0; - if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) mRiftWaveCount = 0; - entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; debug_log("TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).",mRiftWaveCount,entry); - ++mRiftWaveCount; - if (entry == C_WHELP) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) DoSummonAtRift(entry); }else DoSummonAtRift(entry); } - void UpdateAI(const uint32 diff) { if (!pInstance) return; - if (TimeRiftWave_Timer < diff) { DoSelectSummon(); TimeRiftWave_Timer = 15000; }else TimeRiftWave_Timer -= diff; - if (m_creature->IsNonMeleeSpellCasted(false)) return; - debug_log("TSCR: npc_time_rift: not casting anylonger, i need to die."); m_creature->setDeathState(JUST_DIED); - if (pInstance->GetData(TYPE_RIFT) == IN_PROGRESS) pInstance->SetData(TYPE_RIFT,SPECIAL); } }; - CreatureAI* GetAI_npc_time_rift(Creature* pCreature) { return new npc_time_riftAI (pCreature); } - #define SAY_SAAT_WELCOME -1269019 - #define GOSSIP_ITEM_OBTAIN "[PH] Obtain Chrono-Beacon" #define SPELL_CHRONO_BEACON 34975 #define ITEM_CHRONO_BEACON 24289 - bool GossipHello_npc_saat(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); @@ -366,11 +293,9 @@ bool GossipHello_npc_saat(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10001, pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(10002, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_saat(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -380,21 +305,17 @@ bool GossipSelect_npc_saat(Player* pPlayer, Creature* pCreature, uint32 uiSender } return true; } - void AddSC_dark_portal() { Script *newscript; - newscript = new Script; newscript->Name = "npc_medivh_bm"; newscript->GetAI = &GetAI_npc_medivh_bm; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_time_rift"; newscript->GetAI = &GetAI_npc_time_rift; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_saat"; newscript->pGossipHello = &GossipHello_npc_saat; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/def_dark_portal.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/def_dark_portal.h index 7bfd8c917d7..6c2572c4fe8 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/def_dark_portal.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/def_dark_portal.h @@ -1,24 +1,18 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_DARKPORTAL_H #define DEF_DARKPORTAL_H - #define TYPE_MEDIVH 1 #define TYPE_RIFT 2 - #define DATA_MEDIVH 10 #define DATA_PORTAL_COUNT 11 #define DATA_SHIELD 12 - #define WORLD_STATE_BM 2541 #define WORLD_STATE_BM_SHIELD 2540 #define WORLD_STATE_BM_RIFT 2784 - #define QUEST_OPENING_PORTAL 10297 #define QUEST_MASTER_TOUCH 9836 - #define C_TIME_KEEPER 17918 #define C_RKEEP 21104 #define C_RLORD 17839 @@ -30,6 +24,5 @@ #define C_CHRON 17892 #define C_EXECU 18994 #define C_VANQU 18995 - #endif diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp index b6d08ee82d8..f12a20e929c 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp @@ -13,28 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Dark_Portal SD%Complete: 50 SDComment: Quest support: 9836, 10297. Currently in progress. SDCategory: Caverns of Time, The Dark Portal EndScriptData */ - #include "precompiled.h" #include "def_dark_portal.h" - #define MAX_ENCOUNTER 2 - #define C_MEDIVH 15608 #define C_TIME_RIFT 17838 - #define SPELL_RIFT_CHANNEL 31387 - #define RIFT_BOSS 1 - inline uint32 RandRiftBoss() { return ((rand()%2) ? C_RKEEP : C_RLORD); } - float PortalLocation[4][4]= { {-2041.06, 7042.08, 29.99, 1.30}, @@ -42,13 +34,11 @@ float PortalLocation[4][4]= {-1885.82, 7107.36, 22.32, 3.07}, {-1928.11, 7175.95, 22.11, 3.44} }; - struct Wave { uint32 PortalBoss; //protector of current portal uint32 NextPortalTime; //time to next portal, or 0 if portal boss need to be killed }; - static Wave RiftWaves[]= { {RIFT_BOSS, 0}, @@ -58,81 +48,62 @@ static Wave RiftWaves[]= {RIFT_BOSS, 120000}, {C_AEONUS, 0} }; - struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance { instance_dark_portal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 mRiftPortalCount; uint32 mShieldPercent; uint8 mRiftWaveCount; uint8 mRiftWaveId; - uint32 NextPortal_Timer; - uint64 MedivhGUID; uint8 CurrentRiftId; - void Initialize() { MedivhGUID = 0; Clear(); } - void Clear() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - mRiftPortalCount = 0; mShieldPercent = 100; mRiftWaveCount = 0; mRiftWaveId = 0; - CurrentRiftId = 0; - NextPortal_Timer = 0; } - void InitWorldState(bool Enable = true) { DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0); DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100); DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); } - bool IsEncounterInProgress() { if (GetData(TYPE_MEDIVH) == IN_PROGRESS) return true; - return false; } - void OnPlayerEnter(Player* pPlayer) { if (GetData(TYPE_MEDIVH) == IN_PROGRESS) return; - pPlayer->SendUpdateWorldState(WORLD_STATE_BM,0); } - void OnCreatureCreate(Creature* pCreature, bool add) { if (pCreature->GetEntry() == C_MEDIVH) MedivhGUID = pCreature->GetGUID(); } - //what other conditions to check? bool CanProgressEvent() { if (instance->GetPlayers().isEmpty()) return false; - return true; } - uint8 GetRiftWaveId() { switch(mRiftPortalCount) @@ -149,7 +120,6 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance return mRiftWaveId; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -158,9 +128,7 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS) { --mShieldPercent; - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent); - if (!mShieldPercent) { if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) @@ -183,29 +151,25 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance m_auiEncounter[1] = IN_PROGRESS; NextPortal_Timer = 15000; } - if (data == DONE) { //this may be completed further out in the post-event debug_log("TSCR: Instance Dark Portal: Event completed."); Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); - if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); } } } } - m_auiEncounter[0] = data; } break; @@ -220,7 +184,6 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance break; } } - uint32 GetData(uint32 type) { switch(type) @@ -236,59 +199,44 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { if (data == DATA_MEDIVH) return MedivhGUID; - return 0; } - Creature* SummonedPortalBoss(Creature* m_creature) { uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss; - if (entry == RIFT_BOSS) entry = RandRiftBoss(); - debug_log("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry); - Position pos; m_creature->GetRandomNearPosition(pos, 10.0f); - //normalize Z-level if we can, if rift is not at ground level. pos.m_positionZ = std::max(m_creature->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); - if(Creature *summon = m_creature->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) return summon; - debug_log("TSCR: Instance Dark Portal: what just happened there? No boss, no loot, no fun..."); return NULL; } - void DoSpawnPortal() { if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) { int tmp = rand()%(4-1); - if (tmp >= CurrentRiftId) tmp++; debug_log("TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).",tmp,CurrentRiftId); - CurrentRiftId = tmp; - Creature* pTemp = pMedivh->SummonCreature(C_TIME_RIFT, PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3], TEMPSUMMON_CORPSE_DESPAWN,0); if (pTemp) { - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Creature* pBoss = SummonedPortalBoss(pTemp)) { if (pBoss->GetEntry() == C_AEONUS) @@ -304,43 +252,35 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance } } } - void Update(uint32 diff) { if (m_auiEncounter[1] != IN_PROGRESS) return; - //add delay timer? if (!CanProgressEvent()) { Clear(); return; } - if (NextPortal_Timer) { if (NextPortal_Timer <= diff) { ++mRiftPortalCount; - DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); - DoSpawnPortal(); NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime; }else NextPortal_Timer -= diff; } } }; - InstanceData* GetInstanceData_instance_dark_portal(Map* pMap) { return new instance_dark_portal(pMap); } - void AddSC_instance_dark_portal() { Script *newscript; - newscript = new Script; newscript->Name = "instance_dark_portal"; newscript->GetInstanceData = &GetInstanceData_instance_dark_portal; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_anetheron.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_anetheron.cpp index 96e56462385..b0a299f9c09 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_anetheron.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_anetheron.cpp @@ -2,40 +2,32 @@ #include "precompiled.h" #include "def_hyjal.h" #include "hyjal_trash.h" - #define SPELL_CARRION_SWARM 31306 #define SPELL_SLEEP 31298 #define SPELL_VAMPIRIC_AURA 38196 #define SPELL_INFERNO 31299 - #define SAY_ONDEATH "The clock... is still... ticking." #define SOUND_ONDEATH 10982 - #define SAY_ONSLAY1 "Your hopes are lost!" #define SAY_ONSLAY2 "Scream for me!" #define SAY_ONSLAY3 "Pity, no time for a slow death!" #define SOUND_ONSLAY1 10981 #define SOUND_ONSLAY2 11038 #define SOUND_ONSLAY3 11039 - #define SAY_SWARM1 "The swarm is eager to feed!" #define SAY_SWARM2 "Pestilence upon you!" #define SOUND_SWARM1 10979 #define SOUND_SWARM2 11037 - #define SAY_SLEEP1 "You look tired..." #define SAY_SLEEP2 "Sweet dreams..." #define SOUND_SLEEP1 10978 #define SOUND_SLEEP2 11545 - #define SAY_INFERNO1 "Let fire rain from above!" #define SAY_INFERNO2 "Earth and sky shall burn!" #define SOUND_INFERNO1 10980 #define SOUND_INFERNO2 11036 - #define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!" #define SOUND_ONAGGRO 10977 - struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI { boss_anetheronAI(Creature *c) : hyjal_trashAI(c) @@ -50,14 +42,12 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI TempSpell->EffectImplicitTargetB[0] = 0; } } - uint32 SwarmTimer; uint32 SleepTimer; uint32 AuraTimer; uint32 InfernoTimer; bool pGo; uint32 pos; - void Reset() { damageTaken = 0; @@ -65,11 +55,9 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI SleepTimer = 60000; AuraTimer = 5000; InfernoTimer = 45000; - if (pInstance && IsEvent) pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance && IsEvent) @@ -77,7 +65,6 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONAGGRO); m_creature->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); } - void KilledUnit(Unit *victim) { switch(rand()%3) @@ -96,7 +83,6 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI break; } } - void WaypointReached(uint32 i) { pos = i; @@ -107,7 +93,6 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI m_creature->AddThreat(target,0.0); } } - void JustDied(Unit *victim) { hyjal_trashAI::JustDied(victim); @@ -116,7 +101,6 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONDEATH); m_creature->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); } - void UpdateAI(const uint32 diff) { if (IsEvent) @@ -141,16 +125,13 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI } } } - //Return since we have no target if (!UpdateVictim()) return; - if (SwarmTimer < diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(target,SPELL_CARRION_SWARM); - SwarmTimer = 45000+rand()%15000; switch(rand()%2) { @@ -164,10 +145,9 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI break; } }else SwarmTimer -= diff; - if (SleepTimer < diff) { - for(uint8 i=0;i<3; ++i) + for (uint8 i=0; i<3; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) target->CastSpell(target,SPELL_SLEEP,true); @@ -206,19 +186,15 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI break; } }else InfernoTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_anetheron(Creature* pCreature) { return new boss_anetheronAI (pCreature); } - #define SPELL_IMMOLATION 31303 #define SPELL_INFERNO_EFFECT 31302 - struct TRINITY_DLL_DECL mob_towering_infernalAI : public ScriptedAI { mob_towering_infernalAI(Creature *c) : ScriptedAI(c) @@ -227,40 +203,30 @@ struct TRINITY_DLL_DECL mob_towering_infernalAI : public ScriptedAI if (pInstance) AnetheronGUID = pInstance->GetData64(DATA_ANETHERON); } - uint32 ImmolationTimer; uint32 CheckTimer; uint64 AnetheronGUID; ScriptedInstance* pInstance; - void Reset() { DoCast(m_creature, SPELL_INFERNO_EFFECT); ImmolationTimer = 5000; CheckTimer = 5000; } - void EnterCombat(Unit *who) { - } - void KilledUnit(Unit *victim) { - } - void JustDied(Unit *victim) { - } - void MoveInLineOfSight(Unit *who) { if (m_creature->IsWithinDist(who, 50) && !m_creature->isInCombat() && m_creature->IsHostileTo(who)) AttackStart(who); } - void UpdateAI(const uint32 diff) { if (CheckTimer < diff) @@ -277,26 +243,21 @@ struct TRINITY_DLL_DECL mob_towering_infernalAI : public ScriptedAI } CheckTimer = 5000; }else CheckTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - if (ImmolationTimer < diff) { DoCast(m_creature, SPELL_IMMOLATION); ImmolationTimer = 5000; }else ImmolationTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_towering_infernal(Creature* pCreature) { return new mob_towering_infernalAI (pCreature); } - void AddSC_boss_anetheron() { Script *newscript; @@ -304,7 +265,6 @@ void AddSC_boss_anetheron() newscript->Name = "boss_anetheron"; newscript->GetAI = &GetAI_boss_anetheron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_towering_infernal"; newscript->GetAI = &GetAI_mob_towering_infernal; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp index fa4c779d9b8..b2c4d377b8a 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp @@ -13,19 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Archimonde SD%Complete: 85 SDComment: Doomfires not completely offlike due to core limitations for random moving. Tyrande and second phase not fully implemented. SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ - #include "precompiled.h" #include "def_hyjal.h" #include "SpellAuras.h" #include "hyjal_trash.h" - //text id -1534018 are the text used when previous events complete. Not part of this script. #define SAY_AGGRO -1534019 #define SAY_DOOMFIRE1 -1534020 @@ -39,14 +36,11 @@ EndScriptData */ #define SAY_DEATH -1534028 #define SAY_SOUL_CHARGE1 -1534029 #define SAY_SOUL_CHARGE2 -1534030 - #define SPELL_DENOUEMENT_WISP 32124 #define SPELL_ANCIENT_SPARK 39349 #define SPELL_PROTECTION_OF_ELUNE 38528 - #define SPELL_DRAIN_WORLD_TREE 39140 #define SPELL_DRAIN_WORLD_TREE_2 39141 - #define SPELL_FINGER_OF_DEATH 31984 #define SPELL_HAND_OF_DEATH 35354 #define SPELL_AIR_BURST 32014 @@ -61,17 +55,14 @@ EndScriptData */ #define SPELL_UNLEASH_SOUL_GREEN 32057 #define SPELL_UNLEASH_SOUL_RED 32053 #define SPELL_FEAR 31970 - #define CREATURE_ARCHIMONDE 17968 #define CREATURE_DOOMFIRE 18095 #define CREATURE_DOOMFIRE_SPIRIT 18104 #define CREATURE_ANCIENT_WISP 17946 #define CREATURE_CHANNEL_TARGET 22418 - #define NORDRASSIL_X 5503.713 #define NORDRASSIL_Y -3523.436 #define NORDRASSIL_Z 1608.781 - struct mob_ancient_wispAI : public ScriptedAI { mob_ancient_wispAI(Creature* c) : ScriptedAI(c) @@ -79,25 +70,18 @@ struct mob_ancient_wispAI : public ScriptedAI pInstance = c->GetInstanceData(); ArchimondeGUID = 0; } - ScriptedInstance* pInstance; uint64 ArchimondeGUID; uint32 CheckTimer; - void Reset() { CheckTimer = 1000; - if (pInstance) ArchimondeGUID = pInstance->GetData64(DATA_ARCHIMONDE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void EnterCombat(Unit* who) {} - void DamageTaken(Unit* done_by, uint32 &damage) { damage = 0; } - void UpdateAI(const uint32 diff) { if (CheckTimer < diff) @@ -113,35 +97,28 @@ struct mob_ancient_wispAI : public ScriptedAI }else CheckTimer -= diff; } }; - /* This script is merely a placeholder for the Doomfire that triggers Doomfire spell. It will MoveChase the Doomfire Spirit always, until despawn (AttackStart is called upon it's spawn) */ struct TRINITY_DLL_DECL mob_doomfireAI : public ScriptedAI { mob_doomfireAI(Creature* c) : ScriptedAI(c) {} - void Reset() { } - void MoveInLineOfSight(Unit* who) { } void EnterCombat(Unit* who) { } void DamageTaken(Unit *done_by, uint32 &damage) { damage = 0; } }; - /* This is the script for the Doomfire Spirit Mob. This mob simply follow players or travels in random directions if target cannot be found. */ struct TRINITY_DLL_DECL mob_doomfire_targettingAI : public ScriptedAI { mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} - uint64 TargetGUID; uint32 ChangeTargetTimer; - void Reset() { TargetGUID = 0; ChangeTargetTimer = 5000; } - void MoveInLineOfSight(Unit* who) { //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 @@ -149,11 +126,8 @@ struct TRINITY_DLL_DECL mob_doomfire_targettingAI : public ScriptedAI if (!TargetGUID && who->GetTypeId() == TYPEID_PLAYER) TargetGUID = who->GetGUID(); } - void EnterCombat(Unit* who) {} - void DamageTaken(Unit *done_by, uint32 &damage) { damage = 0; } - void UpdateAI(const uint32 diff) { if (ChangeTargetTimer < diff) @@ -169,12 +143,10 @@ struct TRINITY_DLL_DECL mob_doomfire_targettingAI : public ScriptedAI m_creature->GetRandomNearPosition(pos, 40); m_creature->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); } - ChangeTargetTimer = 5000; }else ChangeTargetTimer -= diff; } }; - /* Finally, Archimonde's script. His script isn't extremely complex, most are simply spells on timers. The only complicated aspect of the battle is Finger of Death and Doomfire, with Doomfire being the hardest bit to code. Finger of Death is simply a distance check - if no one is in melee range, then @@ -182,19 +154,15 @@ struct TRINITY_DLL_DECL mob_doomfire_targettingAI : public ScriptedAI is NOT the main tank (creature's victim), then we aggro that player and they become the new victim. For Doomfire, we summon a mob (Doomfire Spirit) for the Doomfire mob to follow. It's spirit will randomly select it's target to follow and then we create the random movement making it unpredictable. */ - struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI { boss_archimondeAI(Creature *c) : hyjal_trashAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 DoomfireSpiritGUID; uint64 WorldTreeGUID; - uint32 DrainNordrassilTimer; uint32 FearTimer; uint32 AirBurstTimer; @@ -208,21 +176,17 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI uint32 WispCount; uint32 EnrageTimer; uint32 CheckDistanceTimer; - bool Enraged; bool BelowTenPercent; bool HasProtected; bool IsChanneling; - void Reset() { if (pInstance) pInstance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - DoomfireSpiritGUID = 0; damageTaken = 0; WorldTreeGUID = 0; - DrainNordrassilTimer = 0; FearTimer = 42000; AirBurstTimer = 30000; @@ -236,31 +200,25 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI EnrageTimer = 600000; // 10 minutes CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage SummonWispTimer = 0; - Enraged = false; BelowTenPercent = false; HasProtected = false; IsChanneling = false; } - void EnterCombat(Unit *who) { m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL); DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); - if (pInstance) pInstance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); - if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) GainSoulCharge(CAST_PLR(victim)); } - void GainSoulCharge(Player* victim) { switch(victim->getClass()) @@ -281,43 +239,35 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI victim->CastSpell(m_creature, SPELL_SOUL_CHARGE_GREEN, true); break; } - SoulChargeTimer = 2000 + rand()%28000; ++SoulChargeCount; } - void JustDied(Unit *victim) { hyjal_trashAI::JustDied(victim); DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); } - bool CanUseFingerOfDeath() { // First we check if our current victim is in melee range or not. Unit* victim = m_creature->getVictim(); if (victim && m_creature->IsWithinDistInMap(victim, m_creature->GetAttackDistance(victim))) return false; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return false; - std::list targets; std::list::iterator itr = m_threatlist.begin(); - for(; itr != m_threatlist.end(); ++itr) + for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->isAlive()) targets.push_back(pUnit); } - if (targets.empty()) return false; - targets.sort(ObjectDistanceOrder(m_creature)); Unit* target = targets.front(); if (target) @@ -327,10 +277,8 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI else // This target is closest, he is our new tank m_creature->AddThreat(target, m_creature->getThreatManager().getThreat(m_creature->getVictim())); } - return false; } - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) @@ -341,17 +289,14 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) { DoomfireSpiritGUID = summoned->GetGUID(); } - if (summoned->GetEntry() == CREATURE_DOOMFIRE) { summoned->CastSpell(summoned,SPELL_DOOMFIRE_SPAWN,false); summoned->CastSpell(summoned,SPELL_DOOMFIRE,true,0,0,m_creature->GetGUID()); - if (Unit *DoomfireSpirit = Unit::GetUnit(*m_creature, DoomfireSpiritGUID)) { summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit,0.0f,0.0f); @@ -359,27 +304,22 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI } } } - //this is code doing close to what the summoning spell would do (spell 31903) void SummonDoomfire(Unit* target) { m_creature->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); - m_creature->SummonCreature(CREATURE_DOOMFIRE, target->GetPositionX()-15.0,target->GetPositionY()-15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); } - void UnleashSoulCharge() { m_creature->InterruptNonMeleeSpells(false); - bool HasCast = false; uint32 chargeSpell = 0; uint32 unleashSpell = 0; - switch(rand()%3) { case 0: @@ -395,7 +335,6 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI unleashSpell = SPELL_UNLEASH_SOUL_GREEN; break; } - if (m_creature->HasAura(chargeSpell)) { m_creature->RemoveAuraFromStack(chargeSpell); @@ -403,11 +342,9 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI HasCast = true; SoulChargeCount--; } - if (HasCast) SoulChargeTimer = 2000 + rand()%28000; } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat()) @@ -426,16 +363,13 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI m_creature->SetVisibility(VISIBILITY_ON); } } - if (DrainNordrassilTimer < diff) { if (!IsChanneling) { Creature *temp = m_creature->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); - if (temp) WorldTreeGUID = temp->GetGUID(); - if (Unit *Nordrassil = Unit::GetUnit(*m_creature, WorldTreeGUID)) { Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -444,7 +378,6 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI IsChanneling = true; } } - if (Unit *Nordrassil = Unit::GetUnit(*m_creature, WorldTreeGUID)) { Nordrassil->CastSpell(m_creature, SPELL_DRAIN_WORLD_TREE_2, true); @@ -452,13 +385,10 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI } }else DrainNordrassilTimer -= diff; } - if (!UpdateVictim()) return; - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged) BelowTenPercent = true; - if (!Enraged) { if (EnrageTimer < diff) @@ -471,7 +401,6 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI DoScriptText(SAY_ENRAGE, m_creature); } }else EnrageTimer -= diff; - if (CheckDistanceTimer < diff) { // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature @@ -479,7 +408,6 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI if (Check) { Check->SetVisibility(VISIBILITY_OFF); - if (m_creature->IsWithinDistInMap(Check, 75)) { m_creature->GetMotionMaster()->Clear(false); @@ -491,31 +419,26 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI CheckDistanceTimer = 5000; }else CheckDistanceTimer -= diff; } - if (BelowTenPercent) { if (!HasProtected) { m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); - //all members of raid must get this buff DoCast(m_creature->getVictim(), SPELL_PROTECTION_OF_ELUNE); HasProtected = true; Enraged = true; } - if (SummonWispTimer < diff) { DoSpawnCreature(CREATURE_ANCIENT_WISP, rand()%40, rand()%40, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); SummonWispTimer = 1500; ++WispCount; }else SummonWispTimer -= diff; - if (WispCount >= 30) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - if (Enraged) { if (HandOfDeathTimer < diff) @@ -525,55 +448,45 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI }else HandOfDeathTimer -= diff; return; // Don't do anything after this point. } - if (SoulChargeCount) { if (SoulChargeTimer < diff) UnleashSoulCharge(); else SoulChargeTimer -= diff; } - if (GripOfTheLegionTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); GripOfTheLegionTimer = 5000 + rand()%20000; }else GripOfTheLegionTimer -= diff; - if (AirBurstTimer < diff) { if (rand()%2 == 0) DoScriptText(SAY_AIR_BURST1, m_creature); else DoScriptText(SAY_AIR_BURST2, m_creature); - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank AirBurstTimer = 25000 + rand()%15000; }else AirBurstTimer -= diff; - if (FearTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FEAR); FearTimer = 42000; }else FearTimer -= diff; - if (DoomfireTimer < diff) { if (rand()%2 == 0) DoScriptText(SAY_DOOMFIRE1, m_creature); else DoScriptText(SAY_DOOMFIRE2, m_creature); - Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!temp) temp = m_creature->getVictim(); - //replace with spell cast 31903 once implicitTarget 73 implemented SummonDoomfire(temp); - //supposedly three doomfire can be up at the same time DoomfireTimer = 20000; }else DoomfireTimer -= diff; - if (MeleeRangeCheckTimer < diff) { if (CanUseFingerOfDeath()) @@ -581,35 +494,28 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); MeleeRangeCheckTimer = 1000; } - MeleeRangeCheckTimer = 5000; }else MeleeRangeCheckTimer -= diff; - DoMeleeAttackIfReady(); } void WaypointReached(uint32 i){} }; - CreatureAI* GetAI_boss_archimonde(Creature* pCreature) { return new boss_archimondeAI (pCreature); } - CreatureAI* GetAI_mob_doomfire(Creature* pCreature) { return new mob_doomfireAI(pCreature); } - CreatureAI* GetAI_mob_doomfire_targetting(Creature* pCreature) { return new mob_doomfire_targettingAI(pCreature); } - CreatureAI* GetAI_mob_ancient_wisp(Creature* pCreature) { return new mob_ancient_wispAI(pCreature); } - void AddSC_boss_archimonde() { Script *newscript; @@ -617,17 +523,14 @@ void AddSC_boss_archimonde() newscript->Name = "boss_archimonde"; newscript->GetAI = &GetAI_boss_archimonde; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_doomfire"; newscript->GetAI = &GetAI_mob_doomfire; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_doomfire_targetting"; newscript->GetAI = &GetAI_mob_doomfire_targetting; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ancient_wisp"; newscript->GetAI = &GetAI_mob_ancient_wisp; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_azgalor.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_azgalor.cpp index a61d009284f..1e4280c182e 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_azgalor.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_azgalor.cpp @@ -2,31 +2,25 @@ #include "precompiled.h" #include "def_hyjal.h" #include "hyjal_trash.h" - #define SPELL_RAIN_OF_FIRE 31340 #define SPELL_DOOM 31347 #define SPELL_HOWL_OF_AZGALOR 31344 #define SPELL_CLEAVE 31345 #define SPELL_BERSERK 26662 - #define SAY_ONDEATH "Your time is almost... up" #define SOUND_ONDEATH 11002 - #define SAY_ONSLAY1 "Reesh, hokta!" #define SAY_ONSLAY2 "Don't fight it" #define SAY_ONSLAY3 "No one is going to save you" #define SOUND_ONSLAY1 11001 #define SOUND_ONSLAY2 11048 #define SOUND_ONSLAY3 11047 - #define SAY_DOOM1 "Just a taste... of what awaits you" #define SAY_DOOM2 "Suffer you despicable insect!" #define SOUND_DOOM1 11046 #define SOUND_DOOM2 11000 - #define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!" #define SOUND_ONAGGRO 10999 - struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI { boss_azgalorAI(Creature *c) : hyjal_trashAI(c) @@ -38,17 +32,14 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI if (TempSpell) TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?! } - uint32 RainTimer; uint32 DoomTimer; uint32 HowlTimer; uint32 CleaveTimer; uint32 EnrageTimer; bool enraged; - bool pGo; uint32 pos; - void Reset() { damageTaken = 0; @@ -58,11 +49,9 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI CleaveTimer = 10000; EnrageTimer = 600000; enraged = false; - if (pInstance && IsEvent) pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance && IsEvent) @@ -70,7 +59,6 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONAGGRO); m_creature->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); } - void KilledUnit(Unit *victim) { switch(rand()%3) @@ -89,7 +77,6 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI break; } } - void WaypointReached(uint32 i) { pos = i; @@ -100,7 +87,6 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI m_creature->AddThreat(target,0.0); } } - void JustDied(Unit *victim) { hyjal_trashAI::JustDied(victim); @@ -108,7 +94,6 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI pInstance->SetData(DATA_AZGALOREVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); } - void UpdateAI(const uint32 diff) { if (IsEvent) @@ -133,35 +118,29 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI } } } - //Return since we have no target if (!UpdateVictim()) return; - if (RainTimer < diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE); RainTimer = 20000+rand()%15000; }else RainTimer -= diff; - if (DoomTimer < diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank DoomTimer = 45000+rand()%5000; }else DoomTimer -= diff; - if (HowlTimer < diff) { DoCast(m_creature, SPELL_HOWL_OF_AZGALOR); HowlTimer = 30000; }else HowlTimer -= diff; - if (CleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); CleaveTimer = 10000+rand()%5000; }else CleaveTimer -= diff; - if (EnrageTimer < diff && !enraged) { m_creature->InterruptNonMeleeSpells(false); @@ -169,20 +148,16 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI enraged = true; EnrageTimer = 600000; }else EnrageTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_azgalor(Creature* pCreature) { return new boss_azgalorAI (pCreature); } - #define SPELL_THRASH 12787 #define SPELL_CRIPPLE 31406 #define SPELL_WARSTOMP 31408 - struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI { mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c) @@ -191,13 +166,11 @@ struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI if (pInstance) AzgalorGUID = pInstance->GetData64(DATA_AZGALOR); } - uint32 CrippleTimer; uint32 WarstompTimer; uint32 CheckTimer; uint64 AzgalorGUID; ScriptedInstance* pInstance; - void Reset() { CrippleTimer = 50000; @@ -205,32 +178,23 @@ struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI DoCast(m_creature, SPELL_THRASH); CheckTimer = 5000; } - void EnterCombat(Unit *who) { } - void KilledUnit(Unit *victim) { - } - void WaypointReached(uint32 i) { - } - void MoveInLineOfSight(Unit *who) { if (m_creature->IsWithinDist(who, 50) && !m_creature->isInCombat() && m_creature->IsHostileTo(who)) AttackStart(who); } - void JustDied(Unit *victim) { - } - void UpdateAI(const uint32 diff) { if (CheckTimer < diff) @@ -247,32 +211,26 @@ struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI } CheckTimer = 5000; }else CheckTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - if (WarstompTimer < diff) { DoCast(m_creature, SPELL_WARSTOMP); WarstompTimer = 10000+rand()%5000; }else WarstompTimer -= diff; - if (CrippleTimer < diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,100,true), SPELL_CRIPPLE); CrippleTimer = 25000+rand()%5000; }else CrippleTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_lesser_doomguard(Creature* pCreature) { return new mob_lesser_doomguardAI (pCreature); } - void AddSC_boss_azgalor() { Script *newscript; @@ -280,7 +238,6 @@ void AddSC_boss_azgalor() newscript->Name = "boss_azgalor"; newscript->GetAI = &GetAI_boss_azgalor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_lesser_doomguard"; newscript->GetAI = &GetAI_mob_lesser_doomguard; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp index d3f87daec28..57d88073fa1 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp @@ -2,28 +2,22 @@ #include "precompiled.h" #include "def_hyjal.h" #include "hyjal_trash.h" - #define SPELL_CLEAVE 31436 #define SPELL_WARSTOMP 31480 #define SPELL_MARK 31447 - #define SOUND_ONDEATH 11018 - #define SAY_ONSLAY1 "Shaza-Kiel!" #define SAY_ONSLAY2 "You... are nothing!" #define SAY_ONSLAY3 "Miserable nuisance!" #define SOUND_ONSLAY1 11017 #define SOUND_ONSLAY2 11053 #define SOUND_ONSLAY3 11054 - #define SAY_MARK1 "Your death will be a painful one." #define SAY_MARK2 "You... are marked." #define SOUND_MARK1 11016 #define SOUND_MARK2 11052 - #define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit." #define SOUND_ONAGGRO 11015 - struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI { boss_kazrogalAI(Creature *c) : hyjal_trashAI(c) @@ -38,14 +32,12 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI TempSpell->EffectImplicitTargetB[0] = 0; } } - uint32 CleaveTimer; uint32 WarStompTimer; uint32 MarkTimer; uint32 MarkTimerBase; bool pGo; uint32 pos; - void Reset() { damageTaken = 0; @@ -53,11 +45,9 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI WarStompTimer = 15000; MarkTimer = 45000; MarkTimerBase = 45000; - if (pInstance && IsEvent) pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance && IsEvent) @@ -65,7 +55,6 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONAGGRO); m_creature->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); } - void KilledUnit(Unit *victim) { switch(rand()%3) @@ -84,7 +73,6 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI break; } } - void WaypointReached(uint32 i) { pos = i; @@ -95,7 +83,6 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI m_creature->AddThreat(target,0.0); } } - void JustDied(Unit *victim) { hyjal_trashAI::JustDied(victim); @@ -103,7 +90,6 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI pInstance->SetData(DATA_KAZROGALEVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); } - void UpdateAI(const uint32 diff) { if (IsEvent) @@ -128,32 +114,27 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI } } } - //Return since we have no target if (!UpdateVictim()) return; - if (CleaveTimer < diff) { DoCast(m_creature, SPELL_CLEAVE); CleaveTimer = 6000+rand()%15000; }else CleaveTimer -= diff; - if (WarStompTimer < diff) { DoCast(m_creature, SPELL_WARSTOMP); WarStompTimer = 60000; }else WarStompTimer -= diff; - if (m_creature->HasAura(SPELL_MARK)) m_creature->RemoveAurasDueToSpell(SPELL_MARK); if (MarkTimer < diff) { //cast dummy, useful for bos addons m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); - std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA) @@ -177,16 +158,13 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI break; } }else MarkTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_kazrogal(Creature* pCreature) { return new boss_kazrogalAI (pCreature); } - void AddSC_boss_kazrogal() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_rage_winterchill.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_rage_winterchill.cpp index da0d6c2dd5a..856b8b374cb 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_rage_winterchill.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/boss_rage_winterchill.cpp @@ -2,34 +2,26 @@ #include "precompiled.h" #include "def_hyjal.h" #include "hyjal_trash.h" - #define SPELL_FROST_ARMOR 31256 #define SPELL_DEATH_AND_DECAY 31258 - #define SPELL_FROST_NOVA 31250 #define SPELL_ICEBOLT 31249 - #define SAY_ONDEATH "You have won this battle, but not... the... war" #define SOUND_ONDEATH 11026 - #define SAY_ONSLAY1 "All life must perish!" #define SAY_ONSLAY2 "Victory to the Legion!" #define SOUND_ONSLAY1 11025 #define SOUND_ONSLAY2 11057 - #define SAY_DECAY1 "Crumble and rot!" #define SAY_DECAY2 "Ashes to ashes, dust to dust" #define SOUND_DECAY1 11023 #define SOUND_DECAY2 11055 - #define SAY_NOVA1 "Succumb to the icy chill... of death!" #define SAY_NOVA2 "It will be much colder in your grave" #define SOUND_NOVA1 11024 #define SOUND_NOVA2 11058 - #define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!" #define SOUND_ONAGGRO 11022 - struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI { boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c) @@ -38,14 +30,12 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI pGo = false; pos = 0; } - uint32 FrostArmorTimer; uint32 DecayTimer; uint32 NovaTimer; uint32 IceboltTimer; bool pGo; uint32 pos; - void Reset() { damageTaken = 0; @@ -53,11 +43,9 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI DecayTimer = 45000; NovaTimer = 15000; IceboltTimer = 10000; - if (pInstance && IsEvent) pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance && IsEvent) @@ -65,7 +53,6 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONAGGRO); m_creature->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); } - void KilledUnit(Unit *victim) { switch(rand()%2) @@ -80,7 +67,6 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI break; } } - void WaypointReached(uint32 i) { pos = i; @@ -91,7 +77,6 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI m_creature->AddThreat(target,0.0); } } - void JustDied(Unit *victim) { hyjal_trashAI::JustDied(victim); @@ -100,7 +85,6 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI DoPlaySoundToSet(m_creature, SOUND_ONDEATH); m_creature->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL); } - void UpdateAI(const uint32 diff) { if (IsEvent) @@ -125,11 +109,9 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI } } } - //Return since we have no target if (!UpdateVictim()) return; - if (FrostArmorTimer < diff) { DoCast(m_creature, SPELL_FROST_ARMOR); @@ -172,16 +154,13 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT); IceboltTimer = 11000+rand()%20000; }else IceboltTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_rage_winterchill(Creature* pCreature) { return new boss_rage_winterchillAI (pCreature); } - void AddSC_boss_rage_winterchill() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/def_hyjal.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/def_hyjal.h index bf2d6d99f90..7aa8c9d5517 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/def_hyjal.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/def_hyjal.h @@ -1,18 +1,14 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_HYJAL_H #define DEF_HYJAL_H - #define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy" - enum eTypes { WORLD_STATE_WAVES = 2842, WORLD_STATE_ENEMY = 2453, WORLD_STATE_ENEMYCOUNT = 2454, - DATA_ANETHERON = 1, DATA_ANETHERONEVENT = 2, DATA_ARCHIMONDE = 3, diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal.cpp index eb6e72452c0..e34eb7446fd 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal.cpp @@ -13,65 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Hyjal SD%Complete: 80 SDComment: gossip text id's unknown SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ - /* ContentData npc_jaina_proudmoore npc_thrall npc_tyrande_whisperwind EndContentData */ - #include "precompiled.h" #include "hyjalAI.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." - #define GOSSIP_ITEM_BEGIN_HORDE "I am with you, Thrall." #define GOSSIP_ITEM_AZGALOR "We have nothing to fear." - #define GOSSIP_ITEM_RETREAT "We can't keep this up. Let's retreat!" - #define GOSSIP_ITEM_TYRANDE "Aid us in defending Nordrassil" #define ITEM_TEAR_OF_GODDESS 24494 - #define GOSSIP_ITEM_GM1 "[GM] Toggle Debug Timers" - CreatureAI* GetAI_npc_jaina_proudmoore(Creature* pCreature) { hyjalAI* ai = new hyjalAI(pCreature); - ai->Reset(); ai->EnterEvadeMode(); - ai->Spell[0].SpellId = SPELL_BLIZZARD; ai->Spell[0].Cooldown = 15000 + rand()%20000; ai->Spell[0].TargetType = TARGETTYPE_RANDOM; - ai->Spell[1].SpellId = SPELL_PYROBLAST; ai->Spell[1].Cooldown = 5500 + rand()%4000; ai->Spell[1].TargetType = TARGETTYPE_RANDOM; - ai->Spell[2].SpellId = SPELL_SUMMON_ELEMENTALS; ai->Spell[2].Cooldown = 15000 + rand()%30000; ai->Spell[2].TargetType = TARGETTYPE_SELF; - return ai; } - bool GossipHello_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature) { hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); if (ai->EventBegun) return false; - uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT); uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT); if (RageEncounter == NOT_STARTED) @@ -80,14 +64,11 @@ bool GossipHello_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ANETHERON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); else if (RageEncounter == DONE && AnetheronEncounter == DONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - if (pPlayer->isGameMaster()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); @@ -111,31 +92,24 @@ bool GossipSelect_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uin } return true; } - CreatureAI* GetAI_npc_thrall(Creature* pCreature) { hyjalAI* ai = new hyjalAI(pCreature); - ai->Reset(); ai->EnterEvadeMode(); - ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING; ai->Spell[0].Cooldown = 3000 + rand()%5000; ai->Spell[0].TargetType = TARGETTYPE_VICTIM; - ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF; ai->Spell[1].Cooldown = 6000 + rand()%35000; ai->Spell[1].TargetType = TARGETTYPE_RANDOM; - return ai; } - bool GossipHello_npc_thrall(Player* pPlayer, Creature* pCreature) { hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); if (ai->EventBegun) return false; - uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); // Only let them start the Horde phases if Anetheron is dead. if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) @@ -149,14 +123,11 @@ bool GossipHello_npc_thrall(Player* pPlayer, Creature* pCreature) else if (AzgalorEvent == DONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); } - if (pPlayer->isGameMaster()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_thrall(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); @@ -181,7 +152,6 @@ bool GossipSelect_npc_thrall(Player* pPlayer, Creature* pCreature, uint32 uiSend } return true; } - CreatureAI* GetAI_npc_tyrande_whisperwind(Creature* pCreature) { hyjalAI* ai = new hyjalAI(pCreature); @@ -189,19 +159,16 @@ CreatureAI* GetAI_npc_tyrande_whisperwind(Creature* pCreature) ai->EnterEvadeMode(); return ai; } - bool GossipHello_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature) { hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - // Only let them get item if Azgalor is dead. if (AzgalorEvent == DONE && !pPlayer->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -219,25 +186,21 @@ bool GossipSelect_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature, } return true; } - void AddSC_hyjal() { Script *newscript; - newscript = new Script; newscript->Name = "npc_jaina_proudmoore"; newscript->GetAI = &GetAI_npc_jaina_proudmoore; newscript->pGossipHello = &GossipHello_npc_jaina_proudmoore; newscript->pGossipSelect = &GossipSelect_npc_jaina_proudmoore; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_thrall"; newscript->GetAI = &GetAI_npc_thrall; newscript->pGossipHello = &GossipHello_npc_thrall; newscript->pGossipSelect = &GossipSelect_npc_thrall; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tyrande_whisperwind"; newscript->pGossipHello = &GossipHello_npc_tyrande_whisperwind; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp index e8bf7d8ceeb..f408f7b3bf1 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: HyjalAI SD%Complete: 90 SDComment: SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ - #include "precompiled.h" #include "hyjalAI.h" #include "hyjal_trash.h" @@ -28,13 +26,10 @@ EndScriptData */ #include "Language.h" #include "Chat.h" #include "Object.h" - #define SPAWN_GARG_GATE 0 #define SPAWN_WYRM_GATE 1 #define SPAWN_NEAR_TOWER 2 - #define YELL_HURRY "Hurry, we don't have much time" - // Locations for summoning gargoyls and frost wyrms in special cases float SpawnPointSpecial[3][3]= { @@ -42,7 +37,6 @@ float SpawnPointSpecial[3][3]= {5624.53, -2548.12, 1551.54}, //spawn point for the frost wyrm near the horde gate {5604.41, -2811.98, 1547.77} //spawn point for the gargoyles and wyrms near the horde tower }; - // Locations for summoning waves in Alliance base float AllianceBase[4][3]= { @@ -51,14 +45,12 @@ float AllianceBase[4][3]= {4928.41, -1510.35, 1327.99}, {4938.35, -1521.00, 1326.69} }; - float JainaDummySpawn[2][4]= { {5497.01, -2719.03, 1483.08, 2.90426}, {5484.98, -2721.69, 1483.39, 6.00656} }; - // Locations for summoning waves in Horde base float HordeBase[4][3]= { @@ -67,14 +59,12 @@ float HordeBase[4][3]= {5468.45, -2355.13, 1459.99}, {5479.06, -2344.16, 1461.74} }; - // Lady Jaina's waypoints when retreathing float JainaWPs[2][3]= { {5078.56, -1789.79, 1320.73},//next to the small stairs {5037.38, -1778.39, 1322.61},//center of alliance base }; - float InfernalPos[8][3]=//spawn points for the infernals in the horde base { {5453.59, -2764.52, 1493.50}, @@ -86,7 +76,6 @@ float InfernalPos[8][3]=//spawn points for the infernals in the horde base {5510.16, -2691.75, 1479.66}, {5482.39, -2689.19, 1481.09} }; - float InfernalSPWP[26][4]=//spawn points for the infernals in the horde base used in the cleaning wave { {5490.96, -2718.72, 1482.96, 0.49773}, @@ -116,7 +105,6 @@ float InfernalSPWP[26][4]=//spawn points for the infernals in the horde base use {5549.76, -2692.93, 1482.68, 2.19414}, {5459.78, -2755.71, 1490.68, 1.05139} }; - float VeinPos[14][8]=//spawn points of the ancient gem veins { {5184.84, -1982.59, 1382.66, 2.58079, 0, 0, 0.960944, 0.276742}, //alliance @@ -134,7 +122,6 @@ float VeinPos[14][8]=//spawn points of the ancient gem veins {5374.3, -3420.59, 1653.43, 1.45762, 0, 0, 0.665981, 0.745969}, //horde {5441.54, -3321.59, 1651.55, 0.258306, 0, 0, 0.128794, 0.991671} //horde }; - float AllianceOverrunGargPos[5][4]=//gargoyle spawn points in the alliance overrun { {5279.94, -2049.68, 1311.38, 0},//garg1 @@ -143,7 +130,6 @@ float AllianceOverrunGargPos[5][4]=//gargoyle spawn points in the alliance overr {5071.52, -2425.63, 1454.48, 5.54},//garg4 {5120.65, -2467.92, 1463.93, 2.54}//garg5 }; - float AllianceFirePos[92][8]=//spawn points for the fire visuals (GO) in the alliance base { {5039.9, -1796.84, 1323.88, 2.59222, 0, 0, 0.962511, 0.271243}, @@ -239,7 +225,6 @@ float AllianceFirePos[92][8]=//spawn points for the fire visuals (GO) in the all {5332.5 , -2181.28, 1279.95, 4.6906, 0, 0, 0.714768, -0.699362}, {5108.2 , -2429.84, 1427.73, 4.5194, 0, 0, 0.771943, -0.635691} }; - float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde base { {5524.11, -2612.73, 1483.38, 1.96198, 0, 0, 0.831047, 0.556202}, @@ -308,13 +293,12 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde {5534.15, -2679.35, 1483.61, 0.428685, 0, 0, 0.212705, 0.977116}, {5545.43, -2647.82, 1483.05, 5.38848, 0, 0, 0.432578, -0.901596} }; - hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(m_creature) { pInstance = c->GetInstanceData(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; - for(uint8 i=0;i<14; ++i) + for (uint8 i=0; i<14; ++i) VeinGUID[i] = 0; InfernalCount = 0; TeleportTimer = 1000; @@ -330,17 +314,14 @@ hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(m_creature) MassTeleportTimer = 0; DoMassTeleport = false; } - void hyjalAI::JustSummoned(Creature *summoned) { Summons.Summon(summoned); } - void hyjalAI::SummonedCreatureDespawn(Creature* summoned) { Summons.Despawn(summoned); } - void hyjalAI::Reset() { IsDummy = false; @@ -349,16 +330,13 @@ void hyjalAI::Reset() PlayerGUID = 0; BossGUID[0] = 0; BossGUID[1] = 0; - // Timers NextWaveTimer = 10000; CheckTimer = 0; RetreatTimer = 1000; - // Misc WaveCount = 0; EnemyCount = 0; - // Set faction properly based on Creature entry switch(m_creature->GetEntry()) { @@ -366,16 +344,13 @@ void hyjalAI::Reset() Faction = 0; DoCast(m_creature, SPELL_BRILLIANCE_AURA, true); break; - case THRALL: Faction = 1; break; - case TYRANDE: Faction = 2; break; } - //Bools EventBegun = false; FirstBossDead = false; @@ -384,15 +359,11 @@ void hyjalAI::Reset() bRetreat = false; Debug = false; - //Flags m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - //Initialize spells memset(Spell, 0, sizeof(Spell)); - - //Reset Instance Data for trash count if (pInstance) { @@ -405,11 +376,9 @@ void hyjalAI::Reset() pInstance->SetData(DATA_RESET_TRASH_COUNT, 0); } }else error_log(ERROR_INST_DATA); - //Visibility DoHide = true; } - void hyjalAI::EnterEvadeMode() { if (m_creature->GetEntry() != JAINA) @@ -417,37 +386,30 @@ void hyjalAI::EnterEvadeMode() m_creature->DeleteThreatList(); m_creature->CombatStop(true); m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); } - void hyjalAI::EnterCombat(Unit *who) { - if (IsDummy)return; - for(uint8 i = 0; i < 3; ++i) + if (IsDummy) + return; + for (uint8 i = 0; i < 3; ++i) if (Spell[i].Cooldown) SpellTimer[i] = Spell[i].Cooldown; - Talk(ATTACKED); } - void hyjalAI::MoveInLineOfSight(Unit *who) { if (IsDummy) return; - npc_escortAI::MoveInLineOfSight(who); } - void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) { uint32 random = rand()%4; float SpawnLoc[3]; - - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { SpawnLoc[i] = Base[random][i]; } @@ -455,13 +417,14 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) switch(entry) { case 17906: //GARGOYLE - if (!FirstBossDead && (WaveCount == 1 || WaveCount == 3)) {//summon at tower pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (pCreature) CAST_AI(hyjal_trashAI, pCreature->AI())->useFlyPath = true; - }else{//summon at gate + } + else + {//summon at gate pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); } break; @@ -469,7 +432,9 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) if (FirstBossDead && WaveCount == 1) {//summon at gate pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_WYRM_GATE][0],SpawnPointSpecial[SPAWN_WYRM_GATE][1],SpawnPointSpecial[SPAWN_WYRM_GATE][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); - }else{ + } + else + { pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1],SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (pCreature) CAST_AI(hyjal_trashAI, pCreature->AI())->useFlyPath = true; @@ -483,14 +448,11 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) default: pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); break; - } - if (pCreature) { // Increment Enemy Count to be used in World States and instance script ++EnemyCount; - pCreature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pCreature->setActive(true); switch(entry) @@ -525,40 +487,33 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) } } } - void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]) { // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike. if (rand()%4 == 0) Talk(RALLY); - if (!pInstance) { error_log(ERROR_INST_DATA); return; } InfernalCount = 0;//reset infernal count every new wave - EnemyCount = pInstance->GetData(DATA_TRASH); - for(uint8 i = 0; i < 18; ++i) + for (uint8 i = 0; i < 18; ++i) { if (wave[Count].Mob[i]) SummonCreature(wave[Count].Mob[i], Base); } - if (!wave[Count].IsBoss) { uint32 stateValue = Count+1; if (FirstBossDead) stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8 - // Set world state to our current wave number pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number // Enable world state pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state - pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count - if (!Debug) NextWaveTimer = wave[Count].WaveTimer; else @@ -572,51 +527,39 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]) // Set world state for waves to 0 to disable it. pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, 0); pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); - // Set World State for enemies invading to 1. pInstance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); - Summon = false; } CheckTimer = 5000; } - void hyjalAI::StartEvent(Player* pPlayer) { if (!pPlayer || IsDummy || !pInstance) return; - Talk(BEGIN); - EventBegun = true; Summon = true; - NextWaveTimer = 15000; CheckTimer = 5000; PlayerGUID = pPlayer->GetGUID(); - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, 0); pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); pInstance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); - DeSpawnVeins(); } - uint32 hyjalAI::GetInstanceData(uint32 Event) { if (pInstance) return pInstance->GetData(Event); else error_log(ERROR_INST_DATA); - return 0; } - void hyjalAI::Talk(uint32 id) { std::list index; - for(uint8 i = 0; i < 9; ++i) + for (uint8 i = 0; i < 9; ++i) { if (Faction == 0) // Alliance { @@ -629,12 +572,9 @@ void hyjalAI::Talk(uint32 id) index.push_back(i); } } - if (index.empty()) return; // No quotes found, no use to continue - uint8 ind = *(index.begin()) + rand()%index.size(); - int32 YellId = 0; if (Faction == 0) // Alliance { @@ -644,17 +584,14 @@ void hyjalAI::Talk(uint32 id) { YellId = ThrallQuotes[ind].textid; } - if (YellId) DoScriptText(YellId, m_creature); } - void hyjalAI::Retreat() { if (pInstance) { pInstance->SetData(TYPE_RETREAT,SPECIAL); - if (Faction == 0) { pInstance->SetData(DATA_ALLIANCE_RETREAT, 1); @@ -682,12 +619,11 @@ void hyjalAI::Retreat() Overrun = true; m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started } - void hyjalAI::SpawnVeins() { if (Faction == 0) { - if (VeinsSpawned[0])//prevent any buggers + if (VeinsSpawned[0]) //prevent any buggers return; for (uint8 i = 0; i<7; ++i) { @@ -696,7 +632,9 @@ void hyjalAI::SpawnVeins() VeinGUID[i]=gem->GetGUID(); } VeinsSpawned[0] = true; - }else{ + } + else + { if (VeinsSpawned[1]) return; for (uint8 i = 7; i<14; ++i) @@ -708,7 +646,6 @@ void hyjalAI::SpawnVeins() VeinsSpawned[1] = true; } } - void hyjalAI::DeSpawnVeins() { if (!pInstance) @@ -737,7 +674,6 @@ void hyjalAI::DeSpawnVeins() } } } - void hyjalAI::UpdateAI(const uint32 diff) { if (IsDummy) @@ -760,9 +696,8 @@ void hyjalAI::UpdateAI(const uint32 diff) m_creature->SetVisibility(VISIBILITY_OFF); HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY()); HideNearPos(5037.76, -1889.71); - for(uint8 i = 0; i < 92; ++i)//summon fires + for (uint8 i = 0; i < 92; ++i) //summon fires m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0); - } else m_creature->SetVisibility(VISIBILITY_ON); break; @@ -773,9 +708,8 @@ void hyjalAI::UpdateAI(const uint32 diff) HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY()); HideNearPos(5563, -2763.19); HideNearPos(5542.2, -2629.36); - for(uint8 i = 0; i < 65; ++i)//summon fires + for (uint8 i = 0; i < 65; ++i) //summon fires m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0); - } else m_creature->SetVisibility(VISIBILITY_ON); break; @@ -796,7 +730,9 @@ void hyjalAI::UpdateAI(const uint32 diff) RespawnNearPos(5542.2, -2629.36); } m_creature->SetVisibility(VISIBILITY_ON); - }else{ + } + else + { RespawnTimer -= diff; m_creature->SetVisibility(VISIBILITY_OFF); } @@ -825,10 +761,8 @@ void hyjalAI::UpdateAI(const uint32 diff) m_creature->SetVisibility(VISIBILITY_OFF); }else RetreatTimer -= diff; } - if (!EventBegun) return; - if (Summon) { if (pInstance && EnemyCount) @@ -837,7 +771,6 @@ void hyjalAI::UpdateAI(const uint32 diff) if (!EnemyCount) NextWaveTimer = 5000; } - if (NextWaveTimer < diff) { if (Faction == 0) @@ -847,10 +780,9 @@ void hyjalAI::UpdateAI(const uint32 diff) ++WaveCount; }else NextWaveTimer -= diff; } - if (CheckTimer < diff) { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (BossGUID[i]) { @@ -878,11 +810,9 @@ void hyjalAI::UpdateAI(const uint32 diff) } CheckTimer = 5000; }else CheckTimer -= diff; - if (!UpdateVictim()) return; - - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { if (Spell[i].SpellId) { @@ -890,16 +820,13 @@ void hyjalAI::UpdateAI(const uint32 diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - Unit* target = NULL; - switch(Spell[i].TargetType) { case TARGETTYPE_SELF: target = m_creature; break; case TARGETTYPE_RANDOM: target = SelectUnit(SELECT_TARGET_RANDOM, 0); break; case TARGETTYPE_VICTIM: target = m_creature->getVictim(); break; } - if (target && target->isAlive()) { DoCast(target, Spell[i].SpellId); @@ -908,7 +835,6 @@ void hyjalAI::UpdateAI(const uint32 diff) }else SpellTimer[i] -= diff; } } - DoMeleeAttackIfReady(); } void hyjalAI::JustDied(Unit* killer) @@ -939,7 +865,6 @@ void hyjalAI::HideNearPos(float x, float y) Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - // First get all creatures. std::list creatures; Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature); @@ -947,14 +872,12 @@ void hyjalAI::HideNearPos(float x, float y) TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); - CellLock cell_lock(cell, pair); // Get Creatures cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap())); - if (!creatures.empty()) { - for(std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) + for (std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) { (*itr)->SetVisibility(VISIBILITY_OFF); (*itr)->setFaction(35);//make them friendly so mobs won't attack them @@ -967,7 +890,6 @@ void hyjalAI::RespawnNearPos(float x, float y) Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::RespawnDo u_do; Trinity::WorldObjectWorker worker(m_creature, u_do); TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); @@ -999,7 +921,6 @@ void hyjalAI::WaypointReached(uint32 i) Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - // First get all creatures. std::list creatures; Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature); @@ -1007,13 +928,11 @@ void hyjalAI::WaypointReached(uint32 i) TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap())); - if (!creatures.empty()) { - for(std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) + for (std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) { if ((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA) { @@ -1042,20 +961,17 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - std::list creatures; Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature); Trinity::CreatureListSearcher creature_searcher(m_creature, creatures, creature_check); TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); - CellLock cell_lock(cell, pair); cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap())); - if (!creatures.empty()) { - for(std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) + for (std::list::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) { if ((*itr) && (*itr)->isAlive()) { @@ -1068,7 +984,6 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) bRetreat = true; RetreatTimer = 1000; } - WaitForTeleport = false; Teleported = true; }TeleportTimer -= diff; @@ -1079,10 +994,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) switch(faction) { case 0://alliance - for(uint8 i = 0; i < 92; ++i)//summon fires + for (uint8 i = 0; i < 92; ++i) //summon fires m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0); - - for(uint8 i = 0; i < 25; ++i)//summon 25 ghouls + for (uint8 i = 0; i < 25; ++i) //summon 25 ghouls { uint8 r = rand()%4; Creature* pUnit = m_creature->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); @@ -1094,7 +1008,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) pUnit->setActive(true); } } - for(uint8 i = 0; i < 3; ++i)//summon 3 abominations + for (uint8 i = 0; i < 3; ++i) //summon 3 abominations { uint8 r = rand()%4; Creature* pUnit = m_creature->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); @@ -1106,7 +1020,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) pUnit->setActive(true); } } - for(uint8 i = 0; i < 5; ++i)//summon 5 gargoyles + for (uint8 i = 0; i < 5; ++i) //summon 5 gargoyles { Creature* pUnit = m_creature->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (pUnit) @@ -1120,10 +1034,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) } break; case 1://horde - for(uint8 i = 0; i < 65; ++i)//summon fires + for (uint8 i = 0; i < 65; ++i) //summon fires m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0); - - for(uint8 i = 0; i < 26; ++i)//summon infernals + for (uint8 i = 0; i < 26; ++i) //summon infernals { Creature* pUnit = m_creature->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (pUnit) @@ -1135,7 +1048,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) pUnit->setActive(true); } } - for(uint8 i = 0; i < 25; ++i)//summon 25 ghouls + for (uint8 i = 0; i < 25; ++i) //summon 25 ghouls { uint8 r = rand()%4; Creature* pUnit = m_creature->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15,15), HordeBase[r][1]+irand(-15,15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); @@ -1147,7 +1060,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) pUnit->setActive(true); } } - for(uint8 i = 0; i < 5; ++i)//summon 5 abominations + for (uint8 i = 0; i < 5; ++i) //summon 5 abominations { uint8 r = rand()%4; Creature* pUnit = m_creature->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15,15), HordeBase[r][1]+irand(-15,15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.h index c646c47699c..3a2a189d311 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.h @@ -1,13 +1,10 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_HYJALAI_H #define SC_HYJALAI_H - #include "def_hyjal.h" #include "escort_ai.h" - // Trash Mobs summoned in waves #define NECROMANCER 17899//done #define ABOMINATION 17898//done @@ -18,41 +15,33 @@ #define FROST_WYRM 17907//done #define GIANT_INFERNAL 17908//done #define FEL_STALKER 17916//done - #define JAINA 17772 #define THRALL 17852 #define TYRANDE 17948 - #define ANCIENT_VEIN 185557 #define FLAMEOBJECT 182592 - // Bosses summoned after every 8 waves #define RAGE_WINTERCHILL 17767 #define ANETHERON 17808 #define KAZROGAL 17888 #define AZGALOR 17842 #define ARCHIMONDE 17968 - #define SPELL_TELEPORT_VISUAL 41232 #define SPELL_MASS_TELEPORT 16807 - //Spells for Jaina #define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon(it should, but is removed in evade..) #define SPELL_BLIZZARD 31266 #define SPELL_PYROBLAST 31263 #define SPELL_SUMMON_ELEMENTALS 31264 - //Thrall spells #define SPELL_CHAIN_LIGHTNING 31330 #define SPELL_SUMMON_DIRE_WOLF 31331 - struct Wave { uint32 Mob[18]; // Stores Creature Entries to be summoned in Waves uint32 WaveTimer; // The timer before the next wave is summoned bool IsBoss; // Simply used to inform the wave summoner that the next wave contains a boss to halt all waves after that }; - static Wave AllianceWaves[]= // Waves that will be summoned in the Alliance Base { // Rage Winterchill Wave 1-8 {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false}, @@ -77,7 +66,6 @@ static Wave AllianceWaves[]= // Waves that will b // All 8 Waves are summoned, summon Anatheron {ANETHERON, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true} }; - static Wave HordeWaves[]= // Waves that are summoned in the Horde base { // Kaz'Rogal Wave 1-8 {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 180000, false}, @@ -102,20 +90,17 @@ static Wave HordeWaves[]= // Waves that are su // All 8 Waves are summoned, summon Azgalor {AZGALOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true} }; - enum TargetType // Used in the spell cast system for the AI { TARGETTYPE_SELF = 0, TARGETTYPE_RANDOM = 1, TARGETTYPE_VICTIM = 2, }; - struct Yells { uint32 id; // Used to determine the type of yell (attack, rally, etc) int32 textid; // The text id to be yelled }; - enum YellId { ATTACKED = 0, // Used when attacked and set in combat @@ -126,7 +111,6 @@ enum YellId SUCCESS = 5, // Used when the raid has sucessfully defeated a wave phase DEATH = 6, // Used on death }; - static Yells JainaQuotes[]= { {ATTACKED, -1534000}, @@ -139,7 +123,6 @@ static Yells JainaQuotes[]= {SUCCESS, -1534007}, {DEATH, -1534008}, }; - static Yells ThrallQuotes[]= { {ATTACKED, -1534009}, @@ -152,28 +135,19 @@ static Yells ThrallQuotes[]= {SUCCESS, -1534016}, {DEATH, -1534017}, }; - struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI { hyjalAI(Creature *c); - void Reset(); // Generically used to reset our variables. Do *not* call in EnterEvadeMode as this may make problems if the raid is still in combat - void EnterEvadeMode(); // Send creature back to spawn location and evade. - void EnterCombat(Unit *who); // Used to reset cooldowns for our spells and to inform the raid that we're under attack - void UpdateAI(const uint32 diff); // Called to summon waves, check for boss deaths and to cast our spells. - void JustDied(Unit* killer); // Called on death, informs the raid that they have failed. - void SetFaction(uint32 _faction) // Set the faction to either Alliance or Horde in Hyjal { Faction = _faction; } - void Retreat(); // "Teleport" (teleport visual + set invisible) all friendly creatures away from the base. - void SpawnVeins(); void DeSpawnVeins(); void JustSummoned(Creature *summoned); @@ -183,32 +157,23 @@ struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI void WaypointReached(uint32 i); void DoOverrun(uint32 faction, const uint32 diff); void MoveInLineOfSight(Unit *who); - void SummonCreature(uint32 entry, float Base[4][3]); // Summons a creature for that wave in that base - // Summons the next wave, calls SummonCreature void SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]); - void StartEvent(Player* player); // Begins the event by gossip click - uint32 GetInstanceData(uint32 Event); // Gets instance data for this instance, used to check if raid has gotten past a certain point and can access the next phase - void Talk(uint32 id); // Searches for the appropriate yell and sound and uses it to inform the raid of various things - public: ScriptedInstance* pInstance; - uint64 PlayerGUID; uint64 BossGUID[2]; uint64 VeinGUID[14]; - uint32 NextWaveTimer; uint32 WaveCount; uint32 CheckTimer; uint32 Faction; uint32 EnemyCount; uint32 RetreatTimer; - bool EventBegun; bool FirstBossDead; bool SecondBossDead; @@ -232,14 +197,12 @@ struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI uint32 MassTeleportTimer; bool DoMassTeleport; uint64 DummyGuid; - struct Spell { uint32 SpellId; uint32 Cooldown; uint32 TargetType; }Spell[3]; - private: uint32 SpellTimer[3]; //std::list CreatureList; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp index 705039a6d09..a0216c3c608 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp @@ -3,13 +3,11 @@ #include "def_hyjal.h" #include "hyjal_trash.h" #include "hyjalAI.h" - #define SPELL_METEOR 33814 //infernal visual #define SPELL_IMMOLATION 37059 #define SPELL_FLAME_BUFFET 31724 #define NPC_TRIGGER 21987 //World Trigger (Tiny) #define MODEL_INVIS 11686 //invisible model - float HordeWPs[8][3]=//basic waypoints from spawn to leader { {5492.91, -2404.61, 1462.63}, @@ -32,28 +30,24 @@ float AllianceWPs[8][3]=//basic waypoints from spawn to leader {5037.77, -1770.56, 1324.36}, {5067.23, -1789.95, 1321.17} }; - float FrostWyrmWPs[3][3]=//waypoints for the frost wyrms in horde base { {5580.82, -2628.83, 1528.28}, {5550.90, -2667.16, 1505.45}, {5459.64, -2725.91, 1484.83} }; - float GargoyleWPs[3][3]=//waypoints for the gargoyles in horde base { {5533.66, -2634.32, 1495.33}, {5517.88, -2712.05, 1490.54}, {5459.64, -2725.91, 1484.83} }; - float FlyPathWPs[3][3]=//waypoints for the gargoyls and frost wyrms in horde base in wave 1/3 { {5531.96, -2772.83, 1516.68}, {5498.32, -2734.84, 1497.01}, {5456.67, -2725.48, 1493.08} }; - float AllianceOverrunWP[55][3]=//waypoints in the alliance base used in the end in the cleaning wave { {4976.37,-1708.02,1339.43},//0spawn @@ -111,9 +105,7 @@ float AllianceOverrunWP[55][3]=//waypoints in the alliance base used in the end {5180.41, -2121.87, 1292.62},//52 garg target3 {5088.68, -2432.04, 1441.73},//53 garg target4 {5111.26, -2454.73, 1449.63}//54 garg target5 - }; - float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the cleaning wave { {5490.72,-2702.94,1482.14},//0 start @@ -138,7 +130,6 @@ float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the {5433.25,-2712.93,1493.02},//19 end 1 {5429.91,-2718.44,1493.42}//20 end 2 }; - hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c) { pInstance = c->GetInstanceData(); @@ -153,7 +144,6 @@ hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c) damageTaken = 0; Reset(); } - void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER || (done_by->GetTypeId() == TYPEID_UNIT && CAST_CRE(done_by)->isPet())) @@ -163,7 +153,6 @@ void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage) pInstance->SetData(DATA_RAIDDAMAGE,damage);//store raid's damage } } - void hyjal_trashAI::UpdateAI(const uint32 diff) { if (IsOverrun && !SetupOverrun) @@ -179,7 +168,7 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) } if (m_creature->GetEntry() == ABOMINATION) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); switch(OverrunType) { @@ -191,7 +180,6 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) AddWaypoint(8, AllianceOverrunWP[26][0]+irand(-3,3), AllianceOverrunWP[26][1]+irand(-3,3), AllianceOverrunWP[26][2]); AddWaypoint(9, AllianceOverrunWP[27][0]+irand(-3,3), AllianceOverrunWP[27][1]+irand(-3,3), AllianceOverrunWP[27][2]); AddWaypoint(10, AllianceOverrunWP[28][0]+irand(-3,3), AllianceOverrunWP[28][1]+irand(-3,3), AllianceOverrunWP[28][2]); - AddWaypoint(11, AllianceOverrunWP[36][0]+irand(-3,3), AllianceOverrunWP[36][1]+irand(-3,3), AllianceOverrunWP[36][2]); AddWaypoint(12, AllianceOverrunWP[37][0]+irand(-3,3), AllianceOverrunWP[37][1]+irand(-3,3), AllianceOverrunWP[37][2]); AddWaypoint(13, AllianceOverrunWP[38][0]+irand(-3,3), AllianceOverrunWP[38][1]+irand(-3,3), AllianceOverrunWP[38][2]); @@ -213,7 +201,6 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) AddWaypoint(8, AllianceOverrunWP[26][0]+irand(-3,3), AllianceOverrunWP[26][1]+irand(-3,3), AllianceOverrunWP[26][2]); AddWaypoint(9, AllianceOverrunWP[27][0]+irand(-3,3), AllianceOverrunWP[27][1]+irand(-3,3), AllianceOverrunWP[27][2]); AddWaypoint(10, AllianceOverrunWP[28][0]+irand(-3,3), AllianceOverrunWP[28][1]+irand(-3,3), AllianceOverrunWP[28][2]); - AddWaypoint(11, AllianceOverrunWP[36][0]+irand(-3,3), AllianceOverrunWP[36][1]+irand(-3,3), AllianceOverrunWP[36][2]); AddWaypoint(12, AllianceOverrunWP[37][0]+irand(-3,3), AllianceOverrunWP[37][1]+irand(-3,3), AllianceOverrunWP[37][2]); AddWaypoint(13, AllianceOverrunWP[38][0]+irand(-3,3), AllianceOverrunWP[38][1]+irand(-3,3), AllianceOverrunWP[38][2]); @@ -228,9 +215,8 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) Start(true, true); break; default: - for(uint8 i = 22; i < 36; ++i) + for (uint8 i = 22; i < 36; ++i) AddWaypoint(i-18, AllianceOverrunWP[i][0]+irand(-3,3), AllianceOverrunWP[i][1]+irand(-3,3), AllianceOverrunWP[i][2]); - SetDespawnAtEnd(true); LastOverronPos = 17; Start(true, true); @@ -239,7 +225,7 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) } if (m_creature->GetEntry() == GHOUL) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); switch(OverrunType) { @@ -301,7 +287,7 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) Start(true, true); break; default: - for(uint8 i = 22; i < 36; ++i) + for (uint8 i = 22; i < 36; ++i) AddWaypoint(i-18, AllianceOverrunWP[i][0]+irand(-3,3), AllianceOverrunWP[i][1]+irand(-3,3), AllianceOverrunWP[i][2]); SetDespawnAtEnd(true); LastOverronPos = 17; @@ -314,7 +300,7 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) { if (m_creature->GetEntry() == GHOUL) { - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); switch(OverrunType) { @@ -339,7 +325,7 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) Start(true, true); break; default: - for(uint8 i = 0; i < 16; ++i) + for (uint8 i = 0; i < 16; ++i) AddWaypoint(i+6, HordeOverrunWP[i][0]+irand(-10,10), HordeOverrunWP[i][1]+irand(-10,10), HordeOverrunWP[i][2]); SetDespawnAtEnd(true); LastOverronPos = 21; @@ -349,9 +335,9 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) } if (m_creature->GetEntry() == ABOMINATION) { - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-10,10), HordeWPs[i][1]+irand(-10,10), HordeWPs[i][2]); - for(uint8 i = 0; i < 16; ++i) + for (uint8 i = 0; i < 16; ++i) AddWaypoint(i+6, HordeOverrunWP[i][0]+irand(-10,10), HordeOverrunWP[i][1]+irand(-10,10), HordeOverrunWP[i][2]); SetDespawnAtEnd(true); LastOverronPos = 21; @@ -360,18 +346,15 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) } } } - void hyjal_trashAI::JustDied(Unit *victim) { if (!pInstance) return; if (IsEvent && !m_creature->isWorldBoss()) pInstance->SetData(DATA_TRASH, 0);//signal trash is dead - if ((pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE && !m_creature->isWorldBoss()) || (damageTaken < m_creature->GetMaxHealth()/4 && m_creature->isWorldBoss())) m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);//no loot } - struct mob_giant_infernalAI : public hyjal_trashAI { mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) @@ -387,7 +370,6 @@ struct mob_giant_infernalAI : public hyjal_trashAI pos = 0; Reset(); } - bool meteor; bool CanMove; bool WpEnabled; @@ -396,22 +378,19 @@ struct mob_giant_infernalAI : public hyjal_trashAI uint32 spawnTimer; uint32 FlameBuffetTimer; bool imol; - void Reset() { spawnTimer = 2000; FlameBuffetTimer= 2000; imol = false; } - void EnterCombat(Unit* who) {} - void WaypointReached(uint32 i) { pos = i; if (i == 0 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) @@ -419,14 +398,13 @@ struct mob_giant_infernalAI : public hyjal_trashAI } } } - void UpdateAI(const uint32 diff) { - if (DelayGetMotionMaster()->Clear(); meteor = true; - }else if (!CanMove){ + } + else if (!CanMove) + { if (spawnTimerRemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -457,13 +437,16 @@ struct mob_giant_infernalAI : public hyjal_trashAI Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){ + } + else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)) + { //do overrun } } }else spawnTimer -= diff; } - if (!CanMove)return; + if (!CanMove) + return; hyjal_trashAI::UpdateAI(diff); if (IsEvent || IsOverrun) npc_escortAI::UpdateAI(diff); @@ -480,7 +463,6 @@ struct mob_giant_infernalAI : public hyjal_trashAI } } } - if (!UpdateVictim()) return; if (!imol) @@ -497,15 +479,12 @@ struct mob_giant_infernalAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_giant_infernal(Creature* pCreature) { return new mob_giant_infernalAI(pCreature); } - #define SPELL_DISEASE_CLOUD 31607 #define SPELL_KNOCKDOWN 31610 - struct mob_abominationAI : public hyjal_trashAI { mob_abominationAI(Creature* c) : hyjal_trashAI(c) @@ -515,7 +494,6 @@ struct mob_abominationAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 KnockDownTimer; uint32 pos; @@ -523,18 +501,19 @@ struct mob_abominationAI : public hyjal_trashAI { KnockDownTimer = 10000; } - void WaypointReached(uint32 i) { pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); @@ -549,9 +528,7 @@ struct mob_abominationAI : public hyjal_trashAI } } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -564,7 +541,7 @@ struct mob_abominationAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -593,14 +570,11 @@ struct mob_abominationAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_abomination(Creature* pCreature) { return new mob_abominationAI(pCreature); } - #define SPELL_FRENZY 31540 - struct mob_ghoulAI : public hyjal_trashAI { mob_ghoulAI(Creature* c) : hyjal_trashAI(c) @@ -610,7 +584,6 @@ struct mob_ghoulAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 FrenzyTimer; uint32 pos; @@ -622,18 +595,19 @@ struct mob_ghoulAI : public hyjal_trashAI MoveTimer = 2000; RandomMove = false; } - void WaypointReached(uint32 i) { pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); @@ -647,12 +621,9 @@ struct mob_ghoulAI : public hyjal_trashAI m_creature->setDeathState(DEAD); m_creature->RemoveCorpse(); } - } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -665,7 +636,7 @@ struct mob_ghoulAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -688,22 +659,18 @@ struct mob_ghoulAI : public hyjal_trashAI }else FrenzyTimer -= diff; if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_ghoul(Creature* pCreature) { return new mob_ghoulAI(pCreature); } - #define SPELL_RAISE_DEAD_1 31617 #define SPELL_RAISE_DEAD_2 31624 #define SPELL_RAISE_DEAD_3 31625 #define SPELL_SHADOW_BOLT 31627 - struct mob_necromancerAI : public hyjal_trashAI { mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(m_creature) @@ -722,7 +689,6 @@ struct mob_necromancerAI : public hyjal_trashAI ShadowBoltTimer = 1000+rand()%5000; summons.DespawnAll(); } - void JustSummoned(Creature* summon) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,30,true); @@ -736,19 +702,20 @@ struct mob_necromancerAI : public hyjal_trashAI pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); } } } - void KilledUnit(Unit* victim) { switch (rand()%3) @@ -769,9 +736,7 @@ struct mob_necromancerAI : public hyjal_trashAI break; } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -784,7 +749,7 @@ struct mob_necromancerAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -807,21 +772,17 @@ struct mob_necromancerAI : public hyjal_trashAI DoCast(m_creature->getVictim(),SPELL_SHADOW_BOLT); ShadowBoltTimer = 20000+rand()%10000; }else ShadowBoltTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_necromancer(Creature* pCreature) { return new mob_necromancerAI(pCreature); } - #define SPELL_BANSHEE_CURSE 31651 #define SPELL_BANSHEE_WAIL 38183 #define SPELL_ANTI_MAGIC_SHELL 31662 - struct mob_bansheeAI : public hyjal_trashAI { mob_bansheeAI(Creature* c) : hyjal_trashAI(c) @@ -831,7 +792,6 @@ struct mob_bansheeAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 CourseTimer; uint32 WailTimer; @@ -843,27 +803,26 @@ struct mob_bansheeAI : public hyjal_trashAI WailTimer = 15000+rand()%5000; ShellTimer = 50000+rand()%10000; } - void WaypointReached(uint32 i) { pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); } } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -876,7 +835,7 @@ struct mob_bansheeAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -913,14 +872,11 @@ struct mob_bansheeAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_banshee(Creature* pCreature) { return new mob_bansheeAI(pCreature); } - #define SPELL_WEB 28991 - struct mob_crypt_fiendAI : public hyjal_trashAI { mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) @@ -930,7 +886,6 @@ struct mob_crypt_fiendAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 WebTimer; uint32 pos; @@ -938,27 +893,26 @@ struct mob_crypt_fiendAI : public hyjal_trashAI { WebTimer = 20000+rand()%5000; } - void WaypointReached(uint32 i) { pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); } } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -971,7 +925,7 @@ struct mob_crypt_fiendAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -984,7 +938,6 @@ struct mob_crypt_fiendAI : public hyjal_trashAI Start(false, true); SetDespawnAtEnd(false); } - } } } @@ -999,14 +952,11 @@ struct mob_crypt_fiendAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_crypt_fiend(Creature* pCreature) { return new mob_crypt_fiendAI(pCreature); } - #define SPELL_MANA_BURN 31729 - struct mob_fel_stalkerAI : public hyjal_trashAI { mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) @@ -1016,7 +966,6 @@ struct mob_fel_stalkerAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 ManaBurnTimer; uint32 pos; @@ -1024,27 +973,26 @@ struct mob_fel_stalkerAI : public hyjal_trashAI { ManaBurnTimer = 9000+rand()%5000; } - void WaypointReached(uint32 i) { pos = i; if (i == 7 && pInstance && !IsOverrun) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, attack thrall { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); - }else{ + } + else + { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) m_creature->AddThreat(target,0.0); } } } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -1057,7 +1005,7 @@ struct mob_fel_stalkerAI : public hyjal_trashAI pGo = true; if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + if (pInstance->GetData(DATA_ALLIANCE_RETREAT)) //2.alliance boss down, use horde WPs { for (uint8 i = 0; i < 8; ++i) AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); @@ -1070,7 +1018,6 @@ struct mob_fel_stalkerAI : public hyjal_trashAI Start(false, true); SetDespawnAtEnd(false); } - } } } @@ -1085,14 +1032,11 @@ struct mob_fel_stalkerAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_fel_stalker(Creature* pCreature) { return new mob_fel_stalkerAI(pCreature); } - #define SPELL_FROST_BREATH 31688 - struct mob_frost_wyrmAI : public hyjal_trashAI { mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) @@ -1102,19 +1046,16 @@ struct mob_frost_wyrmAI : public hyjal_trashAI pos = 0; Reset(); } - bool pGo; uint32 FrostBreathTimer; uint32 pos; uint32 MoveTimer; - void Reset() { FrostBreathTimer = 5000; MoveTimer = 0; m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); } - void WaypointReached(uint32 i) { pos = i; @@ -1128,21 +1069,17 @@ struct mob_frost_wyrmAI : public hyjal_trashAI } } } - void JustDied(Unit *victim) { if (pInstance && IsEvent) pInstance->SetData(DATA_TRASH, 0);//signal trash is dead - float x,y,z; m_creature->GetPosition(x,y,z); z = m_creature->GetMap()->GetVmapHeight(x, y, z, true); m_creature->GetMotionMaster()->MovePoint(0,x,y,z); m_creature->GetMap()->CreatureRelocation(m_creature, x,y,z,0); } - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -1164,7 +1101,9 @@ struct mob_frost_wyrmAI : public hyjal_trashAI AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]); Start(false, true); SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs + } + else + {//fly path FlyPathWPs for (uint8 i = 0; i < 3; ++i) AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); Start(false, true); @@ -1182,7 +1121,6 @@ struct mob_frost_wyrmAI : public hyjal_trashAI MoveTimer = 2000; }else MoveTimer-=diff; } - if (FrostBreathTimerIsWithinDist(m_creature->getVictim(), 25)) @@ -1196,14 +1134,11 @@ struct mob_frost_wyrmAI : public hyjal_trashAI } }; - CreatureAI* GetAI_mob_frost_wyrm(Creature* pCreature) { return new mob_frost_wyrmAI(pCreature); } - #define SPELL_GARGOYLE_STRIKE 31664 - struct mob_gargoyleAI : public hyjal_trashAI { mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) @@ -1214,14 +1149,12 @@ struct mob_gargoyleAI : public hyjal_trashAI DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; Reset(); } - bool pGo; uint32 StrikeTimer; uint32 pos; uint32 MoveTimer; float Zpos; bool forcemove; - void Reset() { forcemove = true; @@ -1230,7 +1163,6 @@ struct mob_gargoyleAI : public hyjal_trashAI MoveTimer = 0; m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); } - void WaypointReached(uint32 i) { pos = i; @@ -1244,7 +1176,6 @@ struct mob_gargoyleAI : public hyjal_trashAI } } } - void JustDied(Unit *victim) { float x,y,z; @@ -1254,7 +1185,6 @@ struct mob_gargoyleAI : public hyjal_trashAI m_creature->GetMap()->CreatureRelocation(m_creature, x,y,z,0); hyjal_trashAI::JustDied(victim); } - void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); @@ -1276,7 +1206,9 @@ struct mob_gargoyleAI : public hyjal_trashAI AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]); Start(false, true); SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs + } + else + {//fly path FlyPathWPs for (uint8 i = 0; i < 3; ++i) AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); Start(false, true); @@ -1287,7 +1219,7 @@ struct mob_gargoyleAI : public hyjal_trashAI } if (IsOverrun && !UpdateVictim()) { - if (faction == 0)//alliance + if (faction == 0) //alliance { if (StrikeTimergetVictim()) return; - if (who->isTargetableForAttack() && m_creature->IsHostileTo(who)) { float attackRadius = m_creature->GetAttackDistance(who); @@ -1370,11 +1294,9 @@ struct TRINITY_DLL_DECL alliance_riflemanAI : public Scripted_NoMovementAI } } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Check if we have a target @@ -1394,59 +1316,48 @@ struct TRINITY_DLL_DECL alliance_riflemanAI : public Scripted_NoMovementAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_alliance_rifleman(Creature* pCreature) { return new alliance_riflemanAI(pCreature); } - void AddSC_hyjal_trash() { Script *newscript = new Script; newscript->Name = "mob_giant_infernal"; newscript->GetAI = &GetAI_mob_giant_infernal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_abomination"; newscript->GetAI = &GetAI_mob_abomination; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ghoul"; newscript->GetAI = &GetAI_mob_ghoul; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_necromancer"; newscript->GetAI = &GetAI_mob_necromancer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_banshee"; newscript->GetAI = &GetAI_mob_banshee; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_crypt_fiend"; newscript->GetAI = &GetAI_mob_crypt_fiend; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_fel_stalker"; newscript->GetAI = &GetAI_mob_fel_stalker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_frost_wyrm"; newscript->GetAI = &GetAI_mob_frost_wyrm; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_gargoyle"; newscript->GetAI = &GetAI_mob_gargoyle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "alliance_rifleman"; newscript->GetAI = &GetAI_alliance_rifleman; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.h index 17fdbad5fda..ed5031ef1a8 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.h @@ -1,22 +1,15 @@ #ifndef SC_HYJAL_TRASH_AI_H #define SC_HYJAL_TRASH_AI_H - #include "def_hyjal.h" #include "escort_ai.h" - #define MINRAIDDAMAGE 700000//minimal damage before trash can drop loot and reputation, resets if faction leader dies - struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI { hyjal_trashAI(Creature *c); - void UpdateAI(const uint32 diff); - void JustDied(Unit* killer); - void DamageTaken(Unit *done_by, uint32 &damage); - public: ScriptedInstance* pInstance; bool IsEvent; @@ -29,7 +22,6 @@ struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI bool useFlyPath; uint32 damageTaken; float DummyTarget[3]; - //private: }; -#endif \ No newline at end of file +#endif diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/instance_hyjal.cpp index 81b51507463..2a69e02caea 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/instance_hyjal.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/hyjal/instance_hyjal.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Mount_Hyjal SD%Complete: 100 SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Hyjal Scripts SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ - #include "precompiled.h" #include "def_hyjal.h" #include "hyjal_trash.h" - enum eEnums { MAX_ENCOUNTER = 5, - GO_ANCIENT_GEM = 185557 }; /* Battle of Mount Hyjal encounters: @@ -38,16 +34,12 @@ enum eEnums 3 - Azgalor event 4 - Archimonde event */ - struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance { instance_mount_hyjal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - std::list m_uiAncientGemGUID; - uint64 RageWinterchill; uint64 Anetheron; uint64 Kazrogal; @@ -58,25 +50,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance uint64 TyrandeWhisperwind; uint64 HordeGate; uint64 ElfGate; - uint32 Trash; - uint32 hordeRetreat; uint32 allianceRetreat; bool ArchiYell; - uint32 RaidDamage; - #define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." #define YELL_EFFORTS_NAME "Archimonde" - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiAncientGemGUID.clear(); - RageWinterchill = 0; Anetheron = 0; Kazrogal = 0; @@ -89,21 +74,16 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance ElfGate = 0; ArchiYell = false; RaidDamage = 0; - Trash = 0; - hordeRetreat = 0; allianceRetreat = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -127,7 +107,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -142,7 +121,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance case 17948: TyrandeWhisperwind = pCreature->GetGUID(); break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -156,10 +134,8 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance case DATA_THRALL: return Thrall; case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -176,12 +152,10 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance { if (ArchiYell)break; ArchiYell = true; - Creature* pCreature = instance->GetCreature(Azgalor); if (pCreature) { Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000); - Map* pMap = pCreature->GetMap(); if (pMap->IsDungeon() && pUnit) { @@ -189,7 +163,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance Map::PlayerList const &PlayerList = pMap->GetPlayers(); if (PlayerList.isEmpty()) return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()) @@ -197,7 +170,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance WorldPacket data(SMSG_MESSAGECHAT, 200); pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID()); i->getSource()->GetSession()->SendPacket(&data); - WorldPacket data2(SMSG_PLAY_SOUND, 4); data2 << 10986; i->getSource()->GetSession()->SendPacket(&data2); @@ -210,7 +182,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance break; case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; case DATA_RESET_TRASH_COUNT: Trash = 0; break; - case DATA_TRASH: if (data) Trash = data; else Trash--; @@ -221,7 +192,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance { if (!m_uiAncientGemGUID.empty()) { - for(std::list::iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + for (std::list::iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) { //don't know how long it expected DoRespawnGameObject(*itr,DAY); @@ -248,27 +219,20 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance RaidDamage = 0; break; } - debug_log("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << allianceRetreat << " " << hordeRetreat << " " << RaidDamage; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } - } - uint32 GetData(uint32 type) { switch(type) @@ -285,12 +249,10 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance } return 0; } - std::string GetSaveData() { return str_data; } - void Load(const char* in) { if (!in) @@ -298,22 +260,19 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_mount_hyjal(Map* pMap) { return new instance_mount_hyjal(pMap); } - void AddSC_instance_mount_hyjal() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp index 6582e114049..130b34e0ee3 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp @@ -13,47 +13,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Captain_Skarloc SD%Complete: 75 SDComment: Missing adds, missing waypoints to move up to Thrall once spawned + speech before enter combat. SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ - #include "precompiled.h" #include "def_old_hillsbrad.h" - #define SAY_ENTER -1560000 #define SAY_TAUNT1 -1560001 #define SAY_TAUNT2 -1560002 #define SAY_SLAY1 -1560003 #define SAY_SLAY2 -1560004 #define SAY_DEATH -1560005 - #define SPELL_HOLY_LIGHT 29427 #define SPELL_CLEANSE 29380 #define SPELL_HAMMER_OF_JUSTICE 13005 #define SPELL_HOLY_SHIELD 31904 #define SPELL_DEVOTION_AURA 8258 #define SPELL_CONSECRATION 38385 - struct TRINITY_DLL_DECL boss_captain_skarlocAI : public ScriptedAI { boss_captain_skarlocAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Holy_Light_Timer; uint32 Cleanse_Timer; uint32 HammerOfJustice_Timer; uint32 HolyShield_Timer; uint32 DevotionAura_Timer; uint32 Consecration_Timer; - void Reset() { Holy_Light_Timer = 20000 + rand()%10000; @@ -63,84 +55,70 @@ struct TRINITY_DLL_DECL boss_captain_skarlocAI : public ScriptedAI DevotionAura_Timer = 3000; Consecration_Timer = 8000; } - void EnterCombat(Unit *who) { //This is not correct. Should taunt Thrall before engage in combat DoScriptText(SAY_TAUNT1, m_creature); DoScriptText(SAY_TAUNT2, m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) pInstance->SetData(TYPE_THRALL_PART1, DONE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Holy_Light if (Holy_Light_Timer < diff) { DoCast(m_creature, SPELL_HOLY_LIGHT); Holy_Light_Timer = 30000; }else Holy_Light_Timer -= diff; - //Cleanse if (Cleanse_Timer < diff) { DoCast(m_creature, SPELL_CLEANSE); Cleanse_Timer = 10000; } else Cleanse_Timer -= diff; - //Hammer of Justice if (HammerOfJustice_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_HAMMER_OF_JUSTICE); HammerOfJustice_Timer = 60000; }else HammerOfJustice_Timer -= diff; - //Holy Shield if (HolyShield_Timer < diff) { DoCast(m_creature, SPELL_HOLY_SHIELD); HolyShield_Timer = 240000; }else HolyShield_Timer -= diff; - //Devotion_Aura if (DevotionAura_Timer < diff) { DoCast(m_creature, SPELL_DEVOTION_AURA); DevotionAura_Timer = 45000 + rand()%10000; }else DevotionAura_Timer -= diff; - //Consecration if (Consecration_Timer < diff) { //DoCast(m_creature->getVictim(), SPELL_CONSECRATION); Consecration_Timer = 5000 + rand()%5000; }else Consecration_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_captain_skarloc(Creature* pCreature) { return new boss_captain_skarlocAI (pCreature); } - void AddSC_boss_captain_skarloc() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp index d430cf92863..bb8012bfa48 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Epoch_Hunter SD%Complete: 60 SDComment: Missing spawns pre-event, missing speech to be coordinated with rest of escort event. SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ - #include "precompiled.h" #include "def_old_hillsbrad.h" - #define SAY_ENTER1 -1560013 #define SAY_ENTER2 -1560014 #define SAY_ENTER3 -1560015 @@ -34,26 +31,21 @@ EndScriptData */ #define SAY_BREATH1 -1560020 #define SAY_BREATH2 -1560021 #define SAY_DEATH -1560022 - #define SPELL_SAND_BREATH 31914 #define SPELL_IMPENDING_DEATH 31916 #define SPELL_MAGIC_DISRUPTION_AURA 33834 #define SPELL_WING_BUFFET 31475 - struct TRINITY_DLL_DECL boss_epoch_hunterAI : public ScriptedAI { boss_epoch_hunterAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 SandBreath_Timer; uint32 ImpendingDeath_Timer; uint32 WingBuffet_Timer; uint32 Mda_Timer; - void Reset() { SandBreath_Timer = 8000 + rand()%8000; @@ -61,72 +53,57 @@ struct TRINITY_DLL_DECL boss_epoch_hunterAI : public ScriptedAI WingBuffet_Timer = 35000; Mda_Timer = 40000; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) pInstance->SetData(TYPE_THRALL_PART4, DONE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Sand Breath if (SandBreath_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature->getVictim(),SPELL_SAND_BREATH); - DoScriptText(RAND(SAY_BREATH1,SAY_BREATH2), m_creature); - SandBreath_Timer = 10000 + rand()%10000; }else SandBreath_Timer -= diff; - if (ImpendingDeath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_IMPENDING_DEATH); ImpendingDeath_Timer = 25000+rand()%5000; }else ImpendingDeath_Timer -= diff; - if (WingBuffet_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_WING_BUFFET); WingBuffet_Timer = 25000+rand()%10000; }else WingBuffet_Timer -= diff; - if (Mda_Timer < diff) { DoCast(m_creature,SPELL_MAGIC_DISRUPTION_AURA); Mda_Timer = 15000; }else Mda_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_epoch_hunter(Creature* pCreature) { return new boss_epoch_hunterAI (pCreature); } - void AddSC_boss_epoch_hunter() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp index f396c556dae..3a607c0ff6a 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp @@ -13,39 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Luetenant_Drake SD%Complete: 70 SDComment: Missing proper code for patrolling area after being spawned. Script for GO (barrels) quest 10283 SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ - #include "precompiled.h" #include "def_old_hillsbrad.h" #include "escort_ai.h" - /*###### ## go_barrel_old_hillsbrad ######*/ - bool GOHello_go_barrel_old_hillsbrad(Player* pPlayer, GameObject* pGO) { if (ScriptedInstance* pInstance = pGO->GetInstanceData()) { if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) return false; - pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); } - return false; } - /*###### ## boss_lieutenant_drake ######*/ - #define SAY_ENTER -1560006 #define SAY_AGGRO -1560007 #define SAY_SLAY1 -1560008 @@ -53,12 +45,10 @@ bool GOHello_go_barrel_old_hillsbrad(Player* pPlayer, GameObject* pGO) #define SAY_MORTAL -1560010 #define SAY_SHOUT -1560011 #define SAY_DEATH -1560012 - #define SPELL_WHIRLWIND 31909 #define SPELL_HAMSTRING 9080 #define SPELL_MORTAL_STRIKE 31911 #define SPELL_FRIGHTENING_SHOUT 33789 - struct Location { uint32 wpId; @@ -66,7 +56,6 @@ struct Location float y; float z; }; - static Location DrakeWP[]= { {0, 2125.84, 88.2535, 54.8830}, @@ -89,45 +78,36 @@ static Location DrakeWP[]= {17, 2125.50, 88.9481, 54.7953}, {18, 2128.20, 70.9763, 64.4221} }; - struct TRINITY_DLL_DECL boss_lieutenant_drakeAI : public ScriptedAI { boss_lieutenant_drakeAI(Creature *c) : ScriptedAI(c) {} - bool CanPatrol; uint32 wpId; - uint32 Whirlwind_Timer; uint32 Fear_Timer; uint32 MortalStrike_Timer; uint32 ExplodingShout_Timer; - void Reset() { CanPatrol = true; wpId = 0; - Whirlwind_Timer = 20000; Fear_Timer = 30000; MortalStrike_Timer = 45000; ExplodingShout_Timer = 25000; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { //TODO: make this work @@ -136,18 +116,15 @@ struct TRINITY_DLL_DECL boss_lieutenant_drakeAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); wpId++; } - //Return since we have no target if (!UpdateVictim()) return; - //Whirlwind if (Whirlwind_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_WHIRLWIND); Whirlwind_Timer = 20000+rand()%5000; }else Whirlwind_Timer -= diff; - //Fear if (Fear_Timer < diff) { @@ -155,7 +132,6 @@ struct TRINITY_DLL_DECL boss_lieutenant_drakeAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_FRIGHTENING_SHOUT); Fear_Timer = 25000+rand()%10000; }else Fear_Timer -= diff; - //Mortal Strike if (MortalStrike_Timer < diff) { @@ -163,25 +139,20 @@ struct TRINITY_DLL_DECL boss_lieutenant_drakeAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE); MortalStrike_Timer = 20000+rand()%10000; }else MortalStrike_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_lieutenant_drake(Creature* pCreature) { return new boss_lieutenant_drakeAI (pCreature); } - void AddSC_boss_lieutenant_drake() { Script *newscript; - newscript = new Script; newscript->Name = "go_barrel_old_hillsbrad"; newscript->pGOHello = &GOHello_go_barrel_old_hillsbrad; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lieutenant_drake"; newscript->GetAI = &GetAI_boss_lieutenant_drake; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/def_old_hillsbrad.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/def_old_hillsbrad.h index 3253a384217..d57c5e9d313 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/def_old_hillsbrad.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/def_old_hillsbrad.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_OLD_HILLSBRAD_H #define DEF_OLD_HILLSBRAD_H - #define TYPE_BARREL_DIVERSION 1 #define TYPE_THRALL_EVENT 2 #define TYPE_THRALL_PART1 3 diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp index b8ec8f2e111..0f976484190 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp @@ -13,82 +13,65 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Old_Hillsbrad SD%Complete: 75 SDComment: If thrall escort fail, all parts will reset. In future, save sub-parts and continue from last known. SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ - #include "precompiled.h" #include "def_old_hillsbrad.h" - #define MAX_ENCOUNTER 6 - #define THRALL_ENTRY 17876 #define TARETHA_ENTRY 18887 #define EPOCH_ENTRY 18096 - #define DRAKE_ENTRY 17848 - #define QUEST_ENTRY_DIVERSION 10283 #define LODGE_QUEST_TRIGGER 20155 - struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance { instance_old_hillsbrad(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 mBarrelCount; uint32 mThrallEventCount; - uint64 ThrallGUID; uint64 TarethaGUID; uint64 EpochGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - mBarrelCount = 0; mThrallEventCount = 0; ThrallGUID = 0; TarethaGUID = 0; EpochGUID = 0; } - Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* plr = itr->getSource()) return plr; } } - debug_log("TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); return NULL; } - void UpdateQuestCredit() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0); } } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -104,17 +87,14 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { Player* pPlayer = GetPlayerInMap(); - if (!pPlayer) { debug_log("TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); return; } - switch(type) { case TYPE_BARREL_DIVERSION: @@ -123,14 +103,10 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance { if (mBarrelCount >= 5) return; - ++mBarrelCount; DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - debug_log("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); - m_auiEncounter[0] = IN_PROGRESS; - if (mBarrelCount == 5) { UpdateQuestCredit(); @@ -187,7 +163,6 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance break; } } - uint32 GetData(uint32 data) { switch(data) @@ -207,7 +182,6 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -226,7 +200,6 @@ InstanceData* GetInstanceData_instance_old_hillsbrad(Map* pMap) { return new instance_old_hillsbrad(pMap); } - void AddSC_instance_old_hillsbrad() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 9fdd713e639..5408fdd8308 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -13,54 +13,42 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Old_Hillsbrad SD%Complete: 40 SDComment: Quest support: 10283, 10284. All friendly NPC's. Thrall waypoints fairly complete, missing many details, but possible to complete escort. SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ - /* ContentData npc_erozion npc_thrall_old_hillsbrad npc_taretha EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_old_hillsbrad.h" - #define QUEST_ENTRY_HILLSBRAD 10282 #define QUEST_ENTRY_DIVERSION 10283 #define QUEST_ENTRY_ESCAPE 10284 #define QUEST_ENTRY_RETURN 10285 #define ITEM_ENTRY_BOMBS 25853 - #define GOSSIP_HELLO_EROZION1 "I need a pack of Incendiary Bombs." #define GOSSIP_HELLO_EROZION2 "[PH] Teleport please, i'm tired." - /*###### ## npc_erozion ######*/ - bool GossipHello_npc_erozion(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); if (pInstance && pInstance->GetData(TYPE_BARREL_DIVERSION) != DONE && !pPlayer->HasItemCount(ITEM_ENTRY_BOMBS,1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (!pPlayer->GetQuestRewardStatus(QUEST_ENTRY_RETURN) && pPlayer->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(9778, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -79,11 +67,9 @@ bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 uiSen } return true; } - /*###### ## npc_thrall_old_hillsbrad ######*/ - //Thrall texts #define SAY_TH_START_EVENT_PART1 -1560023 #define SAY_TH_ARMORY -1560024 @@ -96,73 +82,57 @@ bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 uiSen #define SAY_TH_EPOCH_WONDER -1560031 #define SAY_TH_EPOCH_KILL_TARETHA -1560032 #define SAY_TH_EVENT_COMPLETE -1560033 - #define SAY_TH_RANDOM_LOW_HP1 -1560034 #define SAY_TH_RANDOM_LOW_HP2 -1560035 - #define SAY_TH_RANDOM_DIE1 -1560036 #define SAY_TH_RANDOM_DIE2 -1560037 - #define SAY_TH_RANDOM_AGGRO1 -1560038 #define SAY_TH_RANDOM_AGGRO2 -1560039 #define SAY_TH_RANDOM_AGGRO3 -1560040 #define SAY_TH_RANDOM_AGGRO4 -1560041 - #define SAY_TH_RANDOM_KILL1 -1560042 #define SAY_TH_RANDOM_KILL2 -1560043 #define SAY_TH_RANDOM_KILL3 -1560044 - #define SAY_TH_LEAVE_COMBAT1 -1560045 #define SAY_TH_LEAVE_COMBAT2 -1560046 #define SAY_TH_LEAVE_COMBAT3 -1560047 - //Taretha texts #define SAY_TA_FREE -1560048 #define SAY_TA_ESCAPED -1560049 - //Misc for Thrall #define SPELL_STRIKE 14516 #define SPELL_SHIELD_BLOCK 12169 #define SPELL_SUMMON_EROZION_IMAGE 33954 //if thrall dies during escort? - #define SPEED_WALK (0.5f) #define SPEED_RUN (1.0f) #define SPEED_MOUNT (1.6f) - #define THRALL_WEAPON_MODEL 22106 #define THRALL_WEAPON_INFO 218169346 #define THRALL_SHIELD_MODEL 18662 #define THRALL_SHIELD_INFO 234948100 #define THRALL_MODEL_UNEQUIPPED 17292 #define THRALL_MODEL_EQUIPPED 18165 - //Misc Creature entries #define ENTRY_ARMORER 18764 #define ENTRY_SCARLOC 17862 - #define MOB_ENTRY_RIFLE 17820 #define MOB_ENTRY_WARDEN 17833 #define MOB_ENTRY_VETERAN 17860 #define MOB_ENTRY_WATCHMAN 17814 #define MOB_ENTRY_SENTRY 17815 - #define MOB_ENTRY_BARN_GUARDSMAN 18092 #define MOB_ENTRY_BARN_PROTECTOR 18093 #define MOB_ENTRY_BARN_LOOKOUT 18094 - #define MOB_ENTRY_CHURCH_GUARDSMAN 23175 #define MOB_ENTRY_CHURCH_PROTECTOR 23179 #define MOB_ENTRY_CHURCH_LOOKOUT 23177 - #define MOB_ENTRY_INN_GUARDSMAN 23176 #define MOB_ENTRY_INN_PROTECTOR 23180 #define MOB_ENTRY_INN_LOOKOUT 23178 - #define SKARLOC_MOUNT 18798 #define SKARLOC_MOUNT_MODEL 18223 #define EROZION_ENTRY 18723 #define ENTRY_EPOCH 18096 - //gossip items #define GOSSIP_ID_START 9568 #define GOSSIP_ID_SKARLOC1 9614 //I'm glad Taretha is alive. We now must find a way to free her... @@ -170,14 +140,10 @@ bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 uiSen #define GOSSIP_ID_SKARLOC2 9579 //What do you mean by this? Is Taretha in danger? #define GOSSIP_ITEM_SKARLOC2 "The situation is rather complicated, Thrall. It would be best for you to head into the mountains now, before more of Blackmoore's men show up. We'll make sure Taretha is safe." #define GOSSIP_ID_SKARLOC3 9580 - #define GOSSIP_ID_TARREN 9597 //tarren mill is beyond these trees #define GOSSIP_ITEM_TARREN "We're ready, Thrall." - #define GOSSIP_ID_COMPLETE 9578 //Thank you friends, I owe my freedom to you. Where is Taretha? I hoped to see her - #define GOSSIP_ITEM_WALKING "[PH] Start walking." - struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI { npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) @@ -186,19 +152,14 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI HadMount = false; m_creature->setActive(true); } - ScriptedInstance *pInstance; - uint64 TarethaGUID; - bool LowHp; bool HadMount; - void WaypointReached(uint32 i) { if (!pInstance) return; - switch(i) { case 8: @@ -331,7 +292,6 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI //trigger epoch Yell("Thrall! Come outside and face your fate! ....") //from here, thrall should not never be allowed to move to point 106 which he currently does. break; - case 106: { //trigger taretha to run down outside @@ -340,19 +300,17 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI if (Player* pPlayer = GetPlayerForEscort()) CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); } - //kill credit Creature for quest Map* pMap = m_creature->GetMap(); Map::PlayerList const& players = pMap->GetPlayers(); if (!players.isEmpty() && pMap->IsDungeon()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) pPlayer->KilledMonsterCredit(20156,m_creature->GetGUID()); } } - //alot will happen here, thrall and taretha talk, erozion appear at spot to explain m_creature->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); } @@ -364,14 +322,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI } } - void Reset() { LowHp = false; - if (HadMount) DoMount(); - if (!HasEscortState(STATE_ESCORT_ESCORTING)) { DoUnmount(); @@ -409,7 +364,6 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI HadMount = true; } } - void JustSummoned(Creature* summoned) { switch(summoned->GetEntry()) @@ -426,7 +380,6 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI break; } } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_TH_RANDOM_KILL1,SAY_TH_RANDOM_KILL2,SAY_TH_RANDOM_KILL3), m_creature); @@ -435,21 +388,16 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI { if (pInstance) pInstance->SetData(TYPE_THRALL_EVENT,FAIL); - // Don't do a yell if he kills self (if player goes too far or at the end). if (slayer == m_creature) return; - DoScriptText(RAND(SAY_TH_RANDOM_DIE1,SAY_TH_RANDOM_DIE2), m_creature); } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) return; - //TODO: add his abilities'n-crap here if (!LowHp && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20)) { @@ -458,12 +406,10 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_thrall_old_hillsbrad(Creature* pCreature) { return new npc_thrall_old_hillsbradAI(pCreature); } - bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) @@ -471,7 +417,6 @@ bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SendPreparedQuest(pCreature->GetGUID()); } - ScriptedInstance* pInstance = pCreature->GetInstanceData(); if (pInstance) { @@ -480,13 +425,11 @@ bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WALKING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START, pCreature->GetGUID()); } - if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && !pInstance->GetData(TYPE_THRALL_PART2)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC1, pCreature->GetGUID()); } - if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && !pInstance->GetData(TYPE_THRALL_PART3)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TARREN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); @@ -495,7 +438,6 @@ bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); @@ -508,33 +450,25 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); } - DoScriptText(SAY_TH_START_EVENT_PART1, pCreature); - if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())) pEscortAI->Start(true, true, pPlayer->GetGUID()); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); break; - case GOSSIP_ACTION_INFO_DEF+2: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC2, pCreature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+20: pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, pCreature->GetGUID()); pCreature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); if (pInstance) pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); - DoScriptText(SAY_TH_START_EVENT_PART2, pCreature); - CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); break; - case GOSSIP_ACTION_INFO_DEF+3: pPlayer->CLOSE_GOSSIP_MENU(); if (pInstance) @@ -544,25 +478,20 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, } return true; } - /*###### ## npc_taretha ######*/ - #define GOSSIP_ID_EPOCH1 9610 //Thank you for helping Thrall escape, friends. Now I only hope #define GOSSIP_ITEM_EPOCH1 "Strange wizard?" #define GOSSIP_ID_EPOCH2 9613 //Yes, friends. This man was no wizard of #define GOSSIP_ITEM_EPOCH2 "We'll get you out. Taretha. Don't worry. I doubt the wizard would wander too far away." - struct TRINITY_DLL_DECL npc_tarethaAI : public npc_escortAI { npc_tarethaAI(Creature *c) : npc_escortAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - void WaypointReached(uint32 i) { switch(i) @@ -577,7 +506,6 @@ struct TRINITY_DLL_DECL npc_tarethaAI : public npc_escortAI } void Reset() {} void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); @@ -587,7 +515,6 @@ CreatureAI* GetAI_npc_taretha(Creature* pCreature) { return new npc_tarethaAI(pCreature); } - bool GossipHello_npc_taretha(Player* pPlayer, Creature* pCreature) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); @@ -598,7 +525,6 @@ bool GossipHello_npc_taretha(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); @@ -610,13 +536,11 @@ bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 uiSen if (uiAction == GOSSIP_ACTION_INFO_DEF+2) { pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) { pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); if (pInstance->GetData64(DATA_EPOCH) == 0) pCreature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); - if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) { Creature* Thrall = (Unit::GetCreature((*pCreature), ThrallGUID)); @@ -627,28 +551,23 @@ bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 uiSen } return true; } - /*###### ## AddSC ######*/ - void AddSC_old_hillsbrad() { Script *newscript; - newscript = new Script; newscript->Name = "npc_erozion"; newscript->pGossipHello = &GossipHello_npc_erozion; newscript->pGossipSelect = &GossipSelect_npc_erozion; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_thrall_old_hillsbrad"; newscript->pGossipHello = &GossipHello_npc_thrall_old_hillsbrad; newscript->pGossipSelect = &GossipSelect_npc_thrall_old_hillsbrad; newscript->GetAI = &GetAI_npc_thrall_old_hillsbrad; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_taretha"; newscript->pGossipHello = &GossipHello_npc_taretha; diff --git a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp index 1354c2bc861..4c1485586e5 100644 --- a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp @@ -13,71 +13,55 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Darkshore SD%Complete: 100 SDComment: Quest support: 731, 2078, 5321 SDCategory: Darkshore EndScriptData */ - /* ContentData npc_kerlonian npc_prospector_remtravel npc_threshwackonator EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "follower_ai.h" - /*#### # npc_kerlonian ####*/ - enum eKerlonian { SAY_KER_START = -1000434, - EMOTE_KER_SLEEP_1 = -1000435, EMOTE_KER_SLEEP_2 = -1000436, EMOTE_KER_SLEEP_3 = -1000437, - SAY_KER_SLEEP_1 = -1000438, SAY_KER_SLEEP_2 = -1000439, SAY_KER_SLEEP_3 = -1000440, SAY_KER_SLEEP_4 = -1000441, - EMOTE_KER_AWAKEN = -1000445, - SAY_KER_ALERT_1 = -1000442, SAY_KER_ALERT_2 = -1000443, - SAY_KER_END = -1000444, - SPELL_SLEEP_VISUAL = 25148, SPELL_AWAKEN = 17536, QUEST_SLEEPER_AWAKENED = 5321, NPC_LILADRIS = 11219, //attackers entries unknown FACTION_KER_ESCORTEE = 113 }; - //TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road. struct TRINITY_DLL_DECL npc_kerlonianAI : public FollowerAI { npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { } - uint32 m_uiFallAsleepTimer; - void Reset() { m_uiFallAsleepTimer = urand(10000, 45000); } - void MoveInLineOfSight(Unit *pWho) { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) @@ -86,50 +70,38 @@ struct TRINITY_DLL_DECL npc_kerlonianAI : public FollowerAI { if (pPlayer->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE) pPlayer->GroupEventHappens(QUEST_SLEEPER_AWAKENED, m_creature); - DoScriptText(SAY_KER_END, m_creature); } - SetFollowComplete(); } } } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN) ClearSleeping(); } - void SetSleeping() { SetFollowPaused(true); - DoScriptText(RAND(EMOTE_KER_SLEEP_1,EMOTE_KER_SLEEP_2,EMOTE_KER_SLEEP_3), m_creature); - DoScriptText(RAND(SAY_KER_SLEEP_1,SAY_KER_SLEEP_2,SAY_KER_SLEEP_3,SAY_KER_SLEEP_4), m_creature); - m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->CastSpell(m_creature, SPELL_SLEEP_VISUAL, false); } - void ClearSleeping() { m_creature->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL); m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(EMOTE_KER_AWAKEN, m_creature); - SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) { if (!UpdateVictim()) { if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) return; - if (!HasFollowState(STATE_FOLLOW_PAUSED)) { if (m_uiFallAsleepTimer < uiDiff) @@ -140,19 +112,15 @@ struct TRINITY_DLL_DECL npc_kerlonianAI : public FollowerAI else m_uiFallAsleepTimer -= uiDiff; } - return; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_kerlonian(Creature* pCreature) { return new npc_kerlonianAI(pCreature); } - bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_SLEEPER_AWAKENED) @@ -164,14 +132,11 @@ bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest pKerlonianAI->StartFollow(pPlayer, FACTION_KER_ESCORTEE, pQuest); } } - return true; } - /*#### # npc_prospector_remtravel ####*/ - enum eRemtravel { SAY_REM_START = -1000415, // signed for 4966 @@ -187,25 +152,20 @@ enum eRemtravel SAY_REM_PROGRESS = -1000424, // signed for 9999 SAY_REM_REMEMBER = -1000425, // signed for 9999 EMOTE_REM_END = -1000426, // signed for 9999 - FACTION_ESCORTEE = 10, QUEST_ABSENT_MINDED_PT2 = 731, NPC_GRAVEL_SCOUT = 2158, NPC_GRAVEL_BONE = 2159, NPC_GRAVEL_GEO = 2160 }; - struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI { npc_prospector_remtravelAI(Creature* pCreature) : npc_escortAI(pCreature) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: @@ -261,44 +221,35 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI break; } } - void Reset() {} - void EnterCombat(Unit* who) { if (rand()%2) DoScriptText(SAY_REM_AGGRO, me, who); } - void JustSummoned(Creature* pSummoned) { //unsure if it should be any //pSummoned->AI()->AttackStart(m_creature); } }; - CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) { return new npc_prospector_remtravelAI(pCreature); } - bool QuestAccept_npc_prospector_remtravel(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) { if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravelAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID()); - pCreature->setFaction(FACTION_ESCORTEE); } - return true; } - /*#### # npc_threshwackonator ####*/ - enum eThreshwackonator { EMOTE_START = -1000413, //signed for 4966 @@ -307,19 +258,14 @@ enum eThreshwackonator NPC_GELKAK = 6667, FACTION_HOSTILE = 14 }; - #define GOSSIP_ITEM_INSERT_KEY "[PH] Insert key" - struct TRINITY_DLL_DECL npc_threshwackonatorAI : public FollowerAI { npc_threshwackonatorAI(Creature* pCreature) : FollowerAI(pCreature) { } - void Reset() { } - void MoveInLineOfSight(Unit* pWho) { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) @@ -329,64 +275,51 @@ struct TRINITY_DLL_DECL npc_threshwackonatorAI : public FollowerAI } } } - void DoAtEnd() { me->setFaction(FACTION_HOSTILE); - if (Player* pHolder = GetLeaderForFollower()) me->AI()->AttackStart(pHolder); - SetFollowComplete(); } }; - CreatureAI* GetAI_npc_threshwackonator(Creature* pCreature) { return new npc_threshwackonatorAI(pCreature); } - bool GossipHello_npc_threshwackonator(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_threshwackonator(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); - if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonatorAI, pCreature->AI())) { DoScriptText(EMOTE_START, pCreature); pThreshAI->StartFollow(pPlayer); } } - return true; } - void AddSC_darkshore() { Script *newscript; - newscript = new Script; newscript->Name = "npc_kerlonian"; newscript->GetAI = &GetAI_npc_kerlonian; newscript->pQuestAccept = &QuestAccept_npc_kerlonian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_prospector_remtravel"; newscript->GetAI = &GetAI_npc_prospector_remtravel; newscript->pQuestAccept = &QuestAccept_npc_prospector_remtravel; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_threshwackonator"; newscript->GetAI = &GetAI_npc_threshwackonator; diff --git a/src/bindings/scripts/scripts/kalimdor/desolace.cpp b/src/bindings/scripts/scripts/kalimdor/desolace.cpp index 02702f77c15..8555b3190f0 100644 --- a/src/bindings/scripts/scripts/kalimdor/desolace.cpp +++ b/src/bindings/scripts/scripts/kalimdor/desolace.cpp @@ -13,70 +13,55 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Desolace SD%Complete: 100 SDComment: Quest support: 5561 SDCategory: Desolace EndScriptData */ - /* ContentData npc_aged_dying_ancient_kodo EndContentData */ - #include "precompiled.h" - enum eDyingKodo { // signed for 9999 SAY_SMEED_HOME_1 = -1000428, SAY_SMEED_HOME_2 = -1000429, SAY_SMEED_HOME_3 = -1000430, - QUEST_KODO = 5561, - NPC_SMEED = 11596, NPC_AGED_KODO = 4700, NPC_DYING_KODO = 4701, NPC_ANCIENT_KODO = 4702, NPC_TAMED_KODO = 11627, - SPELL_KODO_KOMBO_ITEM = 18153, SPELL_KODO_KOMBO_PLAYER_BUFF = 18172, //spells here have unclear function, but using them at least for visual parts and checks SPELL_KODO_KOMBO_DESPAWN_BUFF = 18377, SPELL_KODO_KOMBO_GOSSIP = 18362 - }; - struct TRINITY_DLL_DECL npc_aged_dying_ancient_kodoAI : public ScriptedAI { npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - uint32 m_uiDespawnTimer; - void Reset() { m_uiDespawnTimer = 0; } - void MoveInLineOfSight(Unit* pWho) { if (pWho->GetEntry() == NPC_SMEED) { if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return; - if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { DoScriptText(RAND(SAY_SMEED_HOME_1,SAY_SMEED_HOME_2,SAY_SMEED_HOME_3), pWho); - //spell have no implemented effect (dummy), so useful to notify spellHit m_creature->CastSpell(m_creature,SPELL_KODO_KOMBO_GOSSIP,true); } } } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) @@ -85,7 +70,6 @@ struct TRINITY_DLL_DECL npc_aged_dying_ancient_kodoAI : public ScriptedAI m_uiDespawnTimer = 60000; } } - void UpdateAI(const uint32 diff) { //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. @@ -99,19 +83,15 @@ struct TRINITY_DLL_DECL npc_aged_dying_ancient_kodoAI : public ScriptedAI return; } } else m_uiDespawnTimer -= diff; - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_aged_dying_ancient_kodo(Creature* pCreature) { return new npc_aged_dying_ancient_kodoAI(pCreature); } - bool EffectDummyCreature_npc_aged_dying_ancient_kodo(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) { //always check spellid and effectindex @@ -120,47 +100,37 @@ bool EffectDummyCreature_npc_aged_dying_ancient_kodo(Unit *pCaster, uint32 spell //no effect if player/creature already have aura from spells if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) return true; - if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || pCreatureTarget->GetEntry() == NPC_DYING_KODO || pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) { pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); - pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); - if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) pCreatureTarget->GetMotionMaster()->MoveIdle(); - pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, pCreatureTarget->GetFollowAngle()); } - //always return true when we are handling this spell and effect return true; } return false; } - bool GossipHello_npc_aged_dying_ancient_kodo(Player* pPlayer, Creature* pCreature) { if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) { //the expected quest objective pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); pCreature->GetMotionMaster()->MoveIdle(); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - void AddSC_desolace() { Script *newscript; - newscript = new Script; newscript->Name = "npc_aged_dying_ancient_kodo"; newscript->GetAI = &GetAI_npc_aged_dying_ancient_kodo; diff --git a/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp b/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp index 8f33a569c3e..1a278abb78c 100644 --- a/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp +++ b/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Dustwallow_Marsh SD%Complete: 95 SDComment: Quest support: 11180, 558, 11126, 11142, 11180. Vendor Nat Pagle SDCategory: Dustwallow Marsh EndScriptData */ - /* ContentData mobs_risen_husk_spirit npc_restless_apparition @@ -30,13 +28,10 @@ npc_nat_pagle npc_private_hendel npc_cassa_crimsonwing - handled by npc_taxi EndContentData */ - #include "precompiled.h" - /*###### ## mobs_risen_husk_spirit ######*/ - enum eHuskSpirit { QUEST_WHATS_HAUNTING_WITCH_HILL = 11180, @@ -46,20 +41,16 @@ enum eHuskSpirit NPC_RISEN_HUSK = 23555, NPC_RISEN_SPIRIT = 23554 }; - struct TRINITY_DLL_DECL mobs_risen_husk_spiritAI : public ScriptedAI { mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiConsumeFlesh_Timer; uint32 m_uiIntangiblePresence_Timer; - void Reset() { m_uiConsumeFlesh_Timer = 10000; m_uiIntangiblePresence_Timer = 5000; } - void DamageTaken(Unit* pDoneBy, uint32 &damage) { if (pDoneBy->GetTypeId() == TYPEID_PLAYER) @@ -68,80 +59,63 @@ struct TRINITY_DLL_DECL mobs_risen_husk_spiritAI : public ScriptedAI m_creature->CastSpell(pDoneBy, SPELL_SUMMON_RESTLESS_APPARITION, false); } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - if (m_uiConsumeFlesh_Timer < uiDiff) { if (m_creature->GetEntry() == NPC_RISEN_HUSK) DoCast(m_creature->getVictim(), SPELL_CONSUME_FLESH); - m_uiConsumeFlesh_Timer = 15000; } else m_uiConsumeFlesh_Timer -= uiDiff; - if (m_uiIntangiblePresence_Timer < uiDiff) { if (m_creature->GetEntry() == NPC_RISEN_SPIRIT) DoCast(m_creature->getVictim(), SPELL_INTANGIBLE_PRESENCE); - m_uiIntangiblePresence_Timer = 20000; } else m_uiIntangiblePresence_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mobs_risen_husk_spirit(Creature* pCreature) { return new mobs_risen_husk_spiritAI (pCreature); } - /*###### ## npc_restless_apparition ######*/ - bool GossipHello_npc_restless_apparition(Player* pPlayer, Creature* pCreature) { pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return true; } - /*###### ## npc_deserter_agitator ######*/ - enum eAgitator { QUEST_TRAITORS_AMONG_US = 11126, FACTION_THER_DESERTER = 1883 }; - struct TRINITY_DLL_DECL npc_deserter_agitatorAI : public ScriptedAI { npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { } - void Reset() { me->RestoreFaction(); } }; - CreatureAI* GetAI_npc_deserter_agitator(Creature* pCreature) { return new npc_deserter_agitatorAI (pCreature); } - bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) @@ -151,35 +125,26 @@ bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - /*###### ## npc_lady_jaina_proudmoore ######*/ - enum eLadyJaina { QUEST_JAINAS_AUTOGRAPH = 558, SPELL_JAINAS_AUTOGRAPH = 23122 }; - #define GOSSIP_ITEM_JAINA "I know this is rather silly but i have a young ward who is a bit shy and would like your autograph." - bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_SENDER_INFO) @@ -189,21 +154,17 @@ bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature } return true; } - /*###### ## npc_nat_pagle ######*/ - enum eNatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; - bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); @@ -211,22 +172,17 @@ bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(7638, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_private_hendel ######*/ - enum eHendel { // looks like all this text ids are wrong. @@ -235,100 +191,79 @@ enum eHendel SAY_PROGRESS_3_TER = -1000413, SAY_PROGRESS_4_TER = -1000414, EMOTE_SURRENDER = -1000415, - QUEST_MISSING_DIPLO_PT16 = 1324, FACTION_HOSTILE = 168, //guessed, may be different - NPC_SENTRY = 5184, //helps hendel NPC_JAINA = 4968, //appears once hendel gives up NPC_TERVOSH = 4967 }; - //TODO: develop this further, end event not created struct TRINITY_DLL_DECL npc_private_hendelAI : public ScriptedAI { npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { } - void Reset() { me->RestoreFaction(); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 20)) { uiDamage = 0; - if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, m_creature); - DoScriptText(EMOTE_SURRENDER, m_creature); EnterEvadeMode(); } } }; - bool QuestAccept_npc_private_hendel(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16) pCreature->setFaction(FACTION_HOSTILE); - return true; } - CreatureAI* GetAI_npc_private_hendel(Creature* pCreature) { return new npc_private_hendelAI(pCreature); } - /*###### ## ######*/ - void AddSC_dustwallow_marsh() { Script *newscript; - newscript = new Script; newscript->Name = "mobs_risen_husk_spirit"; newscript->GetAI = &GetAI_mobs_risen_husk_spirit; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_restless_apparition"; newscript->pGossipHello = &GossipHello_npc_restless_apparition; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_deserter_agitator"; newscript->GetAI = &GetAI_npc_deserter_agitator; newscript->pGossipHello = &GossipHello_npc_deserter_agitator; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lady_jaina_proudmoore"; newscript->pGossipHello = &GossipHello_npc_lady_jaina_proudmoore; newscript->pGossipSelect = &GossipSelect_npc_lady_jaina_proudmoore; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_nat_pagle"; newscript->pGossipHello = &GossipHello_npc_nat_pagle; newscript->pGossipSelect = &GossipSelect_npc_nat_pagle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_private_hendel"; newscript->GetAI = &GetAI_npc_private_hendel; diff --git a/src/bindings/scripts/scripts/kalimdor/felwood.cpp b/src/bindings/scripts/scripts/kalimdor/felwood.cpp index 4a676ec5366..1baee7b02bb 100644 --- a/src/bindings/scripts/scripts/kalimdor/felwood.cpp +++ b/src/bindings/scripts/scripts/kalimdor/felwood.cpp @@ -13,33 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Felwood SD%Complete: 95 SDComment: Quest support: 4101, 4102 SDCategory: Felwood EndScriptData */ - /* ContentData npcs_riverbreeze_and_silversky EndContentData */ - #include "precompiled.h" - /*###### ## npcs_riverbreeze_and_silversky ######*/ - #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" - bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature) { uint32 eCreature = pCreature->GetEntry(); - if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (eCreature==9528) { if (pPlayer->GetQuestRewardStatus(4101)) @@ -51,7 +43,6 @@ bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCrea else pPlayer->SEND_GOSSIP_MENU(2844, pCreature->GetGUID()); } - if (eCreature==9529) { if (pPlayer->GetQuestRewardStatus(4102)) @@ -63,10 +54,8 @@ bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCrea else pPlayer->SEND_GOSSIP_MENU(2842, pCreature->GetGUID()); } - return true; } - bool GossipSelect_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction ==GOSSIP_ACTION_INFO_DEF+1) @@ -76,11 +65,9 @@ bool GossipSelect_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCre } return true; } - void AddSC_felwood() { Script *newscript; - newscript = new Script; newscript->Name = "npcs_riverbreeze_and_silversky"; newscript->pGossipHello = &GossipHello_npcs_riverbreeze_and_silversky; diff --git a/src/bindings/scripts/scripts/kalimdor/feralas.cpp b/src/bindings/scripts/scripts/kalimdor/feralas.cpp index 9a3df7c06e2..aec906510e8 100644 --- a/src/bindings/scripts/scripts/kalimdor/feralas.cpp +++ b/src/bindings/scripts/scripts/kalimdor/feralas.cpp @@ -13,35 +13,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Feralas SD%Complete: 100 SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer SDCategory: Feralas EndScriptData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_gregan_brewspewer ######*/ - #define GOSSIP_HELLO "Buy somethin', will ya?" - bool GossipHello_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -53,11 +45,9 @@ bool GossipSelect_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature, ui pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); return true; } - /*###### ## npc_oox22fe ######*/ - enum eOOX { //signed for 7806 @@ -66,23 +56,19 @@ enum eOOX SAY_OOX_AGGRO2 = -1000289, SAY_OOX_AMBUSH = -1000290, SAY_OOX_END = -1000292, - NPC_YETI = 7848, NPC_GORILLA = 5260, NPC_WOODPAW_REAVER = 5255, NPC_WOODPAW_BRUTE = 5253, NPC_WOODPAW_ALPHA = 5258, NPC_WOODPAW_MYSTIC = 5254, - QUEST_RESCUE_OOX22FE = 2767, FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI { npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void WaypointReached(uint32 i) { switch (i) @@ -119,31 +105,26 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI break; } } - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) m_creature->SetStandState(UNIT_STAND_STATE_DEAD); } - void EnterCombat(Unit* who) { //For an small probability the npc says something when he get aggro if (urand(0,9) > 7) DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), m_creature); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } }; - CreatureAI* GetAI_npc_oox22fe(Creature* pCreature) { return new npc_oox22feAI(pCreature); } - bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE) @@ -151,53 +132,41 @@ bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest* DoScriptText(SAY_OOX_START, pCreature); //change that the npc is not lying dead on the ground pCreature->SetStandState(UNIT_STAND_STATE_STAND); - if (pPlayer->GetTeam() == ALLIANCE) pCreature->setFaction(FACTION_ESCORTEE_A); - if (pPlayer->GetTeam() == HORDE) pCreature->setFaction(FACTION_ESCORTEE_H); - if (npc_escortAI* pEscortAI = CAST_AI(npc_oox22feAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); - } return true; } - /*###### ## npc_screecher_spirit ######*/ - bool GossipHello_npc_screecher_spirit(Player* pPlayer, Creature* pCreature) { pPlayer->SEND_GOSSIP_MENU(2039, pCreature->GetGUID()); pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return true; } - /*###### ## AddSC ######*/ - void AddSC_feralas() { Script *newscript; - newscript = new Script; newscript->Name = "npc_gregan_brewspewer"; newscript->pGossipHello = &GossipHello_npc_gregan_brewspewer; newscript->pGossipSelect = &GossipSelect_npc_gregan_brewspewer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_oox22fe"; newscript->GetAI = &GetAI_npc_oox22fe; newscript->pQuestAccept = &QuestAccept_npc_oox22fe; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_screecher_spirit"; newscript->pGossipHello = &GossipHello_npc_screecher_spirit; diff --git a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_celebras_the_cursed.cpp b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_celebras_the_cursed.cpp index de33f5253df..8eabe72c3fc 100644 --- a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_celebras_the_cursed.cpp +++ b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_celebras_the_cursed.cpp @@ -13,47 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Celebras_the_Cursed SD%Complete: 100 SDComment: SDCategory: Maraudon EndScriptData */ - #include "precompiled.h" - #define SPELL_WRATH 21807 #define SPELL_ENTANGLINGROOTS 12747 #define SPELL_CORRUPT_FORCES 21968 - struct TRINITY_DLL_DECL celebras_the_cursedAI : public ScriptedAI { celebras_the_cursedAI(Creature *c) : ScriptedAI(c) {} - uint32 Wrath_Timer; uint32 EntanglingRoots_Timer; uint32 CorruptForces_Timer; - void Reset() { Wrath_Timer = 8000; EntanglingRoots_Timer = 2000; CorruptForces_Timer = 30000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { m_creature->SummonCreature(13716, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Wrath if (Wrath_Timer < diff) { @@ -63,14 +53,12 @@ struct TRINITY_DLL_DECL celebras_the_cursedAI : public ScriptedAI DoCast(target,SPELL_WRATH); Wrath_Timer = 8000; }else Wrath_Timer -= diff; - //EntanglingRoots if (EntanglingRoots_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ENTANGLINGROOTS); EntanglingRoots_Timer = 20000; }else EntanglingRoots_Timer -= diff; - //CorruptForces if (CorruptForces_Timer < diff) { @@ -78,7 +66,6 @@ struct TRINITY_DLL_DECL celebras_the_cursedAI : public ScriptedAI DoCast(m_creature,SPELL_CORRUPT_FORCES); CorruptForces_Timer = 20000; }else CorruptForces_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -86,7 +73,6 @@ CreatureAI* GetAI_celebras_the_cursed(Creature* pCreature) { return new celebras_the_cursedAI (pCreature); } - void AddSC_boss_celebras_the_cursed() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_landslide.cpp b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_landslide.cpp index 736636b69ee..4babfab7223 100644 --- a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_landslide.cpp +++ b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_landslide.cpp @@ -13,58 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Landslide SD%Complete: 100 SDComment: SDCategory: Maraudon EndScriptData */ - #include "precompiled.h" - #define SPELL_KNOCKAWAY 18670 #define SPELL_TRAMPLE 5568 #define SPELL_LANDSLIDE 21808 - struct TRINITY_DLL_DECL boss_landslideAI : public ScriptedAI { boss_landslideAI(Creature *c) : ScriptedAI(c) {} - uint32 KnockAway_Timer; uint32 Trample_Timer; uint32 Landslide_Timer; - void Reset() { KnockAway_Timer = 8000; Trample_Timer = 2000; Landslide_Timer = 0; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //KnockAway_Timer if (KnockAway_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKAWAY); KnockAway_Timer = 15000; }else KnockAway_Timer -= diff; - //Trample_Timer if (Trample_Timer < diff) { DoCast(m_creature,SPELL_TRAMPLE); Trample_Timer = 8000; }else Trample_Timer -= diff; - //Landslide if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50) { @@ -75,7 +64,6 @@ struct TRINITY_DLL_DECL boss_landslideAI : public ScriptedAI Landslide_Timer = 60000; } else Landslide_Timer -= diff; } - DoMeleeAttackIfReady(); } }; @@ -83,7 +71,6 @@ CreatureAI* GetAI_boss_landslide(Creature* pCreature) { return new boss_landslideAI (pCreature); } - void AddSC_boss_landslide() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_noxxion.cpp b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_noxxion.cpp index add73e2c60f..fd26e8126b5 100644 --- a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_noxxion.cpp +++ b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_noxxion.cpp @@ -13,23 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Noxxion SD%Complete: 100 SDComment: SDCategory: Maraudon EndScriptData */ - #include "precompiled.h" - #define SPELL_TOXICVOLLEY 21687 #define SPELL_UPPERCUT 22916 - struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI { boss_noxxionAI(Creature *c) : ScriptedAI(c) {} - uint32 ToxicVolley_Timer; uint32 Uppercut_Timer; uint32 Adds_Timer; @@ -39,7 +34,6 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI int RandX; int RandY; Creature* Summoned; - void Reset() { ToxicVolley_Timer = 7000; @@ -48,11 +42,9 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI Invisible_Timer = 15000; //Too much too low? Invisible = false; } - void EnterCombat(Unit *who) { } - void SummonAdds(Unit* victim) { Rand = rand()%8; @@ -73,7 +65,6 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI if (Summoned) (Summoned->AI())->AttackStart(victim); } - void UpdateAI(const uint32 diff) { if (Invisible && Invisible_Timer < diff) @@ -91,25 +82,21 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI //Do nothing while invisible return; } - //Return since we have no target if (!UpdateVictim()) return; - //ToxicVolley_Timer if (ToxicVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TOXICVOLLEY); ToxicVolley_Timer = 9000; }else ToxicVolley_Timer -= diff; - //Uppercut_Timer if (Uppercut_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_UPPERCUT); Uppercut_Timer = 12000; }else Uppercut_Timer -= diff; - //Adds_Timer if (!Invisible && Adds_Timer < diff) { @@ -127,10 +114,8 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI SummonAdds(m_creature->getVictim()); Invisible = true; Invisible_Timer = 15000; - Adds_Timer = 40000; }else Adds_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -138,7 +123,6 @@ CreatureAI* GetAI_boss_noxxion(Creature* pCreature) { return new boss_noxxionAI (pCreature); } - void AddSC_boss_noxxion() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_princess_theradras.cpp b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_princess_theradras.cpp index 53544d9dcdb..3e799b88ad7 100644 --- a/src/bindings/scripts/scripts/kalimdor/maraudon/boss_princess_theradras.cpp +++ b/src/bindings/scripts/scripts/kalimdor/maraudon/boss_princess_theradras.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Princess_Theradras SD%Complete: 100 SDComment: SDCategory: Maraudon EndScriptData */ - #include "precompiled.h" - #define SPELL_DUSTFIELD 21909 #define SPELL_BOULDER 21832 #define SPELL_THRASH 3391 #define SPELL_REPULSIVEGAZE 21869 - struct TRINITY_DLL_DECL boss_ptheradrasAI : public ScriptedAI { boss_ptheradrasAI(Creature *c) : ScriptedAI(c) {} - uint32 Dustfield_Timer; uint32 Boulder_Timer; uint32 Thrash_Timer; uint32 RepulsiveGaze_Timer; - void Reset() { Dustfield_Timer = 8000; @@ -44,28 +38,23 @@ struct TRINITY_DLL_DECL boss_ptheradrasAI : public ScriptedAI Thrash_Timer = 5000; RepulsiveGaze_Timer = 23000; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* Killer) { m_creature->SummonCreature(12238,28.067,61.875,-123.405,4.67,TEMPSUMMON_TIMED_DESPAWN,600000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Dustfield_Timer if (Dustfield_Timer < diff) { DoCast(m_creature,SPELL_DUSTFIELD); Dustfield_Timer = 14000; }else Dustfield_Timer -= diff; - //Boulder_Timer if (Boulder_Timer < diff) { @@ -75,21 +64,18 @@ struct TRINITY_DLL_DECL boss_ptheradrasAI : public ScriptedAI DoCast(target,SPELL_BOULDER); Boulder_Timer = 10000; }else Boulder_Timer -= diff; - //RepulsiveGaze_Timer if (RepulsiveGaze_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_REPULSIVEGAZE); RepulsiveGaze_Timer = 20000; }else RepulsiveGaze_Timer -= diff; - //Thrash_Timer if (Thrash_Timer < diff) { DoCast(m_creature,SPELL_THRASH); Thrash_Timer = 18000; }else Thrash_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -97,7 +83,6 @@ CreatureAI* GetAI_boss_ptheradras(Creature* pCreature) { return new boss_ptheradrasAI (pCreature); } - void AddSC_boss_ptheradras() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/moonglade.cpp b/src/bindings/scripts/scripts/kalimdor/moonglade.cpp index 7e52c16b74d..b50a3b3e932 100644 --- a/src/bindings/scripts/scripts/kalimdor/moonglade.cpp +++ b/src/bindings/scripts/scripts/kalimdor/moonglade.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Moonglade SD%Complete: 100 SDComment: Quest support: 30, 272, 5929, 5930, 10965. Special Flight Paths for Druid class. SDCategory: Moonglade EndScriptData */ - /* ContentData npc_bunthen_plainswind npc_great_bear_spirit @@ -28,14 +26,11 @@ npc_silva_filnaveth npc_clintar_spirit npc_clintar_dreamwalker EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_bunthen_plainswind ######*/ - enum eBunthen { QUEST_SEA_LION_HORDE = 30, @@ -43,10 +38,8 @@ enum eBunthen TAXI_PATH_ID_ALLY = 315, TAXI_PATH_ID_HORDE = 316 }; - #define GOSSIP_ITEM_THUNDER "I'd like to fly to Thunder Bluff." #define GOSSIP_ITEM_AQ_END "Do you know where I can find Half Pendant of Aquatic Endurance?" - bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) { if (pPlayer->getClass() != CLASS_DRUID) @@ -55,21 +48,17 @@ bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); } else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4918, pCreature->GetGUID()); } return true; } - bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -88,16 +77,13 @@ bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, u } return true; } - /*###### ## npc_great_bear_spirit ######*/ - #define GOSSIP_BEAR1 "What do you represent, spirit?" #define GOSSIP_BEAR2 "I seek to understand the importance of strength of the body." #define GOSSIP_BEAR3 "I seek to understand the importance of strength of the heart." #define GOSSIP_BEAR4 "I have heard your words, Great Bear Spirit, and I understand. I now seek your blessings to fully learn the way of the Claw." - bool GossipHello_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature) { //ally or horde quest @@ -108,10 +94,8 @@ bool GossipHello_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(4718, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -138,14 +122,11 @@ bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## npc_silva_filnaveth ######*/ - #define GOSSIP_ITEM_RUTHERAN "I'd like to fly to Rut'theran Village." #define GOSSIP_ITEM_AQ_AGI "Do you know where I can find Half Pendant of Aquatic Agility?" - bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) { if (pPlayer->getClass() != CLASS_DRUID) @@ -154,21 +135,17 @@ bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); } else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4914, pCreature->GetGUID()); } return true; } - bool GossipSelect_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -187,11 +164,9 @@ bool GossipSelect_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature, uint } return true; } - /*###### ## npc_clintar_spirit ######*/ - float Clintar_spirit_WP[41][5] = { //pos_x pos_y pos_z orien waitTime @@ -237,9 +212,7 @@ float Clintar_spirit_WP[41][5] = {7518.37, -3057.42, 445.584, 0.74, 0}, {7517.51, -3056.3, 444.568, 2.49, 4500} }; - #define ASPECT_RAVEN 22915 - #define ASPECT_RAVEN_SUMMON_X 7472.96 #define ASPECT_RAVEN_SUMMON_Y -3074.18 #define ASPECT_RAVEN_SUMMON_Z 427.566 @@ -247,7 +220,6 @@ float Clintar_spirit_WP[41][5] = #define CLINTAR_SPIRIT_SUMMON_Y -3122.5632 #define CLINTAR_SPIRIT_SUMMON_Z 438.9842 #define CLINTAR_SPIRIT_SUMMON_O 0.8594 - //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. #define CLINTAR_SPIRIT_SAY_START -1000286 #define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287 @@ -256,21 +228,16 @@ float Clintar_spirit_WP[41][5] = #define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 #define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 #define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 - struct TRINITY_DLL_DECL npc_clintar_spiritAI : public npc_escortAI { public: npc_clintar_spiritAI(Creature *c) : npc_escortAI(c) {} - uint32 Step; uint32 CurrWP; uint32 Event_Timer; uint32 checkPlayer_Timer; - uint64 PlayerGUID; - bool Event_onWait; - void Reset() { if (!PlayerGUID) @@ -283,12 +250,10 @@ public: Event_onWait = false; } } - void JustDied(Unit *killer) { if (!PlayerGUID) return; - Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { @@ -297,7 +262,6 @@ public: Reset(); } } - void EnterEvadeMode() { Player* pPlayer = Unit::GetPlayer(PlayerGUID); @@ -308,7 +272,6 @@ public: } npc_escortAI::EnterEvadeMode(); } - void EnterCombat(Unit* who) { uint32 rnd = rand()%2; @@ -318,14 +281,13 @@ public: case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, m_creature, who); break; } } - void StartEvent(Player* pPlayer) { if (!pPlayer) return; if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { - for(uint8 i = 0; i < 41; ++i) + for (uint8 i = 0; i < 41; ++i) { AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); } @@ -334,17 +296,14 @@ public: } return; } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!PlayerGUID) { m_creature->setDeathState(JUST_DIED); return; } - if (!m_creature->isInCombat() && !Event_onWait) { if (checkPlayer_Timer < diff) @@ -355,17 +314,14 @@ public: checkPlayer_Timer = 1000; }else checkPlayer_Timer -= diff; } - if (Event_onWait && Event_Timer < diff) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) { m_creature->setDeathState(JUST_DIED); return; } - switch(CurrWP) { case 0: @@ -497,10 +453,8 @@ public: Event_onWait = false; break; } - } else if (Event_onWait) Event_Timer -= diff; } - void WaypointReached(uint32 id) { CurrWP = id; @@ -509,18 +463,14 @@ public: Event_onWait = true; } }; - CreatureAI* GetAI_npc_clintar_spirit(Creature* pCreature) { return new npc_clintar_spiritAI (pCreature); } - /*#### # npc_clintar_dreamwalker ####*/ - #define CLINTAR_SPIRIT 22916 - bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Quest const *quest) { if (quest->GetQuestId() == 10965) @@ -531,38 +481,31 @@ bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Q } return true; } - /*#### # ####*/ - void AddSC_moonglade() { Script *newscript; - newscript = new Script; newscript->Name = "npc_bunthen_plainswind"; newscript->pGossipHello = &GossipHello_npc_bunthen_plainswind; newscript->pGossipSelect = &GossipSelect_npc_bunthen_plainswind; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_great_bear_spirit"; newscript->pGossipHello = &GossipHello_npc_great_bear_spirit; newscript->pGossipSelect = &GossipSelect_npc_great_bear_spirit; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_silva_filnaveth"; newscript->pGossipHello = &GossipHello_npc_silva_filnaveth; newscript->pGossipSelect = &GossipSelect_npc_silva_filnaveth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_clintar_dreamwalker"; newscript->pQuestAccept = &QuestAccept_npc_clintar_dreamwalker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_clintar_spirit"; newscript->GetAI = &GetAI_npc_clintar_spirit; diff --git a/src/bindings/scripts/scripts/kalimdor/mulgore.cpp b/src/bindings/scripts/scripts/kalimdor/mulgore.cpp index 0fcd62cd8df..974402849a0 100644 --- a/src/bindings/scripts/scripts/kalimdor/mulgore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/mulgore.cpp @@ -13,77 +13,60 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Mulgore SD%Complete: 100 SDComment: Support for quest: 11129, 772 SDCategory: Mulgore EndScriptData */ - /* ContentData npc_skorn_whitecloud npc_kyle_frenzied npc_plains_vision EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### # npc_skorn_whitecloud ######*/ - #define GOSSIP_SW "Tell me a story, Skorn." - bool GossipHello_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (!pPlayer->GetQuestRewardStatus(770)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(522, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) pPlayer->SEND_GOSSIP_MENU(523, pCreature->GetGUID()); - return true; } - /*##### # npc_kyle_frenzied ######*/ - enum eKyleFrenzied { //emote signed for 7780 but propably thats wrong id. EMOTE_SEE_LUNCH = -1000407, EMOTE_EAT_LUNCH = -1000408, EMOTE_DANCE = -1000409, - SPELL_LUNCH = 42222, NPC_KYLE_FRENZIED = 23616, NPC_KYLE_FRIENDLY = 23622, POINT_ID = 1 }; - struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI { npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} - bool bEvent; bool m_bIsMovingToLunch; uint64 uiPlayerGUID; uint32 uiEventTimer; uint8 uiEventPhase; - void Reset() { bEvent = false; @@ -91,52 +74,43 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI uiPlayerGUID = 0; uiEventTimer = 5000; uiEventPhase = 0; - if (m_creature->GetEntry() == NPC_KYLE_FRIENDLY) m_creature->UpdateEntry(NPC_KYLE_FRENZIED); } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (!m_creature->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) { if (pCaster->GetTypeId() == TYPEID_PLAYER) uiPlayerGUID = pCaster->GetGUID(); - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { m_creature->GetMotionMaster()->MovementExpired(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->StopMoving(); } - bEvent = true; DoScriptText(EMOTE_SEE_LUNCH, m_creature); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); } } - void MovementInform(uint32 uiType, uint32 uiPointId) { if (uiType != POINT_MOTION_TYPE || !bEvent) return; - if (uiPointId == POINT_ID) m_bIsMovingToLunch = false; } - void UpdateAI(const uint32 diff) { if (bEvent) { if (m_bIsMovingToLunch) return; - if (uiEventTimer < diff) { uiEventTimer = 5000; ++uiEventPhase; - switch(uiEventPhase) { case 1: @@ -156,7 +130,6 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI case 3: if (Player* pUnit = Unit::GetPlayer(uiPlayerGUID)) pUnit->TalkedToCreature(m_creature->GetEntry(), m_creature->GetGUID()); - m_creature->UpdateEntry(NPC_KYLE_FRIENDLY); break; case 4: @@ -176,16 +149,13 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_kyle_frenzied(Creature* pCreature) { return new npc_kyle_frenziedAI (pCreature); } - /*##### # npc_plains_vision ######*/ - float wp_plain_vision[50][3] = { {-2226.32, -408.095, -9.36235}, @@ -239,29 +209,23 @@ float wp_plain_vision[50][3] = {-1511.39, 362.537, 62.4539}, {-1508.68, 366.822, 62.733} }; - struct TRINITY_DLL_DECL npc_plains_visionAI : public ScriptedAI { npc_plains_visionAI(Creature *c) : ScriptedAI(c) {} - bool newWaypoint; uint8 WayPointId; uint8 amountWP; - void Reset() { WayPointId = 0; newWaypoint = true; amountWP = 49; } - void EnterCombat(Unit* who){} - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id < amountWP) { ++WayPointId; @@ -273,7 +237,6 @@ struct TRINITY_DLL_DECL npc_plains_visionAI : public ScriptedAI m_creature->RemoveCorpse(); } } - void UpdateAI(const uint32 diff) { if (newWaypoint) @@ -283,31 +246,25 @@ struct TRINITY_DLL_DECL npc_plains_visionAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_plains_vision(Creature* pCreature) { return new npc_plains_visionAI (pCreature); } - /*##### # ######*/ - void AddSC_mulgore() { Script *newscript; - newscript = new Script; newscript->Name = "npc_skorn_whitecloud"; newscript->pGossipHello = &GossipHello_npc_skorn_whitecloud; newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kyle_frenzied"; newscript->GetAI = &GetAI_npc_kyle_frenzied; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_plains_vision"; newscript->GetAI = &GetAI_npc_plains_vision; diff --git a/src/bindings/scripts/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp b/src/bindings/scripts/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp index 3c635526d2e..fe1b71f0b04 100644 --- a/src/bindings/scripts/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp +++ b/src/bindings/scripts/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp @@ -13,39 +13,30 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Onyxia SD%Complete: 90 SDComment: Spell Heated Ground is wrong, flying animation, visual for area effect SDCategory: Onyxia's Lair EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1249000 #define SAY_KILL -1249001 #define SAY_PHASE_2_TRANS -1249002 #define SAY_PHASE_3_TRANS -1249003 #define EMOTE_BREATH -1249004 - #define SPELL_WINGBUFFET 18500 #define SPELL_FLAMEBREATH 18435 #define SPELL_CLEAVE 19983 #define SPELL_TAILSWEEP 15847 #define SPELL_KNOCK_AWAY 19633 - #define SPELL_ENGULFINGFLAMES 20019 #define SPELL_DEEPBREATH 23461 #define SPELL_FIREBALL 18392 - #define SPELL_BELLOWINGROAR 18431 #define SPELL_HEATED_GROUND 22191 //Wrong Spell - #define SPELL_SUMMONWHELP 17646 - #define CREATURE_WHELP 11262 - static float MovementLocations[4][3]= { {-64.0523, -213.0619, -68.2985}, @@ -53,7 +44,6 @@ static float MovementLocations[4][3]= {-38.8391, -182.3220, -68.9457}, {-37.0390, -244.8760, -68.1278} }; - static float SpawnLocations[4][3]= { {-30.127, -254.463, -89.440}, @@ -61,13 +51,10 @@ static float SpawnLocations[4][3]= {14.480, -241.560, -85.6300}, {17.372, -190.840, -85.2810}, }; - struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI { boss_onyxiaAI(Creature* c) : ScriptedAI(c) {} - uint32 Phase; - uint32 FlameBreathTimer; uint32 CleaveTimer; uint32 TailSweepTimer; @@ -78,13 +65,10 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI uint32 WingBuffetTimer; uint32 KnockAwayTimer; uint32 FireballTimer; - bool InitialSpawn; - void Reset() { Phase = 1; - FlameBreathTimer = 20000; TailSweepTimer = 2000; CleaveTimer = 15000; @@ -95,30 +79,24 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI WingBuffetTimer = 17000; KnockAwayTimer = 15000; FireballTimer = 18000; - InitialSpawn = true; } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); } - void JustDied(Unit* Killer) { } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (Phase == 1)) { Phase = 2; @@ -128,7 +106,6 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); DoScriptText(SAY_PHASE_2_TRANS, m_creature); } - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (Phase == 2)) { Phase = 3; @@ -140,7 +117,6 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI DoScriptText(SAY_PHASE_3_TRANS, m_creature); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } - if (Phase == 1 || Phase == 3) { if (FlameBreathTimer < diff) @@ -148,28 +124,23 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH); FlameBreathTimer = 15000; }else FlameBreathTimer -= diff; - if (TailSweepTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (target && !m_creature->HasInArc(M_PI, target)) DoCast(target, SPELL_TAILSWEEP); - TailSweepTimer = 10000; }else TailSweepTimer -= diff; - if (CleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); CleaveTimer = 10000; }else CleaveTimer -= diff; - if (WingBuffetTimer < diff) { DoCast(m_creature->getVictim(), SPELL_WINGBUFFET); WingBuffetTimer = 7000 + ((rand()%8)*1000); }else WingBuffetTimer -= diff; - if (KnockAwayTimer < diff) { if (rand() <= 30) @@ -178,34 +149,27 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI } KnockAwayTimer = 15000; }else KnockAwayTimer -= diff; - if (Phase == 3) { if (BellowingRoarTimer < diff) { DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); - BellowingRoarTimer = 30000; }else BellowingRoarTimer -= diff; - if (SummonWhelpsTimer < diff) { SummonWhelps(Phase); - SummonWhelpsTimer = 45000; }else SummonWhelpsTimer -= diff; } - DoMeleeAttackIfReady(); } - if (Phase == 2) { if (InitialSpawn) { InitialSpawn = false; - - for(uint32 i = 0; i < 10; ++i) + for (uint32 i = 0; i < 10; ++i) { uint32 random = rand()%4; Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -213,24 +177,19 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } - if (EngulfingFlamesTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES); m_creature->HandleEmoteCommand(ANIM_FLY); - EngulfingFlamesTimer = 10000; } else EngulfingFlamesTimer -= diff; - if (FireballTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); - FireballTimer = 18000; } else FireballTimer -= diff; - if (MovementTimer < diff) { if (rand()%100 < 30) @@ -239,33 +198,28 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_DEEPBREATH); } else ChangePosition(); - MovementTimer = 25000; }else MovementTimer -= diff; - if (SummonWhelpsTimer < diff) { SummonWhelps(Phase); - SummonWhelpsTimer = 45000; } else SummonWhelpsTimer -= diff; } } - void ChangePosition() { uint32 random = rand() % 4; if (random<4){ m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);} } - void SummonWhelps(uint32 Phase) { if (Phase == 2) { uint32 max = rand()%10; - for(uint32 i = 0; i < max; ++i) + for (uint32 i = 0; i < max; ++i) { uint32 random = rand()%3; Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -273,13 +227,12 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } - if (Phase == 3) { uint32 max = rand() % 10 +1; if (max < 5) { - for(uint32 i = 0; i < max; ++i) + for (uint32 i = 0; i < max; ++i) { uint32 random = rand()%4; Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -290,12 +243,10 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_onyxiaAI(Creature* pCreature) { return new boss_onyxiaAI (pCreature); } - void AddSC_boss_onyxia() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp b/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp index 30129b7e037..9ace405eefc 100644 --- a/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp +++ b/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp @@ -13,42 +13,33 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Orgrimmar SD%Complete: 100 SDComment: Quest support: 2460, 5727, 6566 SDCategory: Orgrimmar EndScriptData */ - /* ContentData npc_neeru_fireblade npc_text + gossip options text missing npc_shenthul npc_thrall_warchief EndContentData */ - #include "precompiled.h" - /*###### ## npc_neeru_fireblade ######*/ - #define QUEST_5727 5727 - #define GOSSIP_HNF "You may speak frankly, Neeru..." #define GOSSIP_SNF "[PH] ..." bool GossipHello_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -64,26 +55,21 @@ bool GossipSelect_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature, uint } return true; } - /*###### ## npc_shenthul ######*/ - enum eShenthul { QUEST_SHATTERED_SALUTE = 2460 }; - struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI { npc_shenthulAI(Creature* c) : ScriptedAI(c) {} - bool CanTalk; bool CanEmote; uint32 Salute_Timer; uint32 Reset_Timer; uint64 PlayerGUID; - void Reset() { CanTalk = false; @@ -92,9 +78,7 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI Reset_Timer = 0; PlayerGUID = 0; } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (CanEmote) @@ -109,7 +93,6 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI Reset(); } else Reset_Timer -= diff; } - if (CanTalk && !CanEmote) { if (Salute_Timer < diff) @@ -119,13 +102,10 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI Reset_Timer = 60000; } else Salute_Timer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void ReceiveEmote(Player* pPlayer, uint32 emote) { if (emote == TEXTEMOTE_SALUTE && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) @@ -138,12 +118,10 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_shenthul(Creature* pCreature) { return new npc_shenthulAI (pCreature); } - bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_SHATTERED_SALUTE) @@ -153,16 +131,12 @@ bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* } return true; } - /*###### ## npc_thrall_warchief ######*/ - #define QUEST_6566 6566 - #define SPELL_CHAIN_LIGHTNING 16033 #define SPELL_SHOCK 16034 - #define GOSSIP_HTW "Please share your wisdom with me, Warchief." #define GOSSIP_STW1 "What discoveries?" #define GOSSIP_STW2 "Usurper?" @@ -170,40 +144,32 @@ bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* #define GOSSIP_STW4 "I... I did not think of it that way, Warchief." #define GOSSIP_STW5 "I live only to serve, Warchief! My life is empty and meaningless without your guidance." #define GOSSIP_STW6 "Of course, Warchief!" - //TODO: verify abilities/timers struct TRINITY_DLL_DECL npc_thrall_warchiefAI : public ScriptedAI { npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} - uint32 ChainLightning_Timer; uint32 Shock_Timer; - void Reset() { ChainLightning_Timer = 2000; Shock_Timer = 8000; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ChainLightning_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CHAIN_LIGHTNING); ChainLightning_Timer = 9000; }else ChainLightning_Timer -= diff; - if (Shock_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHOCK); Shock_Timer = 15000; }else Shock_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -211,19 +177,15 @@ CreatureAI* GetAI_npc_thrall_warchief(Creature* pCreature) { return new npc_thrall_warchiefAI (pCreature); } - bool GossipHello_npc_thrall_warchief(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_thrall_warchief(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -259,23 +221,19 @@ bool GossipSelect_npc_thrall_warchief(Player* pPlayer, Creature* pCreature, uint } return true; } - void AddSC_orgrimmar() { Script *newscript; - newscript = new Script; newscript->Name = "npc_neeru_fireblade"; newscript->pGossipHello = &GossipHello_npc_neeru_fireblade; newscript->pGossipSelect = &GossipSelect_npc_neeru_fireblade; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_shenthul"; newscript->GetAI = &GetAI_npc_shenthul; newscript->pQuestAccept = &QuestAccept_npc_shenthul; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_thrall_warchief"; newscript->GetAI = &GetAI_npc_thrall_warchief; diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp index 10f211666a1..435a38bf477 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp @@ -13,38 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Amnennar_the_coldbringer SD%Complete: 100 SDComment: SDCategory: Razorfen Downs EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1129000 #define SAY_SUMMON60 -1129001 #define SAY_SUMMON30 -1129002 #define SAY_HP -1129003 #define SAY_KILL -1129004 - #define SPELL_AMNENNARSWRATH 13009 #define SPELL_FROSTBOLT 15530 #define SPELL_FROST_NOVA 15531 #define SPELL_FROST_SPECTRES 12642 - struct TRINITY_DLL_DECL boss_amnennar_the_coldbringerAI : public ScriptedAI { boss_amnennar_the_coldbringerAI(Creature *c) : ScriptedAI(c) {} - uint32 AmnenarsWrath_Timer; uint32 FrostBolt_Timer; uint32 FrostNova_Timer; bool Spectrals60; bool Spectrals30; bool Hp; - void Reset() { AmnenarsWrath_Timer = 8000; @@ -54,71 +47,59 @@ struct TRINITY_DLL_DECL boss_amnennar_the_coldbringerAI : public ScriptedAI Spectrals60 = false; Hp = false; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit() { DoScriptText(SAY_KILL, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //AmnenarsWrath_Timer if (AmnenarsWrath_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_AMNENNARSWRATH); AmnenarsWrath_Timer = 12000; } else AmnenarsWrath_Timer -= diff; - //FrostBolt_Timer if (FrostBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); FrostBolt_Timer = 8000; } else FrostBolt_Timer -= diff; - if (FrostNova_Timer < diff) { DoCast(m_creature,SPELL_FROST_NOVA); FrostNova_Timer = 15000; } else FrostNova_Timer -= diff; - if (!Spectrals60 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 60) { DoScriptText(SAY_SUMMON60, m_creature); DoCast(m_creature->getVictim(),SPELL_FROST_SPECTRES); Spectrals60 = true; } - if (!Hp && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50) { DoScriptText(SAY_HP, m_creature); Hp = true; } - if (!Spectrals30 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) { DoScriptText(SAY_SUMMON30, m_creature); DoCast(m_creature->getVictim(),SPELL_FROST_SPECTRES); Spectrals30 = true; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_amnennar_the_coldbringer(Creature* pCreature) { return new boss_amnennar_the_coldbringerAI (pCreature); } - void AddSC_boss_amnennar_the_coldbringer() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp index 0d133a0db0b..4f580fa7efd 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Razorfen_Downs SD%Complete: 100 SDComment: Support for Henry Stern(2 recipes) SDCategory: Razorfen Downs EndScriptData */ - /* ContentData npc_henry_stern EndContentData */ - #include "precompiled.h" - /*### # npc_henry_stern ####*/ - enum eEnums { SPELL_GOLDTHORN_TEA = 13028, @@ -40,22 +35,17 @@ enum eEnums GOSSIP_TEXT_TEA_ANSWER = 2114, GOSSIP_TEXT_POTION_ANSWER = 2115, }; - #define GOSSIP_ITEM_TEA "Teach me the cooking recipe" #define GOSSIP_ITEM_POTION "Teach me the alchemy recipe" - bool GossipHello_npc_henry_stern (Player* pPlayer, Creature* pCreature) { if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -63,20 +53,16 @@ bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 pCreature->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true); pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) { pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID()); pCreature->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); } - return true; } - void AddSC_razorfen_downs() { Script* newscript; - newscript = new Script; newscript->Name = "npc_henry_stern"; newscript->pGossipHello = &GossipHello_npc_henry_stern; diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/def_razorfen_kraul.h b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/def_razorfen_kraul.h index d40abd7f2fd..f9bc63e7c0a 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/def_razorfen_kraul.h +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/def_razorfen_kraul.h @@ -13,9 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_RAZORFEN_KRAUL_H #define DEF_RAZORFEN_KRAUL_H - #define TYPE_WARD_KEEPERS 1 -#endif \ No newline at end of file +#endif diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp index ed139ea45e9..2899d279f77 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp @@ -13,42 +13,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Razorfen_Kraul SD%Complete: SDComment: SDCategory: Razorfen Kraul EndScriptData */ - #include "precompiled.h" #include "def_razorfen_kraul.h" - #define WARD_KEEPERS_NR 2 - struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance { instance_razorfen_kraul(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 DoorWardGUID; uint32 WardCheck_Timer; int WardKeeperAlive; - void Initialize() { WardKeeperAlive = 1; WardCheck_Timer = 4000; DoorWardGUID = 0; } - Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* plr = itr->getSource()) return plr; @@ -57,7 +49,6 @@ struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance debug_log("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); return NULL; } - void OnGameObjectCreate(GameObject* pGo, bool apply) { switch(pGo->GetEntry()) @@ -65,7 +56,6 @@ struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance case 21099: DoorWardGUID = pGo->GetGUID(); break; } } - void Update(uint32 diff) { if (WardCheck_Timer < diff) @@ -76,7 +66,6 @@ struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance }else WardCheck_Timer -= diff; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -87,14 +76,11 @@ struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance break; } } - }; - InstanceData* GetInstanceData_instance_razorfen_kraul(Map* pMap) { return new instance_razorfen_kraul(pMap); } - void AddSC_instance_razorfen_kraul() { Script *newscript; @@ -102,4 +88,4 @@ void AddSC_instance_razorfen_kraul() newscript->Name = "instance_razorfen_kraul"; newscript->GetInstanceData = &GetInstanceData_instance_razorfen_kraul; newscript->RegisterSelf(); -} \ No newline at end of file +} diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp index fec2cf711da..42de72fb63c 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Razorfen Kraul SD%Complete: 100 SDComment: Quest support: 1144 SDCategory: Razorfen Kraul EndScriptData */ - /* ContentData npc_willix EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_razorfen_kraul.h" - #define SAY_READY -1047000 #define SAY_POINT -10470001 #define SAY_AGGRO1 -1047002 @@ -40,22 +36,17 @@ EndContentData */ #define SAY_FINALY -1047008 #define SAY_WIN -1047009 #define SAY_END -1047010 - #define QUEST_WILLIX_THE_IMPORTER 1144 #define ENTRY_BOAR 4514 #define SPELL_QUILLBOAR_CHANNELING 7083 - struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI { npc_willixAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { case 3: @@ -99,26 +90,21 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI break; } } - void Reset() {} - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO1, m_creature, NULL); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) { if (Player* pPlayer = GetPlayerForEscort()) CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); } }; - bool QuestAccept_npc_willix(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) @@ -127,33 +113,26 @@ bool QuestAccept_npc_willix(Player* pPlayer, Creature* pCreature, Quest const* q DoScriptText(SAY_READY, pCreature, pPlayer); pCreature->setFaction(113); } - return true; } - struct TRINITY_DLL_DECL npc_deaths_head_ward_keeperAI : public ScriptedAI { npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 QuillboarChanneling_Timer; - void Reset() { QuillboarChanneling_Timer = 1500; } - void UpdateAI(const uint32 diff) { if (!m_creature->isAlive()) return; - if (pInstance) pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED); - if (QuillboarChanneling_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) @@ -161,30 +140,24 @@ struct TRINITY_DLL_DECL npc_deaths_head_ward_keeperAI : public ScriptedAI DoCast(m_creature, SPELL_QUILLBOAR_CHANNELING); QuillboarChanneling_Timer = 1100; }else QuillboarChanneling_Timer -= diff; - } }; - CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) { return new npc_deaths_head_ward_keeperAI(pCreature); } - CreatureAI* GetAI_npc_willix(Creature* pCreature) { return new npc_willixAI(pCreature); } - void AddSC_razorfen_kraul() { Script *newscript; - newscript = new Script; newscript->Name = "npc_willix"; newscript->GetAI = &GetAI_npc_willix; newscript->pQuestAccept = &QuestAccept_npc_willix; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_deaths_head_ward_keeper"; newscript->GetAI = &GetAI_npc_deaths_head_ward_keeper; diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp index 84e34924958..d6bb995dbd6 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ayamiss SD%Complete: 50 SDComment: VERIFY SCRIPT SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - /* To do: make him fly from 70-100% */ - #define SPELL_STINGERSPRAY 25749 #define SPELL_POISONSTINGER 25748 //only used in phase1 #define SPELL_SUMMONSWARMER 25844 //might be 25708 // #define SPELL_PARALYZE 23414 doesnt work correct (core) - struct TRINITY_DLL_DECL boss_ayamissAI : public ScriptedAI { boss_ayamissAI(Creature *c) : ScriptedAI(c) {} - Unit *pTarget; uint32 STINGERSPRAY_Timer; uint32 POISONSTINGER_Timer; uint32 SUMMONSWARMER_Timer; uint32 phase; - void Reset() { pTarget = NULL; @@ -51,44 +44,37 @@ struct TRINITY_DLL_DECL boss_ayamissAI : public ScriptedAI SUMMONSWARMER_Timer = 60000; phase=1; } - void EnterCombat(Unit *who) { pTarget = who; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If he is 70% start phase 2 if (phase==1 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 70 && !m_creature->IsNonMeleeSpellCasted(false)) { phase=2; } - //STINGERSPRAY_Timer (only in phase2) if (phase==2 && STINGERSPRAY_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_STINGERSPRAY); STINGERSPRAY_Timer = 30000; }else STINGERSPRAY_Timer -= diff; - //POISONSTINGER_Timer (only in phase1) if (phase==1 && POISONSTINGER_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_POISONSTINGER); POISONSTINGER_Timer = 30000; }else POISONSTINGER_Timer -= diff; - //SUMMONSWARMER_Timer (only in phase1) if (SUMMONSWARMER_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUMMONSWARMER); SUMMONSWARMER_Timer = 60000; }else SUMMONSWARMER_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -96,7 +82,6 @@ CreatureAI* GetAI_boss_ayamiss(Creature* pCreature) { return new boss_ayamissAI (pCreature); } - void AddSC_boss_ayamiss() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp index 58c48540362..80dd3bff06f 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp @@ -13,15 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Buru SD%Complete: 0 SDComment: Place Holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define EMOTE_TARGET -1509002 diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp index 5096b60ccdf..03222740da2 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp @@ -13,29 +13,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kurinnaxx SD%Complete: 100 SDComment: VERIFY SCRIPT AND SQL SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SPELL_MORTALWOUND 25646 #define SPELL_SANDTRAP 25656 #define SPELL_ENRAGE 28798 - struct TRINITY_DLL_DECL boss_kurinnaxxAI : public ScriptedAI { boss_kurinnaxxAI(Creature *c) : ScriptedAI(c) {} - Unit *pTarget; uint32 MORTALWOUND_Timer; uint32 SANDTRAP_Timer; uint32 i; - void Reset() { i=0; @@ -43,38 +37,32 @@ struct TRINITY_DLL_DECL boss_kurinnaxxAI : public ScriptedAI MORTALWOUND_Timer = 30000; SANDTRAP_Timer = 30000; } - void EnterCombat(Unit *who) { pTarget = who; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <30% cast enrage if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->IsNonMeleeSpellCasted(false)) { i=1; DoCast(m_creature->getVictim(),SPELL_ENRAGE); } - //MORTALWOUND_Timer if (MORTALWOUND_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALWOUND); MORTALWOUND_Timer = 30000; }else MORTALWOUND_Timer -= diff; - //SANDTRAP_Timer if (SANDTRAP_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SANDTRAP); SANDTRAP_Timer = 30000; }else SANDTRAP_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -82,7 +70,6 @@ CreatureAI* GetAI_boss_kurinnaxx(Creature* pCreature) { return new boss_kurinnaxxAI (pCreature); } - void AddSC_boss_kurinnaxx() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_moam.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_moam.cpp index 1e5ca42d044..7be14a98f3c 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_moam.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_moam.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Moam SD%Complete: 100 SDComment: VERIFY SCRIPT AND SQL SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define EMOTE_AGGRO -1509000 #define EMOTE_MANA_FULL -1509001 - #define SPELL_TRAMPLE 15550 #define SPELL_DRAINMANA 27256 #define SPELL_ARCANEERUPTION 25672 #define SPELL_SUMMONMANA 25681 #define SPELL_GRDRSLEEP 24360 //Greater Dreamless Sleep - struct TRINITY_DLL_DECL boss_moamAI : public ScriptedAI { boss_moamAI(Creature *c) : ScriptedAI(c) {} - Unit *pTarget; uint32 TRAMPLE_Timer; uint32 DRAINMANA_Timer; uint32 SUMMONMANA_Timer; uint32 i; uint32 j; - void Reset() { i=0; @@ -51,25 +44,21 @@ struct TRINITY_DLL_DECL boss_moamAI : public ScriptedAI TRAMPLE_Timer = 30000; DRAINMANA_Timer = 30000; } - void EnterCombat(Unit *who) { DoScriptText(EMOTE_AGGRO, m_creature); pTarget = who; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are 100%MANA cast Arcane Erruption //if (j==1 && m_creature->GetMana()*100 / m_creature->GetMaxMana() == 100 && !m_creature->IsNonMeleeSpellCasted(false)) { DoCast(m_creature->getVictim(),SPELL_ARCANEERUPTION); DoScriptText(EMOTE_MANA_FULL, m_creature); } - //If we are <50%HP cast MANA FIEND (Summon Mana) and Sleep //if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->IsNonMeleeSpellCasted(false)) { @@ -77,30 +66,25 @@ struct TRINITY_DLL_DECL boss_moamAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_SUMMONMANA); DoCast(m_creature->getVictim(),SPELL_GRDRSLEEP); } - //SUMMONMANA_Timer if (i==1 && SUMMONMANA_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUMMONMANA); SUMMONMANA_Timer = 90000; }else SUMMONMANA_Timer -= diff; - //TRAMPLE_Timer if (TRAMPLE_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TRAMPLE); j=1; - TRAMPLE_Timer = 30000; }else TRAMPLE_Timer -= diff; - //DRAINMANA_Timer if (DRAINMANA_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DRAINMANA); DRAINMANA_Timer = 30000; }else DRAINMANA_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -108,7 +92,6 @@ CreatureAI* GetAI_boss_moam(Creature* pCreature) { return new boss_moamAI (pCreature); } - void AddSC_boss_moam() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp index 5652b706917..cd5e65a29bd 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp @@ -13,26 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ossirian SD%Complete: 0 SDComment: Place holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SAY_SURPREME2 -1509019 #define SAY_SURPREME3 -1509020 - #define SAY_RAND_INTRO1 -1509021 #define SAY_RAND_INTRO2 -1509022 #define SAY_RAND_INTRO3 -1509023 #define SAY_RAND_INTRO4 -1509024 //possibly old? - #define SAY_AGGRO -1509025 - #define SAY_SLAY -1509026 #define SAY_DEATH -1509027 diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp index fb2c92ff59f..6587e92e342 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp @@ -13,33 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Rajaxx SD%Complete: 0 SDComment: Place Holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SAY_ANDOROV_INTRO -1509003 #define SAY_ANDOROV_ATTACK -1509004 - #define SAY_WAVE3 -1509005 #define SAY_WAVE4 -1509006 #define SAY_WAVE5 -1509007 #define SAY_WAVE6 -1509008 #define SAY_WAVE7 -1509009 #define SAY_INTRO -1509010 - #define SAY_UNK1 -1509011 #define SAY_UNK2 -1509012 #define SAY_UNK3 -1509013 #define SAY_UNK4 -1509014 - #define SAY_DEAGGRO -1509015 #define SAY_KILLS_ANDOROV -1509016 - #define SAY_COMPLETE_QUEST -1509017 //Yell when realm complete quest 8743 for world event diff --git a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp index b94e6f16a80..3c42cb587c8 100644 --- a/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp @@ -13,13 +13,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Ruins_of_Ahnqiraj SD%Complete: 0 SDComment: Place holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" diff --git a/src/bindings/scripts/scripts/kalimdor/silithus.cpp b/src/bindings/scripts/scripts/kalimdor/silithus.cpp index 45313fbbc73..c9d2ae36aec 100644 --- a/src/bindings/scripts/scripts/kalimdor/silithus.cpp +++ b/src/bindings/scripts/scripts/kalimdor/silithus.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Silithus SD%Complete: 100 SDComment: Quest support: 7785, 8304, 8507. SDCategory: Silithus EndScriptData */ - /* ContentData npc_highlord_demitrian npcs_rutgar_and_frankal quest_a_pawn_on_the_eternal_pawn EndContentData */ - #include "precompiled.h" - /*### ## npc_highlord_demitrian ###*/ - #define GOSSIP_DEMITRIAN1 "What do you know of it?" #define GOSSIP_DEMITRIAN2 "I am listening , Demitrian." #define GOSSIP_DEMITRIAN3 "Continue, please." @@ -40,20 +35,16 @@ EndContentData */ #define GOSSIP_DEMITRIAN5 "" #define GOSSIP_DEMITRIAN6 "Caught unaware? How?" #define GOSSIP_DEMITRIAN7 "So what did Ragnaros do next?" - bool GossipHello_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(7785) == QUEST_STATUS_NONE && (pPlayer->HasItemCount(18563,1,false) || pPlayer->HasItemCount(18564,1,false))) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(6812, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -84,7 +75,6 @@ bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, u break; case GOSSIP_ACTION_INFO_DEF+6: pPlayer->SEND_GOSSIP_MENU(6870, pCreature->GetGUID()); - ItemPosCountVec dest; uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); if (msg == EQUIP_ERR_OK) @@ -93,51 +83,40 @@ bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, u } return true; } - /*### ## npcs_rutgar_and_frankal ###*/ - //gossip item text best guess #define GOSSIP_ITEM1 "I seek information about Natalia" - #define GOSSIP_ITEM2 "That sounds dangerous!" #define GOSSIP_ITEM3 "What did you do?" #define GOSSIP_ITEM4 "Who?" #define GOSSIP_ITEM5 "Women do that. What did she demand?" #define GOSSIP_ITEM6 "What do you mean?" #define GOSSIP_ITEM7 "What happened next?" - #define GOSSIP_ITEM11 "Yes, please continue" #define GOSSIP_ITEM12 "What language?" #define GOSSIP_ITEM13 "The Priestess attacked you?!" #define GOSSIP_ITEM14 "I should ask the monkey about this" #define GOSSIP_ITEM15 "Then what..." - //trigger creatures to kill #define TRIGGER_RUTGAR 15222 #define TRIGGER_FRANKAL 15221 - bool GossipHello_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && pCreature->GetEntry() == 15170 && !pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && pCreature->GetEntry() == 15171 && pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - pPlayer->SEND_GOSSIP_MENU(7754, pCreature->GetGUID()); - return true; } - bool GossipSelect_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -171,7 +150,6 @@ bool GossipSelect_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature, //'kill' our trigger to update quest status pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF + 9: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); pPlayer->SEND_GOSSIP_MENU(7762, pCreature->GetGUID()); @@ -200,23 +178,19 @@ bool GossipSelect_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature, } return true; } - /*#### # quest_a_pawn_on_the_eternal_board (Defines) ####*/ enum eEternalBoard { QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519, - FACTION_HOSTILE = 14, FACTION_FRIENDLY = 35, - C_ANACHRONOS = 15381, C_FANDRAL_STAGHELM = 15382, C_ARYGOS = 15380, C_MERITHRA = 15378, C_CAELESTRASZ = 15379, - ANACHRONOS_SAY_1 = -1350000, ANACHRONOS_SAY_2 = -1350001, ANACHRONOS_SAY_3 = -1350002, @@ -230,7 +204,6 @@ enum eEternalBoard ANACHRONOS_EMOTE_1 = -1350010, ANACHRONOS_EMOTE_2 = -1350011, ANACHRONOS_EMOTE_3 = -1350012, - FANDRAL_SAY_1 = -1350013, FANDRAL_SAY_2 = -1350014, FANDRAL_SAY_3 = -1350015, @@ -239,20 +212,16 @@ enum eEternalBoard FANDRAL_SAY_6 = -1350018, FANDRAL_EMOTE_1 = -1350019, FANDRAL_EMOTE_2 = -1350020, - CAELESTRASZ_SAY_1 = -1350021, CAELESTRASZ_SAY_2 = -1350022, CAELESTRASZ_YELL_1 = -1350023, - ARYGOS_SAY_1 = -1350024, ARYGOS_YELL_1 = -1350025, ARYGOS_EMOTE_1 = -1350026, - MERITHRA_SAY_1 = -1350027, MERITHRA_SAY_2 = -1350028, MERITHRA_YELL_1 = -1350029, MERITHRA_EMOTE_1 = -1350030, - GO_GATE_OF_AHN_QIRAJ = 176146, GO_GLYPH_OF_AHN_QIRAJ = 176148, GO_ROOTS_OF_AHN_QIRAJ = 176147 @@ -260,7 +229,6 @@ enum eEternalBoard /*##### # Quest: A Pawn on the Eternal Board #####*/ - /* ContentData A Pawn on the Eternal Board - creatures, gameobjects and defines mob_qiraj_war_spawn : Adds that are summoned in the Qiraj gates battle. @@ -270,17 +238,14 @@ go_crystalline_tear : GameObject that begins the event and hands out quest TO DO: get correct spell IDs and timings for spells cast upon dragon transformations TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after transformation,but for some unknown reason it doesnt work. EndContentData */ - #define QUEST_A_PAWN_ON_THE_ETERNAL_BOARD 8519 #define EVENT_AREA_RADIUS 65 //65yds #define EVENT_COOLDOWN 500000 //in ms. appear after event completed or failed (should be = Adds despawn time) - struct QuestCinematic { int32 TextId; uint32 Creature, Timer; }; - // Creature 0 - Anachronos, 1 - Fandral, 2 - Arygos, 3 - Merithra, 4 - Caelestrasz static QuestCinematic EventAnim[]= { @@ -353,12 +318,10 @@ static QuestCinematic EventAnim[]= {NULL, 0, 5000}, {NULL, 0, NULL} }; - struct Location { float x, y, z, o; }; - //Cordinates for Spawns static Location SpawnLocation[]= { @@ -367,13 +330,11 @@ static Location SpawnLocation[]= {-8085, 1524, 2.61, 3.141592},//Kaldorei Infantry {-8080, 1522, 2.61, 3.141592},//Kaldorei Infantry {-8085, 1520, 2.61, 3.141592},//Kaldorei Infantry - {-8085, 1524, 2.61, 3.141592},//Kaldorei Infantry {-8080, 1522, 2.61, 3.141592},//Kaldorei Infantry {-8085, 1520, 2.61, 3.141592},//Kaldorei Infantry {-8080, 1518, 2.61, 3.141592},//Kaldorei Infantry {-8085, 1516, 2.61, 3.141592},//Kaldorei Infantry - {-8085, 1518, 2.61, 3.141592},//Kaldorei Infantry {-8080, 1516, 2.61, 3.141592},//Kaldorei Infantry {-8080, 1520, 2.61, 3.141592},//Kaldorei Infantry @@ -385,62 +346,52 @@ static Location SpawnLocation[]= {-8082, 1524, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1526, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1527, 2.61, 3.141592},//Kaldorei Infantry - {-8082, 1524, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1522, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1520, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1518, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1516, 2.61, 3.141592},//Kaldorei Infantry - {-8082, 1523, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1521, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1528, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1519, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1526, 2.61, 3.141592},//Kaldorei Infantry - {-8082, 1524, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1522, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1520, 2.61, 3.141592},//Kaldorei Infantry {-8078, 1518, 2.61, 3.141592},//Kaldorei Infantry {-8082, 1516, 2.61, 3.141592},//Kaldorei Infantry - {-8088, 1510, 2.61, 0},//Anubisath Conqueror {-8084, 1520, 2.61, 0},//Anubisath Conqueror {-8088, 1530, 2.61, 0},//Anubisath Conqueror - {-8080, 1513, 2.61, 0},//Qiraj Wasp {-8082, 1523, 2.61, 0},//Qiraj Wasp {-8085, 1518, 2.61, 0},//Qiraj Wasp {-8082, 1516, 2.61, 0},//Qiraj Wasp {-8085, 1520, 2.61, 0},//Qiraj Wasp {-8080, 1528, 2.61, 0},//Qiraj Wasp - {-8082, 1513, 2.61, 0},//Qiraj Wasp {-8079, 1523, 2.61, 0},//Qiraj Wasp {-8080, 1531, 2.61, 0},//Qiraj Wasp {-8079, 1516, 2.61, 0},//Qiraj Wasp {-8082, 1520, 2.61, 0},//Qiraj Wasp {-8080, 1518, 2.61, 0},//Qiraj Wasp - {-8081, 1514, 2.61, 0},//Qiraj Tank {-8081, 1520, 2.61, 0},//Qiraj Tank {-8081, 1526, 2.61, 0},//Qiraj Tank {-8081, 1512, 2.61, 0},//Qiraj Tank {-8082, 1520, 2.61, 0},//Qiraj Tank {-8081, 1528, 2.61, 0},//Qiraj Tank - {-8082, 1513, 2.61, 3.141592},//Anubisath Conqueror {-8082, 1520, 2.61, 3.141592},//Anubisath Conqueror {-8082, 1527, 2.61, 3.141592},//Anubisath Conqueror }; - struct WaveData { uint8 SpawnCount, UsedSpawnPoint; uint32 CreatureId, SpawnTimer, YellTimer, DespTimer; int32 WaveTextId; }; - static WaveData WavesInfo[] = { {30, 0, 15423, 0, 0,24000, NULL}, //Kaldorei Soldier @@ -448,14 +399,11 @@ static WaveData WavesInfo[] = {12, 38, 15414, 0, 0,24000, NULL}, //Qiraji Wasps {6, 50, 15422, 0, 0,24000, NULL}, //Qiraji Tanks {15, 15, 15423, 0, 0,24000, NULL} //Kaldorei Soldier - }; - struct SpawnSpells { uint32 Timer1, Timer2, SpellId; }; - static SpawnSpells SpawnCast[]=// { {100000, 2000, 33652}, // Stop Time @@ -469,10 +417,8 @@ static SpawnSpells SpawnCast[]=// struct TRINITY_DLL_DECL npc_anachronos_the_ancientAI : public ScriptedAI { npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} - uint32 AnimationTimer; uint8 AnimationCount; - uint64 AnachronosQuestTriggerGUID; uint64 MerithraGUID; uint64 ArygosGUID; @@ -480,7 +426,6 @@ struct TRINITY_DLL_DECL npc_anachronos_the_ancientAI : public ScriptedAI uint64 FandralGUID; uint64 PlayerGUID; bool eventEnd; - void Reset() { AnimationTimer = 1500; @@ -492,24 +437,19 @@ struct TRINITY_DLL_DECL npc_anachronos_the_ancientAI : public ScriptedAI FandralGUID = 0; PlayerGUID = 0; eventEnd = false; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void HandleAnimation() { Player* plr = Unit::GetPlayer(PlayerGUID); if(!plr) return; - Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, m_creature); Unit* Arygos = plr->FindNearestCreature(C_ARYGOS, 100,m_creature); Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, m_creature); Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,m_creature); - if(!Fandral || !Arygos || !Caelestrasz || !Merithra) return; - Unit* mob; AnimationTimer = EventAnim[AnimationCount].Timer; if (eventEnd == false) @@ -770,15 +710,12 @@ struct TRINITY_DLL_DECL npc_anachronos_the_ancientAI : public ScriptedAI m_creature->AI()->EnterEvadeMode(); } }; - /*###### # mob_qiraj_war_spawn ######*/ - struct TRINITY_DLL_DECL mob_qiraj_war_spawnAI : public ScriptedAI { mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} - uint64 MobGUID; uint64 PlayerGUID; uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; @@ -792,15 +729,12 @@ struct TRINITY_DLL_DECL mob_qiraj_war_spawnAI : public ScriptedAI Timers = false; hasTarget = false; } - void EnterCombat(Unit* who) {} void JustDied(Unit* slayer); - void UpdateAI(const uint32 diff) { Unit* target; Player* plr = m_creature->GetPlayer(PlayerGUID); - if(!Timers) { if(m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414) //all but Kaldorei Soldiers @@ -850,7 +784,6 @@ struct TRINITY_DLL_DECL mob_qiraj_war_spawnAI : public ScriptedAI { uint8 tar; tar = rand()%3; - if (tar == 0) target = m_creature->FindNearestCreature(15422,20,true); else if (tar == 1) @@ -864,53 +797,40 @@ struct TRINITY_DLL_DECL mob_qiraj_war_spawnAI : public ScriptedAI } if (!(trigger = m_creature->FindNearestCreature(15379,100))) DoCast(m_creature, 33652); - if (!UpdateVictim()) { hasTarget = false; return; } - DoMeleeAttackIfReady(); } }; - /*##### # npc_anachronos_quest_trigger #####*/ - struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI { npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} - uint64 PlayerGUID; - uint32 WaveTimer; uint32 AnnounceTimer; - int8 LiveCount; uint8 WaveCount; - bool EventStarted; bool Announced; bool Failed; - void Reset() { PlayerGUID = 0; - WaveTimer = 2000; AnnounceTimer = 1000; LiveCount = 0; WaveCount = 0; - EventStarted = false; Announced = false; Failed = false; - m_creature->SetVisibility(VISIBILITY_OFF); } - void SummonNextWave() { uint8 count = WavesInfo[WaveCount].SpawnCount; @@ -919,7 +839,7 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI uint8 KaldoreiSoldierCount = 0; uint8 AnubisathConquerorCount = 0; uint8 QirajiWaspCount = 0; - for(uint8 i = 0; i < 67; ++i) + for (uint8 i = 0; i < 67; ++i) { Creature* Spawn = NULL; float X = SpawnLocation[locIndex + i].x; @@ -928,7 +848,6 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI float O = SpawnLocation[locIndex + i].o; uint32 desptimer = WavesInfo[WaveCount].DespTimer; Spawn = m_creature->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer); - if(Spawn) { Spawn->LoadCreaturesAddon(); @@ -938,7 +857,6 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI if (i >= 33) WaveCount = 2; if (i >= 45) WaveCount = 3; if (i >= 51) WaveCount = 4; - if(WaveCount < 5) //1-4 Wave { ((mob_qiraj_war_spawnAI*)Spawn->AI())->MobGUID = m_creature->GetGUID(); @@ -949,25 +867,19 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI WaveTimer = WavesInfo[WaveCount].SpawnTimer; AnnounceTimer = WavesInfo[WaveCount].YellTimer; } - void CheckEventFail() { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if(!pPlayer) return; - if(Group *EventGroup = pPlayer->GetGroup()) { Player* GroupMember; - uint8 GroupMemberCount = 0; uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - - for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) { GroupMember = (Unit::GetPlayer(itr->guid)); if(!GroupMember) @@ -979,28 +891,23 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI ++FailedMemberCount; } ++GroupMemberCount; - if(GroupMember->isDead()) ++DeadMemberCount; } - if(GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS)) Failed = true; //only so event can restart } } - void LiveCounter() { --LiveCount; if(!LiveCount) Announced = false; } - void UpdateAI(const uint32 diff) { if(!PlayerGUID || !EventStarted) return; - if(WaveCount < 4) { if(!Announced && AnnounceTimer < diff) @@ -1008,7 +915,6 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI DoScriptText(WavesInfo[WaveCount].WaveTextId, m_creature); Announced = true; } else AnnounceTimer -= diff; - if(WaveTimer < diff) SummonNextWave(); else WaveTimer -= diff; @@ -1016,33 +922,28 @@ struct TRINITY_DLL_DECL npc_anachronos_quest_triggerAI : public ScriptedAI CheckEventFail(); if (WaveCount == 4 || Failed) EnterEvadeMode(); - }; + }; }; void mob_qiraj_war_spawnAI::JustDied(Unit* slayer) { m_creature->RemoveCorpse(); if(Creature* Mob = (Unit::GetCreature(*m_creature, MobGUID))) ((npc_anachronos_quest_triggerAI*)Mob->AI())->LiveCounter(); - }; /*##### # go_crystalline_tear ######*/ - bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* quest) { if(quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) { - if(Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) { - Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Fandral = Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000); Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - if(Merithra) { Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -1050,7 +951,6 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID,15420); Merithra->setFaction(35); } - if(Caelestrasz) { Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -1058,7 +958,6 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID,15419); Caelestrasz->setFaction(35); } - if(Arygos) { Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -1066,7 +965,6 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID,15418); Arygos->setFaction(35); } - if(Anachronos) { ((npc_anachronos_the_ancientAI*)Anachronos->AI())->PlayerGUID = plr->GetGUID(); @@ -1079,52 +977,42 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* } return true; } - CreatureAI* GetAI_npc_anachronos_quest_trigger(Creature* c) { return new npc_anachronos_quest_triggerAI(c); } - CreatureAI* GetAI_mob_qiraj_war_spawn(Creature* c) { return new mob_qiraj_war_spawnAI(c); } - CreatureAI* GetAI_npc_anachronos_the_ancient(Creature* c) { return new npc_anachronos_the_ancientAI(c); } - void AddSC_silithus() { Script *newscript; - newscript = new Script; newscript->Name = "go_crystalline_tear"; newscript->pGOQuestAccept = &GOQuestAccept_GO_crystalline_tear; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_anachronos_quest_trigger"; newscript->GetAI = &GetAI_npc_anachronos_quest_trigger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_anachronos_the_ancient"; newscript->GetAI = &GetAI_npc_anachronos_the_ancient; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_qiraj_war_spawn"; newscript->GetAI = &GetAI_mob_qiraj_war_spawn; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_highlord_demitrian"; newscript->pGossipHello = &GossipHello_npc_highlord_demitrian; newscript->pGossipSelect = &GossipSelect_npc_highlord_demitrian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npcs_rutgar_and_frankal"; newscript->pGossipHello = &GossipHello_npcs_rutgar_and_frankal; diff --git a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp index 2e1ebc683fd..3c93aeb32b9 100644 --- a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp @@ -13,37 +13,30 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Stonetalon_Mountains SD%Complete: 95 SDComment: Quest support: 6627, 6523 SDCategory: Stonetalon Mountains EndScriptData */ - /* ContentData npc_braug_dimspirit npc_kaya_flathoof EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_braug_dimspirit ######*/ - #define GOSSIP_HBD1 "Ysera" #define GOSSIP_HBD2 "Neltharion" #define GOSSIP_HBD3 "Nozdormu" #define GOSSIP_HBD4 "Alexstrasza" #define GOSSIP_HBD5 "Malygos" - bool GossipHello_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -51,22 +44,18 @@ bool GossipHello_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(5820, pCreature->GetGUID()); } else pPlayer->SEND_GOSSIP_MENU(5819, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer,6766,false); - } if (uiAction == GOSSIP_ACTION_INFO_DEF+2) { @@ -75,37 +64,28 @@ bool GossipSelect_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature, uint } return true; } - /*###### ## npc_kaya_flathoof ######*/ - enum eKaya { FACTION_ESCORTEE_H = 775, - NPC_GRIMTOTEM_RUFFIAN = 11910, NPC_GRIMTOTEM_BRUTE = 11912, NPC_GRIMTOTEM_SORCERER = 11913, - SAY_START = -1000347, SAY_AMBUSH = -1000348, SAY_END = -1000349, - QUEST_PROTECT_KAYA = 6523 }; - struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI { npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 16: @@ -121,48 +101,39 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI break; } } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void Reset(){} }; - bool QuestAccept_npc_kaya_flathoof(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_PROTECT_KAYA) { if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoofAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); - DoScriptText(SAY_START, pCreature); pCreature->setFaction(113); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } return true; } - CreatureAI* GetAI_npc_kaya_flathoofAI(Creature* pCreature) { return new npc_kaya_flathoofAI(pCreature); } - /*###### ## AddSC ######*/ - void AddSC_stonetalon_mountains() { Script *newscript; - newscript = new Script; newscript->Name = "npc_braug_dimspirit"; newscript->pGossipHello = &GossipHello_npc_braug_dimspirit; newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kaya_flathoof"; newscript->GetAI = &GetAI_npc_kaya_flathoofAI; diff --git a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp index 2b21db67794..a9998c6f533 100644 --- a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp +++ b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Tanaris SD%Complete: 80 SDComment: Quest support: 648, 1560, 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor SDCategory: Tanaris EndScriptData */ - /* ContentData mob_aquementas npc_custodian_of_time @@ -30,42 +28,32 @@ npc_stone_watcher_of_norgannon npc_OOX17 npc_tooga EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "follower_ai.h" - /*###### ## mob_aquementas ######*/ - #define AGGRO_YELL_AQUE -1000350 - #define SPELL_AQUA_JET 13586 #define SPELL_FROST_SHOCK 15089 - struct TRINITY_DLL_DECL mob_aquementasAI : public ScriptedAI { mob_aquementasAI(Creature *c) : ScriptedAI(c) {} - uint32 SendItem_Timer; uint32 SwitchFaction_Timer; bool isFriendly; - uint32 FrostShock_Timer; uint32 AquaJet_Timer; - void Reset() { SendItem_Timer = 0; SwitchFaction_Timer = 10000; m_creature->setFaction(35); isFriendly = true; - AquaJet_Timer = 5000; FrostShock_Timer = 1000; } - void SendItem(Unit* receiver) { if (CAST_PLR(receiver)->HasItemCount(11169,1,false) && @@ -79,12 +67,10 @@ struct TRINITY_DLL_DECL mob_aquementasAI : public ScriptedAI CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true); } } - void EnterCombat(Unit* who) { DoScriptText(AGGRO_YELL_AQUE, m_creature, who); } - void UpdateAI(const uint32 diff) { if (isFriendly) @@ -95,10 +81,8 @@ struct TRINITY_DLL_DECL mob_aquementasAI : public ScriptedAI isFriendly = false; }else SwitchFaction_Timer -= diff; } - if (!UpdateVictim()) return; - if (!isFriendly) { if (SendItem_Timer < diff) @@ -108,19 +92,16 @@ struct TRINITY_DLL_DECL mob_aquementasAI : public ScriptedAI SendItem_Timer = 5000; }else SendItem_Timer -= diff; } - if (FrostShock_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_SHOCK); FrostShock_Timer = 15000; }else FrostShock_Timer -= diff; - if (AquaJet_Timer < diff) { DoCast(m_creature,SPELL_AQUA_JET); AquaJet_Timer = 15000; }else AquaJet_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -128,11 +109,9 @@ CreatureAI* GetAI_mob_aquementas(Creature* pCreature) { return new mob_aquementasAI (pCreature); } - /*###### ## npc_custodian_of_time ######*/ - #define WHISPER_CUSTODIAN_1 -1000150 #define WHISPER_CUSTODIAN_2 -1000151 #define WHISPER_CUSTODIAN_3 -1000152 @@ -147,17 +126,14 @@ CreatureAI* GetAI_mob_aquementas(Creature* pCreature) #define WHISPER_CUSTODIAN_12 -1000161 #define WHISPER_CUSTODIAN_13 -1000162 #define WHISPER_CUSTODIAN_14 -1000163 - struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI { npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player *pPlayer = GetPlayerForEscort(); if (!pPlayer) return; - switch(i) { case 0: DoScriptText(WHISPER_CUSTODIAN_1, m_creature, pPlayer); break; @@ -185,12 +161,10 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI break; } } - void MoveInLineOfSight(Unit *who) { if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (who->GetTypeId() == TYPEID_PLAYER) { if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE) @@ -203,57 +177,43 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI } } } - void EnterCombat(Unit* who) { } void Reset() { } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature) { return new npc_custodian_of_timeAI(pCreature); } - /*###### ## npc_marin_noggenfogger ######*/ - bool GossipHello_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_steward_of_time ######*/ - #define GOSSIP_ITEM_FLIGHT "Please take me to the master's lair." - bool GossipHello_npc_steward_of_time(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -261,50 +221,38 @@ bool GossipHello_npc_steward_of_time(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID()); - return true; } - bool QuestAccept_npc_steward_of_time(Player* pPlayer, Creature* pCreature, Quest const *quest) { if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) - return false; } - bool GossipSelect_npc_steward_of_time(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) - return true; } - /*###### ## npc_stone_watcher_of_norgannon ######*/ - #define GOSSIP_ITEM_NORGANNON_1 "What function do you serve?" #define GOSSIP_ITEM_NORGANNON_2 "What are the Plates of Uldum?" #define GOSSIP_ITEM_NORGANNON_3 "Where are the Plates of Uldum?" #define GOSSIP_ITEM_NORGANNON_4 "Excuse me? We've been \"reschedueled for visitations\"? What does that mean?!" #define GOSSIP_ITEM_NORGANNON_5 "So, what's inside Uldum?" #define GOSSIP_ITEM_NORGANNON_6 "I will return when i have the Plates of Uldum." - bool GossipHello_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -336,11 +284,9 @@ bool GossipSelect_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCre } return true; } - /*###### ## npc_OOX17 ######*/ - enum e00X17 { //texts are signed for 7806 @@ -350,24 +296,19 @@ enum e00X17 SAY_OOX_AMBUSH = -1000290, SAY_OOX17_AMBUSH_REPLY = -1000291, SAY_OOX_END = -1000292, - Q_OOX17 = 648, SPAWN_FIRST = 7803, SPAWN_SECOND_1 = 5617, SPAWN_SECOND_2 = 7805 }; - struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI { npc_OOX17AI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 23: m_creature->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); @@ -375,7 +316,6 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI m_creature->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); DoScriptText(SAY_OOX_AMBUSH, m_creature); break; - case 56: m_creature->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); @@ -384,7 +324,6 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); break; - case 86: if (pPlayer) { @@ -394,20 +333,16 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI break; } } - void Reset(){} - void EnterCombat(Unit* who) { DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), m_creature); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } }; - bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == Q_OOX17) @@ -417,22 +352,18 @@ bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* qu pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); DoScriptText(SAY_OOX_START, pCreature); - if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17AI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); } return true; } - CreatureAI* GetAI_npc_OOX17(Creature* pCreature) { return new npc_OOX17AI(pCreature); } - /*#### # npc_tooga ####*/ - enum eTooga { SAY_TOOG_THIRST = -1000391, @@ -443,39 +374,29 @@ enum eTooga SAY_TORT_POST_4 = -1000396, SAY_TOOG_POST_5 = -1000397, SAY_TORT_POST_6 = -1000398, - QUEST_TOOGA = 1560, NPC_TORTA = 6015, - POINT_ID_TO_WATER = 1, FACTION_TOOG_ESCORTEE = 113 }; - const float m_afToWaterLoc[] = {-7032.664551, -4906.199219, -1.606446}; - struct TRINITY_DLL_DECL npc_toogaAI : public FollowerAI { npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { } - uint32 m_uiCheckSpeechTimer; uint32 m_uiPostEventTimer; uint32 m_uiPhasePostEvent; - Unit* pTorta; - void Reset() { m_uiCheckSpeechTimer = 2500; m_uiPostEventTimer = 1000; m_uiPhasePostEvent = 0; - pTorta = NULL; } - void MoveInLineOfSight(Unit *pWho) { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) @@ -485,24 +406,19 @@ struct TRINITY_DLL_DECL npc_toogaAI : public FollowerAI if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) pPlayer->GroupEventHappens(QUEST_TOOGA, m_creature); } - pTorta = pWho; SetFollowComplete(true); } } } - void MovementInform(uint32 uiMotionType, uint32 uiPointId) { FollowerAI::MovementInform(uiMotionType, uiPointId); - if (uiMotionType != POINT_MOTION_TYPE) return; - if (uiPointId == POINT_ID_TO_WATER) SetFollowComplete(); } - void UpdateFollowerAI(const uint32 uiDiff) { if (!UpdateVictim()) @@ -513,14 +429,12 @@ struct TRINITY_DLL_DECL npc_toogaAI : public FollowerAI if (m_uiPostEventTimer < uiDiff) { m_uiPostEventTimer = 5000; - if (!pTorta || !pTorta->isAlive()) { //something happened, so just complete SetFollowComplete(); return; } - switch(m_uiPhasePostEvent) { case 1: @@ -543,7 +457,6 @@ struct TRINITY_DLL_DECL npc_toogaAI : public FollowerAI m_creature->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); break; } - ++m_uiPhasePostEvent; } else @@ -555,26 +468,21 @@ struct TRINITY_DLL_DECL npc_toogaAI : public FollowerAI if (m_uiCheckSpeechTimer < uiDiff) { m_uiCheckSpeechTimer = 5000; - if (urand(0,9) > 8) DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), m_creature); } else m_uiCheckSpeechTimer -= uiDiff; } - return; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_tooga(Creature* pCreature) { return new npc_toogaAI(pCreature); } - bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_TOOGA) @@ -582,49 +490,40 @@ bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQ if (npc_toogaAI* pToogaAI = CAST_AI(npc_toogaAI, pCreature->AI())) pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest); } - return true; } - void AddSC_tanaris() { Script *newscript; - newscript = new Script; newscript->Name = "mob_aquementas"; newscript->GetAI = &GetAI_mob_aquementas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_custodian_of_time"; newscript->GetAI = &GetAI_npc_custodian_of_time; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_marin_noggenfogger"; newscript->pGossipHello = &GossipHello_npc_marin_noggenfogger; newscript->pGossipSelect = &GossipSelect_npc_marin_noggenfogger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_steward_of_time"; newscript->pGossipHello = &GossipHello_npc_steward_of_time; newscript->pGossipSelect = &GossipSelect_npc_steward_of_time; newscript->pQuestAccept = &QuestAccept_npc_steward_of_time; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_stone_watcher_of_norgannon"; newscript->pGossipHello = &GossipHello_npc_stone_watcher_of_norgannon; newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_OOX17"; newscript->GetAI = &GetAI_npc_OOX17; newscript->pQuestAccept = &QuestAccept_npc_OOX17; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tooga"; newscript->GetAI = &GetAI_npc_tooga; diff --git a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp index 8ab8d98218a..b1a6e130b79 100644 --- a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp +++ b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Teldrassil SD%Complete: 100 SDComment: Quest support: 938 SDCategory: Teldrassil EndScriptData */ - /* ContentData npc_mist EndContentData */ - #include "precompiled.h" #include "follower_ai.h" - /*#### # npc_mist ####*/ - enum eMist { SAY_AT_HOME = -1000411, @@ -40,17 +35,13 @@ enum eMist NPC_ARYNIA = 3519, FACTION_DARNASSUS = 79 }; - struct TRINITY_DLL_DECL npc_mistAI : public FollowerAI { npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } - void Reset() { } - void MoveInLineOfSight(Unit *pWho) { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) @@ -60,36 +51,29 @@ struct TRINITY_DLL_DECL npc_mistAI : public FollowerAI } } } - void DoComplete() { DoScriptText(EMOTE_AT_HOME, m_creature); - if (Player* pPlayer = GetLeaderForFollower()) { if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) pPlayer->GroupEventHappens(QUEST_MIST, m_creature); } - //The follow is over (and for later development, run off to the woods before really end) SetFollowComplete(); } - //call not needed here, no known abilities /*void UpdateFollowerAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); }*/ }; - CreatureAI* GetAI_npc_mist(Creature* pCreature) { return new npc_mistAI(pCreature); } - bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_MIST) @@ -97,14 +81,11 @@ bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQu if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI())) pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); } - return true; } - void AddSC_teldrassil() { Script *newscript; - newscript = new Script; newscript->Name = "npc_mist"; newscript->GetAI = &GetAI_npc_mist; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp index d8ce45872e5..9619a4398dd 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp @@ -13,58 +13,45 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_kri, boss_yauj, boss_vem : The Bug Trio SD%Complete: 100 SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" - #define SPELL_CLEAVE 26350 #define SPELL_TOXIC_VOLLEY 25812 #define SPELL_POISON_CLOUD 38718 //Only Spell with right dmg. #define SPELL_ENRAGE 34624 //Changed cause 25790 is casted on gamers too. Same prob with old explosion of twin emperors. - #define SPELL_CHARGE 26561 #define SPELL_KNOCKBACK 26027 - #define SPELL_HEAL 25807 #define SPELL_FEAR 19408 - struct TRINITY_DLL_DECL boss_kriAI : public ScriptedAI { boss_kriAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Cleave_Timer; uint32 ToxicVolley_Timer; uint32 Check_Timer; - bool VemDead; bool Death; - void Reset() { Cleave_Timer = 4000 + rand()%4000; ToxicVolley_Timer = 6000 + rand()%6000; Check_Timer = 2000; - VemDead = false; Death = false; } - void EnterCombat(Unit *who) { } - void JustDied(Unit* killer) { if (pInstance) @@ -72,7 +59,6 @@ struct TRINITY_DLL_DECL boss_kriAI : public ScriptedAI if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) // Unlootable if death m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); } } @@ -81,27 +67,23 @@ struct TRINITY_DLL_DECL boss_kriAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 5000 + rand()%7000; }else Cleave_Timer -= diff; - //ToxicVolley_Timer if (ToxicVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_TOXIC_VOLLEY); ToxicVolley_Timer = 10000 + rand()%5000; }else ToxicVolley_Timer -= diff; - if (m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.05 && !Death) { DoCast(m_creature->getVictim(),SPELL_POISON_CLOUD); Death = true; } - if (!VemDead) { //Checking if Vem is dead. If yes we will enrage. @@ -115,35 +97,27 @@ struct TRINITY_DLL_DECL boss_kriAI : public ScriptedAI Check_Timer = 2000; }else Check_Timer -=diff; } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_vemAI : public ScriptedAI { boss_vemAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Charge_Timer; uint32 KnockBack_Timer; uint32 Enrage_Timer; - bool Enraged; - void Reset() { Charge_Timer = 15000 + rand()%12000; KnockBack_Timer = 8000 + rand()%12000; Enrage_Timer = 120000; - Enraged = false; } - void JustDied(Unit* Killer) { if (pInstance) @@ -155,17 +129,14 @@ struct TRINITY_DLL_DECL boss_vemAI : public ScriptedAI pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Charge_Timer if (Charge_Timer < diff) { @@ -177,10 +148,8 @@ struct TRINITY_DLL_DECL boss_vemAI : public ScriptedAI //m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); AttackStart(target); } - Charge_Timer = 8000 + rand()%8000; }else Charge_Timer -= diff; - //KnockBack_Timer if (KnockBack_Timer < diff) { @@ -189,42 +158,33 @@ struct TRINITY_DLL_DECL boss_vemAI : public ScriptedAI DoModifyThreatPercent(m_creature->getVictim(),-80); KnockBack_Timer = 15000 + rand()%10000; }else KnockBack_Timer -= diff; - //Enrage_Timer if (!Enraged && Enrage_Timer < diff) { DoCast(m_creature,SPELL_ENRAGE); Enraged = true; }else Charge_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI { boss_yaujAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Heal_Timer; uint32 Fear_Timer; uint32 Check_Timer; - bool VemDead; - void Reset() { Heal_Timer = 25000 + rand()%15000; Fear_Timer = 12000 + rand()%12000; Check_Timer = 2000; - VemDead = false; } - void JustDied(Unit* Killer) { if (pInstance) @@ -234,8 +194,7 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); } - - for(uint8 i = 0; i < 10; ++i) + for (uint8 i = 0; i < 10; ++i) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Creature* Summoned = m_creature->SummonCreature(15621,m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000); @@ -243,17 +202,14 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI (Summoned->AI())->AttackStart(target); } } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Fear_Timer if (Fear_Timer < diff) { @@ -261,7 +217,6 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI DoResetThreat(); Fear_Timer = 20000; }else Fear_Timer -= diff; - //Casting Heal to other twins or herself. if (Heal_Timer < diff) { @@ -269,7 +224,6 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI { Unit *pKri = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KRI)); Unit *pVem = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_VEM)); - switch(rand()%3) { case 0: @@ -285,10 +239,8 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI break; } } - Heal_Timer = 15000+rand()%15000; }else Heal_Timer -= diff; - //Checking if Vem is dead. If yes we will enrage. if (Check_Timer < diff) { @@ -305,26 +257,21 @@ struct TRINITY_DLL_DECL boss_yaujAI : public ScriptedAI } Check_Timer = 2000; }else Check_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_yauj(Creature* pCreature) { return new boss_yaujAI (pCreature); } - CreatureAI* GetAI_boss_vem(Creature* pCreature) { return new boss_vemAI (pCreature); } - CreatureAI* GetAI_boss_kri(Creature* pCreature) { return new boss_kriAI (pCreature); } - void AddSC_bug_trio() { Script *newscript; @@ -332,12 +279,10 @@ void AddSC_bug_trio() newscript->Name = "boss_kri"; newscript->GetAI = &GetAI_boss_kri; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_vem"; newscript->GetAI = &GetAI_boss_vem; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_yauj"; newscript->GetAI = &GetAI_boss_yauj; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp index 541d16b7f2b..a758c1ff1ea 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp @@ -13,128 +13,98 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Cthun SD%Complete: 95 SDComment: Darkglare tracking issue SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" - //Text emote #define EMOTE_WEAKENED -1531011 - #define PI 3.14 - //****** Out of Combat ****** //Random Wispers - No txt only sound #define RANDOM_SOUND_WHISPER 8663 - //***** Phase 1 ******** - //Mobs #define BOSS_EYE_OF_CTHUN 15589 #define MOB_CLAW_TENTACLE 15725 #define MOB_EYE_TENTACLE 15726 #define MOB_SMALL_PORTAL 15904 - //Eye Spells #define SPELL_GREEN_BEAM 26134 #define SPELL_DARK_GLARE 26029 #define SPELL_RED_COLORATION 22518 //Probably not the right spell but looks similar - //Eye Tentacles Spells #define SPELL_MIND_FLAY 26143 - //Claw Tentacles Spells #define SPELL_GROUND_RUPTURE 26139 #define SPELL_HAMSTRING 26141 - #define MOB_ - //*****Phase 2****** //Body spells //#define SPELL_CARAPACE_CTHUN 26156 //Was removed from client dbcs #define SPELL_TRANSFORM 26232 - //Eye Tentacles Spells //SAME AS PHASE1 - //Giant Claw Tentacles #define SPELL_MASSIVE_GROUND_RUPTURE 26100 - //Also casts Hamstring #define SPELL_THRASH 3391 - //Giant Eye Tentacles //CHAIN CASTS "SPELL_GREEN_BEAM" - //Stomach Spells #define SPELL_MOUTH_TENTACLE 26332 #define SPELL_EXIT_STOMACH_KNOCKBACK 25383 #define SPELL_DIGESTIVE_ACID 26476 - //Mobs #define MOB_BODY_OF_CTHUN 15809 #define MOB_GIANT_CLAW_TENTACLE 15728 #define MOB_GIANT_EYE_TENTACLE 15334 #define MOB_FLESH_TENTACLE 15802 #define MOB_GIANT_PORTAL 15910 - //Stomach Teleport positions #define STOMACH_X -8562.0f #define STOMACH_Y 2037.0f #define STOMACH_Z -70.0f #define STOMACH_O 5.05f - //Flesh tentacle positions #define TENTACLE_POS1_X -8571.0f #define TENTACLE_POS1_Y 1990.0f #define TENTACLE_POS1_Z -98.0f #define TENTACLE_POS1_O 1.22f - #define TENTACLE_POS2_X -8525.0f #define TENTACLE_POS2_Y 1994.0f #define TENTACLE_POS2_Z -98.0f #define TENTACLE_POS2_O 2.12f - //Kick out position #define KICK_X -8545.0f #define KICK_Y 1984.0f #define KICK_Z -96.0f - struct TRINITY_DLL_DECL flesh_tentacleAI : public ScriptedAI { flesh_tentacleAI(Creature *c) : ScriptedAI(c), Parent(0) { SetCombatMovement(false); } - uint64 Parent; uint32 CheckTimer; - void SpawnedByCthun(uint64 p) { Parent = p; } - void Reset() { CheckTimer = 1000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff); - void JustDied(Unit* killer); }; - struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI { eye_of_cthunAI(Creature *c) : Scripted_NoMovementAI(c) @@ -143,70 +113,56 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI if (!pInst) error_log("TSCR: No Instance eye_of_cthunAI"); } - ScriptedInstance* pInst; - //Global variables uint32 PhaseTimer; - //Eye beam phase uint32 BeamTimer; uint32 EyeTentacleTimer; uint32 ClawTentacleTimer; - //Dark Glare phase uint32 DarkGlareTick; uint32 DarkGlareTickTimer; float DarkGlareAngle; bool ClockWise; - void Reset() { //Phase information PhaseTimer = 50000; //First dark glare in 50 seconds - //Eye beam phase 50 seconds BeamTimer = 3000; EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn durring Dark beam) - //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) DarkGlareTick = 0; DarkGlareTickTimer = 1000; DarkGlareAngle = 0; ClockWise = false; - //Reset flags m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - //Reset Phase if (pInst) pInst->SetData(DATA_CTHUN_PHASE, 0); } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void SpawnEyeTentacle(float x, float y) { if (Creature* Spawned = me->SummonCreature(MOB_EYE_TENTACLE,m_creature->GetPositionX()+x,m_creature->GetPositionY()+y,m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500)) if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) Spawned->AI()->AttackStart(target); } - void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - //No instance if (!pInst) return; - switch (pInst->GetData(DATA_CTHUN_PHASE)) { case 0: @@ -221,15 +177,12 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI { m_creature->InterruptNonMeleeSpells(false); DoCast(target,SPELL_GREEN_BEAM); - //Correctly update our target m_creature->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); } - //Beam every 3 seconds BeamTimer = 3000; } else BeamTimer -= diff; - //ClawTentacleTimer if (ClawTentacleTimer < diff) { @@ -238,18 +191,14 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI if (target) { Creature* Spawned = NULL; - //Spawn claw tentacle on the random target Spawned = me->SummonCreature(MOB_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); - if (Spawned) Spawned->AI()->AttackStart(target); } - //One claw tentacle every 12.5 seconds ClawTentacleTimer = 12500; } else ClawTentacleTimer -= diff; - //EyeTentacleTimer if (EyeTentacleTimer < diff) { @@ -258,50 +207,39 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI SpawnEyeTentacle(10, 10); //south west SpawnEyeTentacle(20, 0); //west SpawnEyeTentacle(10, -10); //north west - SpawnEyeTentacle(0, -20); //north SpawnEyeTentacle(-10, -10); //north east SpawnEyeTentacle(-20, 0); // east SpawnEyeTentacle(-10, 10); // south east - //No point actually putting a timer here since //These shouldn't trigger agian until after phase shifts EyeTentacleTimer = 45000; } else EyeTentacleTimer -= diff; - //PhaseTimer if (PhaseTimer < diff) { //Switch to Dark Beam pInst->SetData(DATA_CTHUN_PHASE, 1); - m_creature->InterruptNonMeleeSpells(false); - //Select random target for dark beam to start on Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) { //Correctly update our target m_creature->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); - //Face our target DarkGlareAngle = m_creature->GetAngle(target); DarkGlareTickTimer = 1000; DarkGlareTick = 0; ClockWise = rand()%2; } - //Add red coloration to C'thun DoCast(m_creature,SPELL_RED_COLORATION); - //Freeze animation - //Darkbeam for 35 seconds PhaseTimer = 35000; }else PhaseTimer -= diff; - } break; case 1: @@ -312,49 +250,37 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI { //Remove any target m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Set angle and cast if (ClockWise) m_creature->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35)); else m_creature->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35)); - m_creature->StopMoving(); - //Actual dark glare cast, maybe something missing here? m_creature->CastSpell(m_creature, SPELL_DARK_GLARE, false); - //Increase tick DarkGlareTick++; - //1 second per tick DarkGlareTickTimer = 1000; } else DarkGlareTickTimer -= diff; - //PhaseTimer if (PhaseTimer < diff) { //Switch to Eye Beam pInst->SetData(DATA_CTHUN_PHASE, 0); - BeamTimer = 3000; EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn durring Dark beam) - m_creature->InterruptNonMeleeSpells(false); - //Remove Red coloration from c'thun m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - //Freeze animation m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - //Eye Beam for 50 seconds PhaseTimer = 50000; } else PhaseTimer -= diff; } break; - //Transition phase case 2: { @@ -362,7 +288,6 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); m_creature->SetHealth(0); } - //Dead phase case 5: { @@ -370,13 +295,11 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI } } } - void DamageTaken(Unit *done_by, uint32 &damage) { //No instance if (!pInst) return; - switch (pInst->GetData(DATA_CTHUN_PHASE)) { case 0: @@ -385,36 +308,27 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI //Only if it will kill if (damage < m_creature->GetHealth()) return; - //Fake death in phase 0 or 1 (green beam or dark glare phase) m_creature->InterruptNonMeleeSpells(false); - //Remove Red coloration from c'thun m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - //Reset to normal emote state and prevent select and attack m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - //Remove Target field m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Death animation/respawning; pInst->SetData(DATA_CTHUN_PHASE, 2); - m_creature->SetHealth(0); damage = 0; - m_creature->InterruptNonMeleeSpells(true); m_creature->RemoveAllAuras(); } break; - case 5: { //Allow death here return; } - default: { //Prevent death in this phase @@ -425,31 +339,23 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI } } }; - struct TRINITY_DLL_DECL cthunAI : public ScriptedAI { cthunAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); - pInst = c->GetInstanceData(); if (!pInst) error_log("TSCR: No Instance eye_of_cthunAI"); } - ScriptedInstance* pInst; - //Out of combat whisper timer uint32 WisperTimer; - //Global variables uint32 PhaseTimer; - //------------------- - //Phase transition uint64 HoldPlayer; - //Body Phase uint32 EyeTentacleTimer; uint8 FleshTentaclesKilled; @@ -459,21 +365,16 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI uint32 StomachEnterTimer; uint32 StomachEnterVisTimer; uint64 StomachEnterTarget; - //Stomach map, bool = true then in stomach UNORDERED_MAP Stomach_Map; - void Reset() { //One random wisper every 90 - 300 seconds WisperTimer = 90000; - //Phase information PhaseTimer = 10000; //Emerge in 10 seconds - //No hold player for transition HoldPlayer = 0; - //Body Phase EyeTentacleTimer = 30000; FleshTentaclesKilled = 0; @@ -483,23 +384,18 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI StomachEnterTimer = 10000; //Every 10 seconds StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer StomachEnterTarget = 0; //Target to be teleported to stomach - //Clear players in stomach and outside Stomach_Map.clear(); - //Reset flags m_creature->RemoveAurasDueToSpell(SPELL_TRANSFORM); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (pInst) pInst->SetData(DATA_CTHUN_PHASE, 0); } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void SpawnEyeTentacle(float x, float y) { Creature* Spawned; @@ -507,49 +403,36 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI if (Spawned) { Unit* target; - target = SelectRandomNotStomach(); - if (target) Spawned->AI()->AttackStart(target); } } - Unit* SelectRandomNotStomach() { if (Stomach_Map.empty()) return NULL; - UNORDERED_MAP::iterator i = Stomach_Map.begin(); - std::list temp; std::list::iterator j; - //Get all players in map while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, i->first); - //Only units out of stomach if (pUnit && i->second == false) temp.push_back(pUnit); - ++i; } - if (temp.empty()) return NULL; - j = temp.begin(); - //Get random but only if we have more than one unit on threat list if (temp.size() > 1) advance (i , rand() % (temp.size() - 1)); - return (*j); } - void UpdateAI(const uint32 diff) { //Check if we have a target @@ -561,32 +444,25 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI { Map* pMap = m_creature->GetMap(); if (!pMap->IsDungeon()) return; - //Play random sound to the zone Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) { - for(Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* pPlr = itr->getSource()) pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER,pPlr); } } - //One random wisper every 90 - 300 seconds WisperTimer = urand(90000,300000); } else WisperTimer -= diff; - return; } - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //No instance if (!pInst) return; - switch (pInst->GetData(DATA_CTHUN_PHASE)) { //Transition phase @@ -597,143 +473,109 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI { //Switch pInst->SetData(DATA_CTHUN_PHASE, 3); - //Switch to c'thun model m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_TRANSFORM, false); m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - //Emerging phase //AttackStart(Unit::GetUnit(*m_creature, HoldpPlayer)); DoZoneInCombat(); - //Place all units in threat list on outside of stomach Stomach_Map.clear(); - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { //Outside stomach Stomach_Map[(*i)->getUnitGuid()] = false; } - //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; - Creature* Spawned; - //Spawn flesh tentacle Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Spawned) FleshTentaclesKilled++; else CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); - //Spawn flesh tentacle Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Spawned) FleshTentaclesKilled++; else CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); - PhaseTimer = 0; } else PhaseTimer -= diff; - } break; - //Body Phase case 3: { //Remove Target field m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Weaken if (FleshTentaclesKilled > 1) { pInst->SetData(DATA_CTHUN_PHASE, 4); - DoScriptText(EMOTE_WEAKENED, m_creature); PhaseTimer = 45000; - DoCast(m_creature, SPELL_RED_COLORATION, true); - UNORDERED_MAP::iterator i = Stomach_Map.begin(); - //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, i->first); - //Only move units in stomach if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()+10, rand()%6); - //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); - //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); - i->second = false; } ++i; } - return; } - //Stomach acid if (StomachAcidTimer < diff) { //Apply aura to all players in stomach UNORDERED_MAP::iterator i = Stomach_Map.begin(); - while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, i->first); - //Only apply to units in stomach if (pUnit && i->second == true) { //Cast digestive acid on them DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); - //Check if player should be kicked from stomach if (pUnit->IsWithinDist3d(KICK_X, KICK_Y, KICK_Z, 15.0f)) { //Teleport each player out DoTeleportPlayer(pUnit, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()+10, rand()%6); - //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); - //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); - i->second = false; } } ++i; } - StomachAcidTimer = 4000; }else StomachAcidTimer -= diff; - //Stomach Enter Timer if (StomachEnterTimer < diff) { Unit* target = NULL; target = SelectRandomNotStomach(); - if (target) { //Set target in stomach @@ -743,25 +585,20 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } - StomachEnterTimer = 13800; } else StomachEnterTimer -= diff; - if (StomachEnterVisTimer && StomachEnterTarget) if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, StomachEnterTarget); - if (pUnit) { DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } - StomachEnterTarget = 0; StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; - //GientClawTentacleTimer if (GiantClawTentacleTimer < diff) { @@ -770,18 +607,14 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI if (target) { Creature* Spawned = NULL; - //Spawn claw tentacle on the random target Spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); - if (Spawned) Spawned->AI()->AttackStart(target); } - //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; }else GiantClawTentacleTimer -= diff; - //GiantEyeTentacleTimer if (GiantEyeTentacleTimer < diff) { @@ -789,20 +622,15 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI target = SelectRandomNotStomach(); if (target) { - Creature* Spawned = NULL; - //Spawn claw tentacle on the random target Spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); - if (Spawned) Spawned->AI()->AttackStart(target); } - //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; }else GiantEyeTentacleTimer -= diff; - //EyeTentacleTimer if (EyeTentacleTimer < diff) { @@ -811,18 +639,14 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI SpawnEyeTentacle(12, 12); //south west SpawnEyeTentacle(25, 0); //west SpawnEyeTentacle(12, -12); //north west - SpawnEyeTentacle(0, -25); //north SpawnEyeTentacle(-12, -12); //north east SpawnEyeTentacle(-25, 0); // east SpawnEyeTentacle(-12, 12); // south east - //These spawn at every 30 seconds EyeTentacleTimer = 30000; }else EyeTentacleTimer -= diff; - }break; - //Weakened state case 4: { @@ -831,50 +655,39 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI { //Switch pInst->SetData(DATA_CTHUN_PHASE, 3); - //Remove red coloration m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; - Creature* Spawned; - //Spawn flesh tentacle Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Spawned) ++FleshTentaclesKilled; else CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); - //Spawn flesh tentacle Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Spawned) ++FleshTentaclesKilled; else CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); - PhaseTimer = 0; } else PhaseTimer -= diff; } } } - void JustDied(Unit* pKiller) { //Switch if (pInst) pInst->SetData(DATA_CTHUN_PHASE, 5); } - void DamageTaken(Unit *done_by, uint32 &damage) { //No instance if (!pInst) return; - switch (pInst->GetData(DATA_CTHUN_PHASE)) { case 3: @@ -882,114 +695,93 @@ struct TRINITY_DLL_DECL cthunAI : public ScriptedAI //Not weakened so reduce damage by 99% if (damage / 99 > 0) damage/= 99; else damage = 1; - //Prevent death in non-weakened state if (damage >= m_creature->GetHealth()) damage = 0; - return; } break; - case 4: { //Weakened - takes normal damage return; } - default: damage = 0; break; } } - void FleshTentcleKilled() { FleshTentaclesKilled++; } }; - struct TRINITY_DLL_DECL eye_tentacleAI : public ScriptedAI { eye_tentacleAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); - if (Unit* pPortal = m_creature->SummonCreature(MOB_SMALL_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); } - uint32 MindflayTimer; uint32 KillSelfTimer; uint64 Portal; - void JustDied(Unit* who) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); } - void Reset() { //Mind flay half a second after we spawn MindflayTimer = 500; - //This prevents eyes from overlapping KillSelfTimer = 35000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - //KillSelfTimer if (KillSelfTimer < diff) { m_creature->Kill(m_creature); return; } else KillSelfTimer -= diff; - //MindflayTimer if (MindflayTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target && !target->HasAura(SPELL_DIGESTIVE_ACID)) DoCast(target,SPELL_MIND_FLAY); - //Mindflay every 10 seconds MindflayTimer = 10000; } else MindflayTimer -= diff; } }; - struct TRINITY_DLL_DECL claw_tentacleAI : public ScriptedAI { claw_tentacleAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); - if (Unit* pPortal = m_creature->SummonCreature(MOB_SMALL_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); } - uint32 GroundRuptureTimer; uint32 HamstringTimer; uint32 EvadeTimer; uint64 Portal; - void JustDied(Unit* who) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); } - void Reset() { //First rupture should happen half a second after we spawn @@ -997,90 +789,74 @@ struct TRINITY_DLL_DECL claw_tentacleAI : public ScriptedAI HamstringTimer = 2000; EvadeTimer = 5000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - //EvadeTimer if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) if (EvadeTimer < diff) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); - //Dissapear and reappear at new position m_creature->SetVisibility(VISIBILITY_OFF); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if (!target) { m_creature->Kill(m_creature); return; } - if (!target->HasAura(SPELL_DIGESTIVE_ACID)) { m_creature->GetMap()->CreatureRelocation(m_creature, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); if (Unit* pPortal = m_creature->SummonCreature(MOB_SMALL_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); - GroundRuptureTimer = 500; HamstringTimer = 2000; EvadeTimer = 5000; AttackStart(target); } - m_creature->SetVisibility(VISIBILITY_ON); } else EvadeTimer -= diff; - //GroundRuptureTimer if (GroundRuptureTimer < diff) { DoCast(m_creature->getVictim(),SPELL_GROUND_RUPTURE); GroundRuptureTimer = 30000; } else GroundRuptureTimer -= diff; - //HamstringTimer if (HamstringTimer < diff) { DoCast(m_creature->getVictim(),SPELL_HAMSTRING); HamstringTimer = 5000; } else HamstringTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL giant_claw_tentacleAI : public ScriptedAI { giant_claw_tentacleAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); - if (Unit* pPortal = m_creature->SummonCreature(MOB_GIANT_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); } - uint32 GroundRuptureTimer; uint32 ThrashTimer; uint32 HamstringTimer; uint32 EvadeTimer; uint64 Portal; - void JustDied(Unit* who) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); } - void Reset() { //First rupture should happen half a second after we spawn @@ -1089,151 +865,123 @@ struct TRINITY_DLL_DECL giant_claw_tentacleAI : public ScriptedAI ThrashTimer = 5000; EvadeTimer = 5000; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - //EvadeTimer if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) if (EvadeTimer < diff) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); - //Dissapear and reappear at new position m_creature->SetVisibility(VISIBILITY_OFF); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!target) { m_creature->Kill(m_creature); return; } - if (!target->HasAura(SPELL_DIGESTIVE_ACID)) { m_creature->GetMap()->CreatureRelocation(m_creature, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); if (Unit* pPortal = m_creature->SummonCreature(MOB_GIANT_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); - GroundRuptureTimer = 500; HamstringTimer = 2000; ThrashTimer = 5000; EvadeTimer = 5000; AttackStart(target); } - m_creature->SetVisibility(VISIBILITY_ON); - } else EvadeTimer -= diff; - //GroundRuptureTimer if (GroundRuptureTimer < diff) { DoCast(m_creature->getVictim(),SPELL_GROUND_RUPTURE); GroundRuptureTimer = 30000; } else GroundRuptureTimer -= diff; - //ThrashTimer if (ThrashTimer < diff) { DoCast(m_creature->getVictim(),SPELL_THRASH); ThrashTimer = 10000; } else ThrashTimer -= diff; - //HamstringTimer if (HamstringTimer < diff) { DoCast(m_creature->getVictim(),SPELL_HAMSTRING); HamstringTimer = 10000; } else HamstringTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL giant_eye_tentacleAI : public ScriptedAI { giant_eye_tentacleAI(Creature *c) : ScriptedAI(c) { SetCombatMovement(false); - if (Unit* pPortal = m_creature->SummonCreature(MOB_GIANT_PORTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0)) Portal = pPortal->GetGUID(); } - uint32 BeamTimer; uint64 Portal; - void JustDied(Unit* who) { if (Unit* p = Unit::GetUnit(*m_creature, Portal)) p->Kill(p); } - void Reset() { //Green Beam half a second after we spawn BeamTimer = 500; } - void EnterCombat(Unit *who) { DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - //BeamTimer if (BeamTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target && !target->HasAura(SPELL_DIGESTIVE_ACID)) DoCast(target,SPELL_GREEN_BEAM); - //Beam every 2 seconds BeamTimer = 2100; }else BeamTimer -= diff; } }; - //Flesh tentacle functions void flesh_tentacleAI::UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) return; - if (Parent) if (CheckTimer < diff) { Unit* pUnit = Unit::GetUnit(*m_creature, Parent); - if (!pUnit || !pUnit->isAlive() || !pUnit->isInCombat()) { Parent = 0; m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false); return; } - CheckTimer = 1000; }else CheckTimer -= diff; - DoMeleeAttackIfReady(); } - void flesh_tentacleAI::JustDied(Unit* killer) { if (!Parent) @@ -1241,85 +989,68 @@ void flesh_tentacleAI::JustDied(Unit* killer) error_log("TSCR: flesh_tentacle: No Parent variable"); return; } - Creature* Cthun = Unit::GetCreature(*m_creature, Parent); - if (Cthun) CAST_AI(cthunAI, (Cthun->AI()))->FleshTentcleKilled(); else error_log("TSCR: flesh_tentacle: No Cthun"); } - //GetAIs CreatureAI* GetAI_eye_of_cthun(Creature* pCreature) { return new eye_of_cthunAI (pCreature); } - CreatureAI* GetAI_cthun(Creature* pCreature) { return new cthunAI (pCreature); } - CreatureAI* GetAI_eye_tentacle(Creature* pCreature) { return new eye_tentacleAI (pCreature); } - CreatureAI* GetAI_claw_tentacle(Creature* pCreature) { return new claw_tentacleAI (pCreature); } - CreatureAI* GetAI_giant_claw_tentacle(Creature* pCreature) { return new giant_claw_tentacleAI (pCreature); } - CreatureAI* GetAI_giant_eye_tentacle(Creature* pCreature) { return new giant_eye_tentacleAI (pCreature); } - CreatureAI* GetAI_flesh_tentacle(Creature* pCreature) { return new flesh_tentacleAI (pCreature); } - void AddSC_boss_cthun() { Script *newscript; - //Eye newscript = new Script; newscript->Name = "boss_eye_of_cthun"; newscript->GetAI = &GetAI_eye_of_cthun; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_cthun"; newscript->GetAI = &GetAI_cthun; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_eye_tentacle"; newscript->GetAI = &GetAI_eye_tentacle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_claw_tentacle"; newscript->GetAI = &GetAI_claw_tentacle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_giant_claw_tentacle"; newscript->GetAI = &GetAI_giant_claw_tentacle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_giant_eye_tentacle"; newscript->GetAI = &GetAI_giant_eye_tentacle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_giant_flesh_tentacle"; newscript->GetAI = &GetAI_flesh_tentacle; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp index 2dce14cb9ec..3ee6d881994 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp @@ -13,54 +13,43 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Fankriss SD%Complete: 100 SDComment: sound not implemented SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SOUND_SENTENCE_YOU 8588 #define SOUND_SERVE_TO 8589 #define SOUND_LAWS 8590 #define SOUND_TRESPASS 8591 #define SOUND_WILL_BE 8592 - #define SPELL_MORTAL_WOUND 28467 #define SPELL_ROOT 28858 - // Enrage for his spawns #define SPELL_ENRAGE 28798 - struct TRINITY_DLL_DECL boss_fankrissAI : public ScriptedAI { boss_fankrissAI(Creature *c) : ScriptedAI(c) {} - uint32 MortalWound_Timer; uint32 SpawnHatchlings_Timer; uint32 SpawnSpawns_Timer; int Rand; int RandX; int RandY; - Creature* Hatchling; Creature* Spawn; - void Reset() { MortalWound_Timer = 10000 + rand()%5000; SpawnHatchlings_Timer = 6000 + rand()%6000; SpawnSpawns_Timer = 15000 + rand()%30000; } - void SummonSpawn(Unit* victim) { if (!victim) return; - Rand = 10 + (rand()%10); switch (rand()%2) { @@ -79,24 +68,20 @@ struct TRINITY_DLL_DECL boss_fankrissAI : public ScriptedAI if (Spawn) (Spawn->AI())->AttackStart(victim); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //MortalWound_Timer if (MortalWound_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTAL_WOUND); MortalWound_Timer = 10000 + rand()%10000; }else MortalWound_Timer -= diff; - //Summon 1-3 Spawns of Fankriss at random time. if (SpawnSpawns_Timer < diff) { @@ -117,7 +102,6 @@ struct TRINITY_DLL_DECL boss_fankrissAI : public ScriptedAI } SpawnSpawns_Timer = 30000 + rand()%30000; }else SpawnSpawns_Timer -= diff; - // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 3) @@ -129,10 +113,8 @@ struct TRINITY_DLL_DECL boss_fankrissAI : public ScriptedAI if (target && target->GetTypeId() == TYPEID_PLAYER) { DoCast(target, SPELL_ROOT); - if (DoGetThreat(target)) DoModifyThreatPercent(target, -100); - switch(rand()%3) { case 0: @@ -185,16 +167,13 @@ struct TRINITY_DLL_DECL boss_fankrissAI : public ScriptedAI SpawnHatchlings_Timer = 45000 + rand()%15000; }else SpawnHatchlings_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_fankriss(Creature* pCreature) { return new boss_fankrissAI (pCreature); } - void AddSC_boss_fankriss() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp index 9df6912a3df..83b189f4b4f 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp @@ -13,40 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Huhuran SD%Complete: 100 SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define EMOTE_GENERIC_FRENZY_KILL -1000001 #define EMOTE_GENERIC_BERSERK -1000004 - #define SPELL_FRENZY 26051 #define SPELL_BERSERK 26068 #define SPELL_POISONBOLT 26052 #define SPELL_NOXIOUSPOISON 26053 #define SPELL_WYVERNSTING 26180 #define SPELL_ACIDSPIT 26050 - struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI { boss_huhuranAI(Creature *c) : ScriptedAI(c) {} - uint32 Frenzy_Timer; uint32 Wyvern_Timer; uint32 Spit_Timer; uint32 PoisonBolt_Timer; uint32 NoxiousPoison_Timer; uint32 FrenzyBack_Timer; - bool Frenzy; bool Berserk; - void Reset() { Frenzy_Timer = 25000 + rand()%10000; @@ -55,21 +47,17 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI PoisonBolt_Timer = 4000; NoxiousPoison_Timer = 10000 + rand()%10000; FrenzyBack_Timer = 15000; - Frenzy = false; Berserk = false; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Frenzy_Timer if (!Frenzy && Frenzy_Timer < diff) { @@ -79,7 +67,6 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI PoisonBolt_Timer = 3000; Frenzy_Timer = 25000 + rand()%10000; }else Frenzy_Timer -= diff; - // Wyvern Timer if (Wyvern_Timer < diff) { @@ -87,21 +74,18 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI DoCast(target,SPELL_WYVERNSTING); Wyvern_Timer = 15000 + rand()%17000; }else Wyvern_Timer -= diff; - //Spit Timer if (Spit_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ACIDSPIT); Spit_Timer = 5000 + rand()%5000; }else Spit_Timer -= diff; - //NoxiousPoison_Timer if (NoxiousPoison_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_NOXIOUSPOISON); NoxiousPoison_Timer = 12000 + rand()%12000; }else NoxiousPoison_Timer -= diff; - //PoisonBolt only if frenzy or berserk if (Frenzy || Berserk) { @@ -111,7 +95,6 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI PoisonBolt_Timer = 3000; }else PoisonBolt_Timer -= diff; } - //FrenzyBack_Timer if (Frenzy && FrenzyBack_Timer < diff) { @@ -119,7 +102,6 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI Frenzy = false; FrenzyBack_Timer = 15000; }else FrenzyBack_Timer -= diff; - if (!Berserk && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 31) { m_creature->InterruptNonMeleeSpells(false); @@ -127,16 +109,13 @@ struct TRINITY_DLL_DECL boss_huhuranAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK); Berserk = true; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_huhuran(Creature* pCreature) { return new boss_huhuranAI (pCreature); } - void AddSC_boss_huhuran() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp index 13bf15fe66a..079a5367903 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp @@ -13,38 +13,30 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ouro SD%Complete: 85 SDComment: No model for submerging. Currently just invisible. SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" - #define SPELL_SWEEP 26103 #define SPELL_SANDBLAST 26102 #define SPELL_GROUND_RUPTURE 26100 #define SPELL_BIRTH 26262 //The Birth Animation - #define SPELL_DIRTMOUND_PASSIVE 26092 - struct TRINITY_DLL_DECL boss_ouroAI : public ScriptedAI { boss_ouroAI(Creature *c) : ScriptedAI(c) {} - uint32 Sweep_Timer; uint32 SandBlast_Timer; uint32 Submerge_Timer; uint32 Back_Timer; uint32 ChangeTarget_Timer; uint32 Spawn_Timer; - bool Enrage; bool Submerged; - void Reset() { Sweep_Timer = 5000 + rand()%5000; @@ -53,36 +45,30 @@ struct TRINITY_DLL_DECL boss_ouroAI : public ScriptedAI Back_Timer = 30000 + rand()%15000; ChangeTarget_Timer = 5000 + rand()%3000; Spawn_Timer = 10000 + rand()%10000; - Enrage = false; Submerged = false; } - void EnterCombat(Unit *who) { DoCast(m_creature->getVictim(), SPELL_BIRTH); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Sweep_Timer if (!Submerged && Sweep_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SWEEP); Sweep_Timer = 15000 + rand()%15000; }else Sweep_Timer -= diff; - //SandBlast_Timer if (!Submerged && SandBlast_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SANDBLAST); SandBlast_Timer = 20000 + rand()%15000; }else SandBlast_Timer -= diff; - //Submerge_Timer if (!Submerged && Submerge_Timer < diff) { @@ -91,44 +77,34 @@ struct TRINITY_DLL_DECL boss_ouroAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(35); DoCast(m_creature, SPELL_DIRTMOUND_PASSIVE); - Submerged = true; Back_Timer = 30000 + rand()%15000; }else Submerge_Timer -= diff; - //ChangeTarget_Timer if (Submerged && ChangeTarget_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); - ChangeTarget_Timer = 10000 + rand()%10000; }else ChangeTarget_Timer -= diff; - //Back_Timer if (Submerged && Back_Timer < diff) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(14); - DoCast(m_creature->getVictim(), SPELL_GROUND_RUPTURE); - Submerged = false; Submerge_Timer = 60000 + rand()%60000; }else Back_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ouro(Creature* pCreature) { return new boss_ouroAI (pCreature); } - void AddSC_boss_ouro() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_sartura.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_sartura.cpp index 0494cc2fdd1..1e6dde30323 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_sartura.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_sartura.cpp @@ -13,45 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Sartura SD%Complete: 95 SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1531008 #define SAY_SLAY -1531009 #define SAY_DEATH -1531010 - #define SPELL_WHIRLWIND 26083 #define SPELL_ENRAGE 28747 //Not sure if right ID. #define SPELL_ENRAGEHARD 28798 - //Guard Spell #define SPELL_WHIRLWINDADD 26038 #define SPELL_KNOCKBACK 26027 - struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI { boss_sarturaAI(Creature *c) : ScriptedAI(c) {} - uint32 WhirlWind_Timer; uint32 WhirlWindRandom_Timer; uint32 WhirlWindEnd_Timer; uint32 AggroReset_Timer; uint32 AggroResetEnd_Timer; uint32 EnrageHard_Timer; - bool Enraged; bool EnragedHard; bool WhirlWind; bool AggroReset; - void Reset() { WhirlWind_Timer = 30000; @@ -60,35 +51,28 @@ struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI AggroReset_Timer = 45000 + rand()%10000; AggroResetEnd_Timer = 5000; EnrageHard_Timer = 10*60000; - WhirlWind = false; AggroReset = false; Enraged = false; EnragedHard = false; - } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(SAY_SLAY, m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (WhirlWind) { if (WhirlWindRandom_Timer < diff) @@ -100,17 +84,14 @@ struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI m_creature->AddThreat(target, 1.0f); m_creature->TauntApply(target); AttackStart(target); - WhirlWindRandom_Timer = 3000 + rand()%4000; }else WhirlWindRandom_Timer -= diff; - if (WhirlWindEnd_Timer < diff) { WhirlWind = false; WhirlWind_Timer = 25000 + rand()%15000; }else WhirlWindEnd_Timer -= diff; } - if (!WhirlWind) { if (WhirlWind_Timer < diff) @@ -119,7 +100,6 @@ struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI WhirlWind = true; WhirlWindEnd_Timer = 15000; }else WhirlWind_Timer -= diff; - if (AggroReset_Timer < diff) { //Attack random Gamers @@ -129,11 +109,9 @@ struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI m_creature->AddThreat(target, 1.0f); m_creature->TauntApply(target); AttackStart(target); - AggroReset = true; AggroReset_Timer = 2000 + rand()%3000; }else AggroReset_Timer -= diff; - if (AggroReset) { if (AggroResetEnd_Timer AddThreat(target, 1.0f); m_creature->TauntApply(target); AttackStart(target); - WhirlWindRandom_Timer = 3000 + rand()%4000; }else WhirlWindRandom_Timer -= diff; - if (WhirlWindEnd_Timer < diff) { WhirlWind = false; }else WhirlWindEnd_Timer -= diff; } - if (!WhirlWind) { if (AggroReset_Timer < diff) @@ -246,18 +209,15 @@ struct TRINITY_DLL_DECL mob_sartura_royal_guardAI : public ScriptedAI m_creature->AddThreat(target, 1.0f); m_creature->TauntApply(target); AttackStart(target); - AggroReset = true; AggroReset_Timer = 2000 + rand()%3000; }else AggroReset_Timer -= diff; - if (KnockBack_Timer < diff) { DoCast(m_creature, SPELL_WHIRLWINDADD); KnockBack_Timer = 10000 + rand()%10000; }else KnockBack_Timer -= diff; } - if (AggroReset) { if (AggroResetEnd_Timer Name = "boss_sartura"; newscript->GetAI = &GetAI_boss_sartura; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_sartura_royal_guard"; newscript->GetAI = &GetAI_mob_sartura_royal_guard; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp index 1c988387993..8ec42dee092 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Skeram SD%Complete: 75 SDComment: Mind Control buggy. SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" #include "Group.h" - #define SAY_AGGRO1 -1531000 #define SAY_AGGRO2 -1531001 #define SAY_AGGRO3 -1531002 @@ -33,12 +30,10 @@ EndScriptData */ #define SAY_SLAY3 -1531005 #define SAY_SPLIT -1531006 #define SAY_DEATH -1531007 - #define SPELL_ARCANE_EXPLOSION 25679 #define SPELL_EARTH_SHOCK 26194 #define SPELL_TRUE_FULFILLMENT4 26526 #define SPELL_BLINK 28391 - class ov_mycoordinates { public: @@ -48,28 +43,23 @@ class ov_mycoordinates x = cx; y = cy; z = cz; r = cr; } }; - struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI { boss_skeramAI(Creature *c) : ScriptedAI(c) { IsImage = false; } - uint32 ArcaneExplosion_Timer; uint32 EarthShock_Timer; uint32 FullFillment_Timer; uint32 Blink_Timer; uint32 Invisible_Timer; - Creature *Image1, *Image2; - bool Images75; bool Images50; bool Images25; bool IsImage; bool Invisible; - void Reset() { ArcaneExplosion_Timer = 6000 + rand()%6000; @@ -77,50 +67,41 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI FullFillment_Timer = 15000; Blink_Timer = 8000 + rand()%12000; Invisible_Timer = 500; - Images75 = false; Images50 = false; Images25 = false; Invisible = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); - if (IsImage) m_creature->setDeathState(JUST_DIED); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit* Killer) { if (!IsImage) DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit *who) { if (IsImage || Images75) return; DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION); ArcaneExplosion_Timer = 8000 + rand()%10000; }else ArcaneExplosion_Timer -= diff; - //If we are within range melee the target if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { @@ -139,7 +120,6 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI EarthShock_Timer = 1000; }else EarthShock_Timer -= diff; } - //Blink_Timer if (Blink_Timer < diff) { @@ -160,25 +140,19 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI break; } DoStopAttack(); - Blink_Timer= 20000 + rand()%20000; }else Blink_Timer -= diff; - int procent = (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5); - //Summoning 2 Images and teleporting to a random position on 75% health if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70)) DoSplit(75); - //Summoning 2 Images and teleporting to a random position on 50% health if ((!Images50 && !IsImage) && (procent <= 50 && procent > 45)) DoSplit(50); - //Summoning 2 Images and teleporting to a random position on 25% health if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20)) DoSplit(25); - //Invisible_Timer if (Invisible) { @@ -187,25 +161,19 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI //Making Skeram visible after telporting m_creature->SetVisibility(VISIBILITY_ON); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Invisible_Timer = 2500; Invisible = false; }else Invisible_Timer -= diff; } - DoMeleeAttackIfReady(); } - void DoSplit(int atPercent /* 75 50 25 */) { DoScriptText(SAY_SPLIT, m_creature); - ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0); - ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; - switch(rand()%3) { case 0: @@ -224,7 +192,6 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI i2=place2; break; } - for (int tryi = 0; tryi < 41; tryi ++) { Unit *targetpl = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -242,7 +209,6 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI break; } } - m_creature->RemoveAllAuras(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_OFF); @@ -253,16 +219,13 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI delete place3; DoResetThreat(); DoStopAttack(); - switch (atPercent) { case 75: Images75 = true; break; case 50: Images50 = true; break; case 25: Images25 = true; break; } - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); - Image1 = m_creature->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); if (Image1) { @@ -272,7 +235,6 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI Image1->AI()->AttackStart(target); CAST_AI(boss_skeramAI, Image1->AI())->IsImage = true; } - Image2 = m_creature->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); if (Image2) { @@ -284,14 +246,11 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI } Invisible = true; } - }; - CreatureAI* GetAI_boss_skeram(Creature* pCreature) { return new boss_skeramAI (pCreature); } - void AddSC_boss_skeram() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp index 72dfcdb08f3..a477c30950d 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp @@ -13,59 +13,45 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Twinemperors SD%Complete: 95 SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" #include "WorldPacket.h" - #include "Item.h" #include "Spell.h" - #define SPELL_HEAL_BROTHER 7393 #define SPELL_TWIN_TELEPORT 800 // CTRA watches for this spell to start its teleport timer #define SPELL_TWIN_TELEPORT_VISUAL 26638 // visual - #define SPELL_EXPLODEBUG 804 #define SPELL_MUTATE_BUG 802 - #define SOUND_VN_DEATH 8660 //8660 - Death - Feel #define SOUND_VN_AGGRO 8661 //8661 - Aggro - Let none #define SOUND_VN_KILL 8662 //8661 - Kill - your fate - #define SOUND_VL_AGGRO 8657 //8657 - Aggro - To Late #define SOUND_VL_KILL 8658 //8658 - Kill - You will not #define SOUND_VL_DEATH 8659 //8659 - Death - #define PULL_RANGE 50 #define ABUSE_BUG_RANGE 20 #define SPELL_BERSERK 26662 #define TELEPORTTIME 30000 - #define SPELL_UPPERCUT 26007 #define SPELL_UNBALANCING_STRIKE 26613 - #define VEKLOR_DIST 20 // VL will not come to melee when attacking - #define SPELL_SHADOWBOLT 26006 #define SPELL_BLIZZARD 26607 #define SPELL_ARCANEBURST 568 - struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI { boss_twinemperorsAI(Creature *c): ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Heal_Timer; uint32 Teleport_Timer; bool AfterTeleport; @@ -74,11 +60,9 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI uint32 Abuse_Bug_Timer, BugsTimer; bool tspellcasted; uint32 EnrageTimer; - virtual bool IAmVeklor() = 0; virtual void Reset() = 0; virtual void CastSpellOnBug(Creature *target) = 0; - void TwinReset() { Heal_Timer = 0; // first heal immediately when they get close together @@ -92,7 +76,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI DontYellWhenDead = false; EnrageTimer = 15*60000; } - Creature *GetOtherBoss() { if (pInstance) @@ -100,7 +83,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI else return NULL; } - void DamageTaken(Unit *done_by, uint32 &damage) { Unit *pOtherBoss = GetOtherBoss(); @@ -117,7 +99,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } } } - void JustDied(Unit* Killer) { Creature *pOtherBoss = GetOtherBoss(); @@ -131,12 +112,10 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI if (!DontYellWhenDead) // I hope AI is not threaded DoPlaySoundToSet(m_creature, IAmVeklor() ? SOUND_VL_DEATH : SOUND_VN_DEATH); } - void KilledUnit(Unit* victim) { DoPlaySoundToSet(m_creature, IAmVeklor() ? SOUND_VL_KILL : SOUND_VN_KILL); } - void EnterCombat(Unit *who) { DoZoneInCombat(); @@ -154,16 +133,13 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } } } - void SpellHit(Unit *caster, const SpellEntry *entry) { if (caster == m_creature) return; - Creature *pOtherBoss = GetOtherBoss(); if (entry->Id != SPELL_HEAL_BROTHER || !pOtherBoss) return; - // add health so we keep same percentage for both brothers uint32 mytotal = m_creature->GetMaxHealth(), histotal = pOtherBoss->GetMaxHealth(); float mult = ((float)mytotal) / ((float)histotal); @@ -171,7 +147,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI mult = 1.0f/mult; #define HEAL_BROTHER_AMOUNT 30000.0f uint32 largerAmount = (uint32)((HEAL_BROTHER_AMOUNT * mult) - HEAL_BROTHER_AMOUNT); - uint32 myh = m_creature->GetHealth(); uint32 hish = pOtherBoss->GetHealth(); if (mytotal > histotal) @@ -185,12 +160,10 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI pOtherBoss->SetHealth(std::min(histotal, h)); } } - void TryHealBrother(uint32 diff) { if (IAmVeklor()) // this spell heals caster and the other brother so let VN cast it return; - if (Heal_Timer < diff) { Unit *pOtherBoss = GetOtherBoss(); @@ -201,17 +174,13 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } } else Heal_Timer -= diff; } - void TeleportToMyBrother() { if (!pInstance) return; - Teleport_Timer = TELEPORTTIME; - if (IAmVeklor()) return; // mechanics handled by veknilash so they teleport exactly at the same time and to correct coordinates - Creature *pOtherBoss = GetOtherBoss(); if (pOtherBoss) { @@ -220,17 +189,14 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI float other_y = pOtherBoss->GetPositionY(); float other_z = pOtherBoss->GetPositionZ(); float other_o = pOtherBoss->GetOrientation(); - Map *thismap = m_creature->GetMap(); thismap->CreatureRelocation(pOtherBoss, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation()); thismap->CreatureRelocation(m_creature, other_x, other_y, other_z, other_o); - SetAfterTeleport(); CAST_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport(); } } - void SetAfterTeleport() { m_creature->InterruptNonMeleeSpells(false); @@ -242,7 +208,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI AfterTeleportTimer = 2000; tspellcasted = false; } - bool TryActivateAfterTTelep(uint32 diff) { if (AfterTeleport) @@ -253,9 +218,7 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI DoCast(m_creature, SPELL_TWIN_TELEPORT); m_creature->addUnitState(UNIT_STAT_STUNNED); } - tspellcasted = true; - if (AfterTeleportTimer < diff) { AfterTeleport = false; @@ -289,12 +252,10 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI return true; } } - void MoveInLineOfSight(Unit *who) { if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { float attackRadius = m_creature->GetAttackDistance(who); @@ -308,19 +269,15 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } } } - Creature *RespawnNearbyBugsAndGetOne() { std::list lUnitList; m_creature->GetCreatureListWithEntryInGrid(lUnitList,15316,150.0f); m_creature->GetCreatureListWithEntryInGrid(lUnitList,15317,150.0f); - if (lUnitList.empty()) return NULL; - Creature *nearb = NULL; - - for(std::list::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter) + for (std::list::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter) { Creature *c = *iter; if (c) @@ -340,7 +297,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } return nearb; } - void HandleBugs(uint32 diff) { if (BugsTimer < diff || Abuse_Bug_Timer < diff) @@ -370,7 +326,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI Abuse_Bug_Timer -= diff; } } - void CheckEnrage(uint32 diff) { if (EnrageTimer < diff) @@ -383,32 +338,26 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI } else EnrageTimer-=diff; } }; - struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI { bool IAmVeklor() {return false;} boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {} - uint32 UpperCut_Timer; uint32 UnbalancingStrike_Timer; uint32 Scarabs_Timer; int Rand; int RandX; int RandY; - Creature* Summoned; - void Reset() { TwinReset(); UpperCut_Timer = 14000 + rand()%15000; UnbalancingStrike_Timer = 8000 + rand()%10000; Scarabs_Timer = 7000 + rand()%7000; - //Added. Can be removed if its included in DB. m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } - void CastSpellOnBug(Creature *target) { target->setFaction(14); @@ -424,23 +373,19 @@ struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI target->AddAura(new Aura(spell, eff_mask, target, target, target)); target->SetHealth(target->GetMaxHealth()); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (!TryActivateAfterTTelep(diff)) return; - //UnbalancingStrike_Timer if (UnbalancingStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_UNBALANCING_STRIKE); UnbalancingStrike_Timer = 8000+rand()%12000; }else UnbalancingStrike_Timer -= diff; - if (UpperCut_Timer < diff) { Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true); @@ -448,29 +393,22 @@ struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI DoCast(randomMelee,SPELL_UPPERCUT); UpperCut_Timer = 15000+rand()%15000; }else UpperCut_Timer -= diff; - HandleBugs(diff); - //Heal brother when 60yrds close TryHealBrother(diff); - //Teleporting to brother if (Teleport_Timer < diff) { TeleportToMyBrother(); }else Teleport_Timer -= diff; - CheckEnrage(diff); - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI { bool IAmVeklor() {return true;} boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {} - uint32 ShadowBolt_Timer; uint32 Blizzard_Timer; uint32 ArcaneBurst_Timer; @@ -478,9 +416,7 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI int Rand; int RandX; int RandY; - Creature* Summoned; - void Reset() { TwinReset(); @@ -488,13 +424,11 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI Blizzard_Timer = 15000 + rand()%5000;; ArcaneBurst_Timer = 1000; Scorpions_Timer = 7000 + rand()%7000; - //Added. Can be removed if its included in DB. m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0); } - void CastSpellOnBug(Creature *target) { target->setFaction(14); @@ -509,13 +443,11 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI target->AddAura(new Aura(spell, eff_mask, target, target, target)); target->SetHealth(target->GetMaxHealth()); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - // reset arcane burst after teleport - we need to do this because // when VL jumps to VN's location there will be a warrior who will get only 2s to run away // which is almost impossible @@ -523,7 +455,6 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI ArcaneBurst_Timer = 5000; if (!TryActivateAfterTTelep(diff)) return; - //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { @@ -533,7 +464,6 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT); ShadowBolt_Timer = 2000; }else ShadowBolt_Timer -= diff; - //Blizzard_Timer if (Blizzard_Timer < diff) { @@ -543,7 +473,6 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI DoCast(target,SPELL_BLIZZARD); Blizzard_Timer = 15000+rand()%15000; }else Blizzard_Timer -= diff; - if (ArcaneBurst_Timer < diff) { Unit *mvic; @@ -553,29 +482,22 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI ArcaneBurst_Timer = 5000; } }else ArcaneBurst_Timer -= diff; - HandleBugs(diff); - //Heal brother when 60yrds close TryHealBrother(diff); - //Teleporting to brother if (Teleport_Timer < diff) { TeleportToMyBrother(); }else Teleport_Timer -= diff; - CheckEnrage(diff); - //VL doesn't melee //DoMeleeAttackIfReady(); } - void AttackStart(Unit* who) { if (!who) return; - if (who->isTargetableForAttack()) { // VL doesn't melee @@ -587,26 +509,21 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI } } }; - CreatureAI* GetAI_boss_veknilash(Creature* pCreature) { return new boss_veknilashAI (pCreature); } - CreatureAI* GetAI_boss_veklor(Creature* pCreature) { return new boss_veklorAI (pCreature); } - void AddSC_boss_twinemperors() { Script *newscript; - newscript = new Script; newscript->Name = "boss_veknilash"; newscript->GetAI = &GetAI_boss_veknilash; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_veklor"; newscript->GetAI = &GetAI_boss_veklor; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp index 2bb9f1bfb0b..9b782f23644 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp @@ -13,18 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Viscidus SD%Complete: 0 SDComment: place holder SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" - #define SPELL_POISON_SHOCK 25993 #define SPELL_POISONBOLT_VOLLEY 25991 - #define SPELL_TOXIN_CLOUD 25989 diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/def_temple_of_ahnqiraj.h b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/def_temple_of_ahnqiraj.h index 5d545ed7c74..2d41894e32d 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/def_temple_of_ahnqiraj.h +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/def_temple_of_ahnqiraj.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_TEMPLE_OF_AHNQIRAJ_H #define DEF_TEMPLE_OF_AHNQIRAJ_H - #define DATA_SKERAM 1 #define DATA_KRI 2 #define DATA_VEM 3 @@ -17,7 +15,6 @@ #define DATA_VEKNILASHISDEAD 10 #define DATA_VEKNILASH_DEATH 11 #define DATA_BUG_TRIO_DEATH 14 - #define DATA_CTHUN_PHASE 20 #endif diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp index 489a415cf81..75c2a218cbb 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp @@ -13,52 +13,40 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Temple_of_Ahnqiraj SD%Complete: 80 SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.h" #include "def_temple_of_ahnqiraj.h" - struct TRINITY_DLL_DECL instance_temple_of_ahnqiraj : public ScriptedInstance { instance_temple_of_ahnqiraj(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - //If Vem is dead... bool IsBossDied[3]; - //Storing Skeram, Vem and Kri. uint64 SkeramGUID; uint64 VemGUID; uint64 KriGUID; uint64 VeklorGUID; uint64 VeknilashGUID; - uint32 BugTrioDeathCount; - uint32 CthunPhase; - void Initialize() { IsBossDied[0] = false; IsBossDied[1] = false; IsBossDied[2] = false; - SkeramGUID = 0; VemGUID = 0; KriGUID = 0; VeklorGUID = 0; VeknilashGUID = 0; - BugTrioDeathCount = 0; - CthunPhase = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch (pCreature->GetEntry()) @@ -70,13 +58,11 @@ struct TRINITY_DLL_DECL instance_temple_of_ahnqiraj : public ScriptedInstance case 15275: VeknilashGUID = pCreature->GetGUID(); break; } } - bool IsEncounterInProgress() const { //not active in AQ40 return false; } - uint32 GetData(uint32 type) { switch(type) @@ -85,26 +71,21 @@ struct TRINITY_DLL_DECL instance_temple_of_ahnqiraj : public ScriptedInstance 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; } - uint64 GetData64 (uint32 identifier) { switch(identifier) @@ -122,7 +103,6 @@ struct TRINITY_DLL_DECL instance_temple_of_ahnqiraj : public ScriptedInstance } return 0; } // end GetData64 - void SetData(uint32 type, uint32 data) { switch(type) @@ -130,31 +110,25 @@ struct TRINITY_DLL_DECL instance_temple_of_ahnqiraj : public ScriptedInstance case DATA_VEM_DEATH: IsBossDied[0] = true; break; - case DATA_BUG_TRIO_DEATH: BugTrioDeathCount++; break; - case DATA_VEKLOR_DEATH: IsBossDied[1] = true; break; - case DATA_VEKNILASH_DEATH: IsBossDied[2] = true; break; - case DATA_CTHUN_PHASE: CthunPhase = data; break; } } }; - InstanceData* GetInstanceData_instance_temple_of_ahnqiraj(Map* pMap) { return new instance_temple_of_ahnqiraj(pMap); } - void AddSC_instance_temple_of_ahnqiraj() { Script *newscript; diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp index 04e31d7eebd..a7814ea3ede 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp @@ -13,46 +13,35 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: mob_anubisath_sentinel SD%Complete: 95 SDComment: Shadow storm is not properly implemented in core it should only target ppl outside of melee range. SDCategory: Temple of Ahn'Qiraj EndScriptData */ - #include "precompiled.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" - #define SPELL_MENDING_BUFF 2147 - #define SPELL_KNOCK_BUFF 21737 #define SPELL_KNOCK 25778 #define SPELL_MANAB_BUFF 812 #define SPELL_MANAB 25779 - #define SPELL_REFLECTAF_BUFF 13022 #define SPELL_REFLECTSFr_BUFF 19595 #define SPELL_THORNS_BUFF 25777 - #define SPELL_THUNDER_BUFF 2834 #define SPELL_THUNDER 8732 - #define SPELL_MSTRIKE_BUFF 9347 #define SPELL_MSTRIKE 24573 - #define SPELL_STORM_BUFF 2148 #define SPELL_STORM 26546 - struct TRINITY_DLL_DECL aqsentinelAI; class TRINITY_DLL_DECL SentinelAbilityAura : public Aura { @@ -65,12 +54,10 @@ class TRINITY_DLL_DECL SentinelAbilityAura : public Aura int32 currentBasePoints; uint32 abilityId; }; - struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI { uint32 ability; int abselected; - void selectAbility(int asel) { switch (asel) @@ -86,20 +73,16 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI case 8: ability = SPELL_STORM_BUFF;break; } } - aqsentinelAI(Creature *c) : ScriptedAI(c) { ClearBuddyList(); abselected = 0; // just initialization of variable } - Creature *nearby[3]; - void ClearBuddyList() { nearby[0] = nearby[1] = nearby[2] = NULL; } - void AddBuddyToList(Creature *c) { if (c==m_creature) @@ -115,7 +98,6 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI } } } - void GiveBuddyMyList(Creature *c) { aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); @@ -124,14 +106,12 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI cai->AddBuddyToList(nearby[i]); cai->AddBuddyToList(m_creature); } - void SendMyListToBuddies() { for (int i=0; i<3; ++i) if (nearby[i]) GiveBuddyMyList(nearby[i]); } - void CallBuddiesToAttack(Unit *who) { for (int i=0; i<3; ++i) @@ -148,19 +128,15 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI } } } - void AddSentinelsNear(Unit *nears) { std::list assistList; m_creature->GetCreatureListWithEntryInGrid(assistList,15264,70.0f); - if (assistList.empty()) return; - - for(std::list::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + for (std::list::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) AddBuddyToList((*iter)); } - int pickAbilityRandom(bool *chosenAbilities) { for (int t = 0; t < 2; ++t) @@ -176,13 +152,11 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI } return 0; // should never happen } - void GetOtherSentinels(Unit *who) { bool *chosenAbilities = new bool[9]; memset(chosenAbilities, 0, 9*sizeof(bool)); selectAbility(pickAbilityRandom(chosenAbilities)); - ClearBuddyList(); AddSentinelsNear(m_creature); int bli; @@ -198,12 +172,9 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ SendMyListToBuddies(); CallBuddiesToAttack(who); - delete[] chosenAbilities; } - bool gatherOthersWhenAggro; - void Reset() { if (!m_creature->isDead()) @@ -219,7 +190,6 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI ClearBuddyList(); gatherOthersWhenAggro = true; } - void GainSentinelAbility(uint32 id) { const SpellEntry *spell = GetSpellStore()->LookupEntry(id); @@ -233,16 +203,13 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry*)spell, id, eff_mask); m_creature->AddAura(a); } - void EnterCombat(Unit *who) { if (gatherOthersWhenAggro) GetOtherSentinels(who); - GainSentinelAbility(ability); DoZoneInCombat(); } - void JustDied(Unit* who) { for (int ni=0; ni<3; ++ni) @@ -259,11 +226,10 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); } } - Unit *GetHatedManaUser() { std::list::iterator i; - for (i = m_creature->getThreatManager().getThreatList().begin();i != m_creature->getThreatManager().getThreatList().end(); ++i) + for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); if (pUnit->getPowerType()==POWER_MANA) @@ -276,7 +242,6 @@ CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature) { return new aqsentinelAI (pCreature); } - void AddSC_mob_anubisath_sentinel() { Script *newscript; @@ -285,7 +250,6 @@ void AddSC_mob_anubisath_sentinel() newscript->GetAI = &GetAI_mob_anubisath_sentinelAI; newscript->RegisterSelf(); } - SentinelAbilityAura::~SentinelAbilityAura() {} Unit* SentinelAbilityAura::GetTriggerTarget() const { @@ -296,10 +260,8 @@ Unit* SentinelAbilityAura::GetTriggerTarget() const case SPELL_MSTRIKE_BUFF: case SPELL_STORM_BUFF: return aOwner->m_creature->getVictim(); - case SPELL_MANAB_BUFF: return aOwner->GetHatedManaUser(); - case SPELL_MENDING_BUFF: case SPELL_REFLECTAF_BUFF: case SPELL_REFLECTSFr_BUFF: @@ -308,7 +270,6 @@ Unit* SentinelAbilityAura::GetTriggerTarget() const return aOwner->m_creature; } } - SentinelAbilityAura::SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry *spell, uint32 ability, uint32 eff) : Aura(spell, eff, abilityOwner->m_creature, abilityOwner->m_creature, abilityOwner->m_creature, NULL) { diff --git a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp index 70e0b3e5e28..c3e984ab2f5 100644 --- a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp +++ b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: The_Barrens SD%Complete: 90 SDComment: Quest support: 863, 898, 1719, 2458, 4921, 6981, SDCategory: Barrens EndScriptData */ - /* ContentData npc_beaten_corpse npc_gilthares @@ -29,30 +27,23 @@ npc_taskmaster_fizzule npc_twiggy_flathead npc_wizzlecrank_shredder EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_beaten_corpse ######*/ - #define GOSSIP_CORPSE "Examine corpse in detail..." - enum eQuests { QUEST_LOST_IN_BATTLE = 4921 }; - bool GossipHello_npc_beaten_corpse(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF +1) @@ -62,11 +53,9 @@ bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### # npc_gilthares ######*/ - enum eGilthares { SAY_GIL_START = -1000370, @@ -80,25 +69,19 @@ enum eGilthares SAY_GIL_ALMOST = -1000378, SAY_GIL_SWEET = -1000379, SAY_GIL_FREED = -1000380, - QUEST_FREE_FROM_HOLD = 898, AREA_MERCHANT_COAST = 391, FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest }; - struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI { npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { } - void WaypointReached(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 16: @@ -122,13 +105,11 @@ struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI break; } } - void Aggro(Unit* pWho) { //not always use if (rand()%4) return; - //only aggro text if not player and only in this area if (pWho->GetTypeId() != TYPEID_PLAYER && m_creature->GetAreaId() == AREA_MERCHANT_COAST) { @@ -137,45 +118,35 @@ struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_gilthares(Creature* pCreature) { return new npc_giltharesAI(pCreature); } - bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) { pCreature->setFaction(FACTION_ESCORTEE); pCreature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_GIL_START, pCreature, pPlayer); - if (npc_giltharesAI* pEscortAI = CAST_AI(npc_giltharesAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - /*###### ## npc_sputtervalve ######*/ - #define GOSSIP_SPUTTERVALVE "Can you tell me about this shard?" - bool GossipHello_npc_sputtervalve(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_sputtervalve(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -185,30 +156,25 @@ bool GossipSelect_npc_sputtervalve(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_taskmaster_fizzule ######*/ - enum eEnums { FACTION_FRIENDLY_F = 35, SPELL_FLARE = 10113, SPELL_FOLLY = 10137, }; - struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI { npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) { factionNorm = c->getFaction(); } - uint32 factionNorm; bool IsFriend; uint32 Reset_Timer; uint8 FlareCount; - void Reset() { IsFriend = false; @@ -216,33 +182,26 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI FlareCount = 0; m_creature->setFaction(factionNorm); } - void DoFriend() { m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->StopMoving(); m_creature->GetMotionMaster()->MoveIdle(); - m_creature->setFaction(FACTION_FRIENDLY_F); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) { ++FlareCount; - if (FlareCount >= 2) IsFriend = true; } } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (IsFriend) @@ -253,13 +212,10 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI return; } else Reset_Timer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void ReceiveEmote(Player* pPlayer, uint32 emote) { if (emote == TEXTEMOTE_SALUTE) @@ -268,22 +224,18 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI { if (m_creature->getFaction() == FACTION_FRIENDLY_F) return; - DoFriend(); } } } }; - CreatureAI* GetAI_npc_taskmaster_fizzule(Creature* pCreature) { return new npc_taskmaster_fizzuleAI(pCreature); } - /*##### ## npc_twiggy_flathead #####*/ - #define BIG_WILL 6238 #define AFFRAY_CHALLENGER 6240 #define SAY_BIG_WILL_READY -1000267 @@ -291,7 +243,6 @@ CreatureAI* GetAI_npc_taskmaster_fizzule(Creature* pCreature) #define SAY_TWIGGY_FLATHEAD_FRAY -1000269 #define SAY_TWIGGY_FLATHEAD_DOWN -1000270 #define SAY_TWIGGY_FLATHEAD_OVER -1000271 - float AffrayChallengerLoc[6][4]= { {-1683, -4326, 2.79, 0}, @@ -301,11 +252,9 @@ float AffrayChallengerLoc[6][4]= {-1674, -4326, 2.79, 3.49}, {-1677, -4334, 2.79, 1.66} }; - struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI { npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {} - bool EventInProgress; bool EventGrate; bool EventBigWill; @@ -316,7 +265,6 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI uint64 PlayerGUID; uint64 AffrayChallenger[6]; uint64 BigWill; - void Reset() { EventInProgress = false; @@ -326,47 +274,37 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI Challenger_checker = 0; Wave = 0; PlayerGUID = 0; - - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) { AffrayChallenger[i] = 0; Challenger_down[i] = false; } BigWill = 0; } - void EnterCombat(Unit *who) { } - void MoveInLineOfSight(Unit *who) { if (!who || (!who->isAlive())) return; - if (m_creature->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) { PlayerGUID = who->GetGUID(); EventInProgress = true; } } - void KilledUnit(Unit *victim) { } - void UpdateAI(const uint32 diff) { if (EventInProgress) { Player* pWarrior = NULL; - if (PlayerGUID) pWarrior = Unit::GetPlayer(PlayerGUID); - if (!pWarrior) return; - if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { EventInProgress = false; DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature); pWarrior->FailQuest(1719); - - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) { if (AffrayChallenger[i]) { @@ -383,7 +321,6 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI AffrayChallenger[i] = 0; Challenger_down[i] = false; } - if (BigWill) { Creature* pCreature = Unit::GetCreature((*m_creature), BigWill); @@ -397,17 +334,14 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI } BigWill = 0; } - if (!EventGrate && EventInProgress) { float x,y,z; pWarrior->GetPosition(x, y, z); - if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { pWarrior->AreaExploredOrEventHappens(1719); DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, m_creature); - - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) { Creature* pCreature = m_creature->SummonCreature(AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); if (!pCreature) @@ -427,7 +361,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI { if (Challenger_checker < diff) { - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) { if (AffrayChallenger[i]) { @@ -441,7 +375,6 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI } Challenger_checker = 1000; } else Challenger_checker -= diff; - if (Wave_Timer < diff) { if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) @@ -489,16 +422,13 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) { return new npc_twiggy_flatheadAI (pCreature); } - /*##### ## npc_wizzlecrank_shredder #####*/ - enum eEnums_Wizzlecrank { SAY_START = -1000272, @@ -509,13 +439,11 @@ enum eEnums_Wizzlecrank SAY_PROGRESS_2 = -1000277, SAY_PROGRESS_3 = -1000278, SAY_END = -1000279, - QUEST_ESCAPE = 863, FACTION_RATCHET = 637, NPC_PILOT_WIZZ = 3451, NPC_MERCENARY = 3282, }; - struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) @@ -524,31 +452,25 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI m_uiPostEventTimer = 1000; m_uiPostEventCount = 0; } - bool m_bIsPostEvent; uint32 m_uiPostEventTimer; uint32 m_uiPostEventCount; - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) { if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) m_creature->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; m_uiPostEventTimer = 1000; m_uiPostEventCount = 0; } } - void WaypointReached(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 0: @@ -569,14 +491,11 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI break; } } - void WaypointStart(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 9: @@ -588,16 +507,13 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI break; } } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) m_creature->SetStandState(UNIT_STAND_STATE_DEAD); - if (pSummoned->GetEntry() == NPC_MERCENARY) pSummoned->AI()->AttackStart(m_creature); } - void UpdateEscortAI(const uint32 uiDiff) { if (!UpdateVictim()) @@ -625,21 +541,17 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI } break; } - ++m_uiPostEventCount; m_uiPostEventTimer = 5000; } else m_uiPostEventTimer -= uiDiff; } - return; } - DoMeleeAttackIfReady(); } }; - bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ESCAPE) @@ -650,44 +562,36 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, } return true; } - CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) { return new npc_wizzlecrank_shredderAI(pCreature); } - void AddSC_the_barrens() { Script *newscript; - newscript = new Script; newscript->Name = "npc_beaten_corpse"; newscript->pGossipHello = &GossipHello_npc_beaten_corpse; newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_gilthares"; newscript->GetAI = &GetAI_npc_gilthares; newscript->pQuestAccept = &QuestAccept_npc_gilthares; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_sputtervalve"; newscript->pGossipHello = &GossipHello_npc_sputtervalve; newscript->pGossipSelect = &GossipSelect_npc_sputtervalve; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_taskmaster_fizzule"; newscript->GetAI = &GetAI_npc_taskmaster_fizzule; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_twiggy_flathead"; newscript->GetAI = &GetAI_npc_twiggy_flathead; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_wizzlecrank_shredder"; newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI; diff --git a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp index 9616aa4acf6..c8f19e44edd 100644 --- a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp @@ -13,44 +13,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Thousand Needles SD%Complete: 100 SDComment: Support for Quest: 1950, 4770, 4904, 4966 SDCategory: Thousand Needles EndScriptData */ - /* ContentData npc_kanati npc_lakota_windsong npc_swiftmountain npc_plucky EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*##### # npc_kanati ######*/ - enum eKanati { SAY_KAN_START = -1000410, - QUEST_PROTECT_KANATI = 4966, NPC_GALAK_ASS = 10720 }; - const float m_afGalakLoc[]= {-4867.387695, -1357.353760, -48.226 }; - struct TRINITY_DLL_DECL npc_kanatiAI : public npc_escortAI { npc_kanatiAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -65,26 +55,22 @@ struct TRINITY_DLL_DECL npc_kanatiAI : public npc_escortAI break; } } - void DoSpawnGalak() { - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) m_creature->SummonCreature(NPC_GALAK_ASS, m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); } - void JustSummoned(Creature* pSummoned) { pSummoned->AI()->AttackStart(m_creature); } }; - CreatureAI* GetAI_npc_kanati(Creature* pCreature) { return new npc_kanatiAI(pCreature); } - bool QuestAccept_npc_kanati(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_PROTECT_KANATI) @@ -94,11 +80,9 @@ bool QuestAccept_npc_kanati(Player* pPlayer, Creature* pCreature, const Quest* p } return true; } - /*###### # npc_lakota_windsong ######*/ - enum eLakota { SAY_LAKO_START = -1000365, @@ -106,16 +90,13 @@ enum eLakota SAY_LAKO_HERE_COME = -1000367, SAY_LAKO_MORE = -1000368, SAY_LAKO_END = -1000369, - QUEST_FREE_AT_LAST = 4904, NPC_GRIM_BANDIT = 10758, FACTION_ESCORTEE_LAKO = 232, //guessed - ID_AMBUSH_1 = 0, ID_AMBUSH_2 = 2, ID_AMBUSH_3 = 4 }; - float m_afBanditLoc[6][6]= { {-4905.479492, -2062.732666, 84.352}, @@ -125,13 +106,10 @@ float m_afBanditLoc[6][6]= {-4767.985352, -1873.169189, 90.192}, {-4788.861328, -1888.007813, 89.888} }; - struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI { npc_lakota_windsongAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -154,62 +132,51 @@ struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI break; } } - void DoSpawnBandits(int uiAmbushId) { - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_creature->SummonCreature(NPC_GRIM_BANDIT, m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; - CreatureAI* GetAI_npc_lakota_windsong(Creature* pCreature) { return new npc_lakota_windsongAI(pCreature); } - bool QuestAccept_npc_lakota_windsong(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) { DoScriptText(SAY_LAKO_START, pCreature, pPlayer); pCreature->setFaction(FACTION_ESCORTEE_LAKO); - if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsongAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - /*###### # npc_paoka_swiftmountain ######*/ - enum ePacka { SAY_START = -1000147, SAY_WYVERN = -1000148, SAY_COMPLETE = -1000149, - QUEST_HOMEWARD = 4770, NPC_WYVERN = 4107, FACTION_ESCORTEE = 232 //guessed }; - float m_afWyvernLoc[3][3]= { {-4990.606, -906.057, -5.343}, {-4970.241, -927.378, -4.951}, {-4985.364, -952.528, -5.199} }; - struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI { npc_paoka_swiftmountainAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -227,40 +194,33 @@ struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI break; } } - void DoSpawnWyvern() { - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) m_creature->SummonCreature(NPC_WYVERN, m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; - CreatureAI* GetAI_npc_paoka_swiftmountain(Creature* pCreature) { return new npc_paoka_swiftmountainAI(pCreature); } - bool QuestAccept_npc_paoka_swiftmountain(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_HOMEWARD) { DoScriptText(SAY_START, pCreature, pPlayer); pCreature->setFaction(FACTION_ESCORTEE); - if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountainAI,pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - /*##### # npc_plucky ######*/ - #define GOSSIP_P "Please tell me the Phrase.." - enum ePlucky { FACTION_FRIENDLY = 35, @@ -268,27 +228,20 @@ enum ePlucky SPELL_PLUCKY_HUMAN = 9192, SPELL_PLUCKY_CHICKEN = 9220 }; - struct TRINITY_DLL_DECL npc_pluckyAI : public ScriptedAI { npc_pluckyAI(Creature *c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } - uint32 m_uiNormFaction; uint32 m_uiResetTimer; - void Reset() { m_uiResetTimer = 120000; - if (m_creature->getFaction() != m_uiNormFaction) m_creature->setFaction(m_uiNormFaction); - if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_creature->CastSpell(m_creature, SPELL_PLUCKY_CHICKEN, false); } - void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) { if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) @@ -300,7 +253,6 @@ struct TRINITY_DLL_DECL npc_pluckyAI : public ScriptedAI m_creature->CastSpell(m_creature, SPELL_PLUCKY_HUMAN, false); } } - if (uiTextEmote == TEXTEMOTE_CHICKEN) { if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) @@ -314,7 +266,6 @@ struct TRINITY_DLL_DECL npc_pluckyAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) @@ -325,29 +276,23 @@ struct TRINITY_DLL_DECL npc_pluckyAI : public ScriptedAI EnterEvadeMode(); else m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - return; } else m_uiResetTimer -= uiDiff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - bool GossipHello_npc_plucky(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(738, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_plucky(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -359,38 +304,31 @@ bool GossipSelect_npc_plucky(Player* pPlayer, Creature* pCreature, uint32 uiSend } return true; } - CreatureAI* GetAI_npc_plucky(Creature* pCreature) { return new npc_pluckyAI(pCreature); } - /*##### # ######*/ - void AddSC_thousand_needles() { Script *newscript; - newscript = new Script; newscript->Name = "npc_kanati"; newscript->GetAI = &GetAI_npc_kanati; newscript->pQuestAccept = &QuestAccept_npc_kanati; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lakota_windsong"; newscript->GetAI = &GetAI_npc_lakota_windsong; newscript->pQuestAccept = &QuestAccept_npc_lakota_windsong; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_paoka_swiftmountain"; newscript->GetAI = &GetAI_npc_paoka_swiftmountain; newscript->pQuestAccept = &QuestAccept_npc_paoka_swiftmountain; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_plucky"; newscript->GetAI = &GetAI_npc_plucky; diff --git a/src/bindings/scripts/scripts/kalimdor/thunder_bluff.cpp b/src/bindings/scripts/scripts/kalimdor/thunder_bluff.cpp index f94a31a0dc9..f5b5c49ae6c 100644 --- a/src/bindings/scripts/scripts/kalimdor/thunder_bluff.cpp +++ b/src/bindings/scripts/scripts/kalimdor/thunder_bluff.cpp @@ -13,38 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Thunder_Bluff SD%Complete: 100 SDComment: Quest support: 925 SDCategory: Thunder Bluff EndScriptData */ - #include "precompiled.h" - /*##### # npc_cairne_bloodhoof ######*/ - #define SPELL_BERSERKER_CHARGE 16636 #define SPELL_CLEAVE 16044 #define SPELL_MORTAL_STRIKE 16856 #define SPELL_THUNDERCLAP 23931 #define SPELL_UPPERCUT 22916 - #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." //TODO: verify abilities/timers struct TRINITY_DLL_DECL npc_cairne_bloodhoofAI : public ScriptedAI { npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} - uint32 BerserkerCharge_Timer; uint32 Cleave_Timer; uint32 MortalStrike_Timer; uint32 Thunderclap_Timer; uint32 Uppercut_Timer; - void Reset() { BerserkerCharge_Timer = 30000; @@ -53,14 +46,11 @@ struct TRINITY_DLL_DECL npc_cairne_bloodhoofAI : public ScriptedAI Thunderclap_Timer = 15000; Uppercut_Timer = 10000; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (BerserkerCharge_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); @@ -68,31 +58,26 @@ struct TRINITY_DLL_DECL npc_cairne_bloodhoofAI : public ScriptedAI DoCast(target,SPELL_BERSERKER_CHARGE); BerserkerCharge_Timer = 25000; }else BerserkerCharge_Timer -= diff; - if (Uppercut_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_UPPERCUT); Uppercut_Timer = 20000; }else Uppercut_Timer -= diff; - if (Thunderclap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); Thunderclap_Timer = 15000; }else Thunderclap_Timer -= diff; - if (MortalStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTAL_STRIKE); MortalStrike_Timer = 15000; }else MortalStrike_Timer -= diff; - if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 7000; }else Cleave_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -100,20 +85,15 @@ CreatureAI* GetAI_npc_cairne_bloodhoof(Creature* pCreature) { return new npc_cairne_bloodhoofAI (pCreature); } - bool GossipHello_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_SENDER_INFO) @@ -123,11 +103,9 @@ bool GossipSelect_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature, uin } return true; } - void AddSC_thunder_bluff() { Script *newscript; - newscript = new Script; newscript->Name = "npc_cairne_bloodhoof"; newscript->GetAI = &GetAI_npc_cairne_bloodhoof; diff --git a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp index eac657fd727..cc20f7c1022 100644 --- a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp @@ -13,54 +13,42 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Ungoro Crater SD%Complete: 100 SDComment: Support for Quest: 4245, 4491 SDCategory: Ungoro Crater EndScriptData */ - /* ContentData npc_a-me npc_ringo EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "follower_ai.h" - #define SAY_READY -1000200 #define SAY_AGGRO1 -1000201 #define SAY_SEARCH -1000202 #define SAY_AGGRO2 -1000203 #define SAY_AGGRO3 -1000204 #define SAY_FINISH -1000205 - #define SPELL_DEMORALIZINGSHOUT 13730 - #define QUEST_CHASING_AME 4245 #define ENTRY_TARLORD 6519 #define ENTRY_TARLORD1 6519 #define ENTRY_STOMPER 6513 - struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI { npc_ameAI(Creature *c) : npc_escortAI(c) {} - uint32 DEMORALIZINGSHOUT_Timer; - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { - case 19: m_creature->SummonCreature(ENTRY_STOMPER, -6391.69, -1730.49, -272.83, 4.96, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); DoScriptText(SAY_AGGRO1, m_creature, pPlayer); @@ -81,41 +69,33 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI if (pPlayer) pPlayer->GroupEventHappens(QUEST_CHASING_AME,m_creature); break; - } } - void Reset() { DEMORALIZINGSHOUT_Timer = 5000; } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) { if (Player* pPlayer = GetPlayerForEscort()) pPlayer->FailQuest(QUEST_CHASING_AME); } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); if (!UpdateVictim()) return; - if (DEMORALIZINGSHOUT_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DEMORALIZINGSHOUT); DEMORALIZINGSHOUT_Timer = 70000; }else DEMORALIZINGSHOUT_Timer -= diff; - } }; - bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_CHASING_AME) @@ -128,31 +108,25 @@ bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* ques } return true; } - CreatureAI* GetAI_npc_ame(Creature* pCreature) { return new npc_ameAI(pCreature); } - /*#### # npc_ringo ####*/ - enum eRingo { SAY_RIN_START_1 = -1000416, SAY_RIN_START_2 = -1000417, - SAY_FAINT_1 = -1000418, SAY_FAINT_2 = -1000419, SAY_FAINT_3 = -1000420, SAY_FAINT_4 = -1000421, - SAY_WAKE_1 = -1000422, SAY_WAKE_2 = -1000423, SAY_WAKE_3 = -1000424, SAY_WAKE_4 = -1000425, - SAY_RIN_END_1 = -1000426, SAY_SPR_END_2 = -1000427, SAY_RIN_END_3 = -1000428, @@ -161,23 +135,18 @@ enum eRingo SAY_RIN_END_6 = -1000431, // signed for 6784 SAY_SPR_END_7 = -1000432, EMOTE_RIN_END_8 = -1000433, - SPELL_REVIVE_RINGO = 15591, QUEST_A_LITTLE_HELP = 4491, NPC_SPRAGGLE = 9997, FACTION_ESCORTEE = 113 }; - struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI { npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } - uint32 m_uiFaintTimer; uint32 m_uiEndEventProgress; uint32 m_uiEndEventTimer; - Unit* pSpraggle; - void Reset() { m_uiFaintTimer = urand(30000, 60000); @@ -185,11 +154,9 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI m_uiEndEventTimer = 1000; pSpraggle = NULL; } - void MoveInLineOfSight(Unit *pWho) { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) @@ -199,44 +166,34 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI if (pPlayer->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE) pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, m_creature); } - pSpraggle = pWho; SetFollowComplete(true); } } } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO) ClearFaint(); } - void SetFaint() { if (!HasFollowState(STATE_FOLLOW_POSTEVENT)) { SetFollowPaused(true); - DoScriptText(RAND(SAY_FAINT_1,SAY_FAINT_2,SAY_FAINT_3,SAY_FAINT_4), m_creature); } - //what does actually happen here? Emote? Aura? m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); } - void ClearFaint() { m_creature->SetStandState(UNIT_STAND_STATE_STAND); - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) return; - DoScriptText(RAND(SAY_WAKE_1,SAY_WAKE_2,SAY_WAKE_3,SAY_WAKE_4), m_creature); - SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) { if (!UpdateVictim()) @@ -250,7 +207,6 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI SetFollowComplete(); return; } - switch(m_uiEndEventProgress) { case 1: @@ -291,7 +247,6 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI SetFollowComplete(); break; } - ++m_uiEndEventProgress; } else @@ -310,19 +265,15 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI m_uiFaintTimer -= uiDiff; } } - return; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_ringo(Creature* pCreature) { return new npc_ringoAI(pCreature); } - bool QuestAccept_npc_ringo(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_A_LITTLE_HELP) @@ -333,20 +284,16 @@ bool QuestAccept_npc_ringo(Player* pPlayer, Creature* pCreature, const Quest* pQ pRingoAI->StartFollow(pPlayer, FACTION_ESCORTEE, pQuest); } } - return true; } - void AddSC_ungoro_crater() { Script *newscript; - newscript = new Script; newscript->Name = "npc_ame"; newscript->GetAI = &GetAI_npc_ame; newscript->pQuestAccept = &QuestAccept_npc_ame; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ringo"; newscript->GetAI = &GetAI_npc_ringo; diff --git a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/def_wailing_caverns.h b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/def_wailing_caverns.h index f6c7bee8571..87a93c9a386 100644 --- a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/def_wailing_caverns.h +++ b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/def_wailing_caverns.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_WAILING_CAVERNS_H #define DEF_WAILING_CAVERNS_H - enum eTypes { TYPE_LORD_COBRAHN = 1, @@ -17,8 +15,6 @@ enum eTypes TYPE_NARALEX_PART3 = 8, TYPE_MUTANUS_THE_DEVOURER = 9, TYPE_NARALEX_YELLED = 10, - DATA_NARALEX = 3679, }; - -#endif \ No newline at end of file +#endif diff --git a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/instance_wailing_caverns.cpp b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/instance_wailing_caverns.cpp index d955226e1c3..c446c3beb6b 100644 --- a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/instance_wailing_caverns.cpp +++ b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/instance_wailing_caverns.cpp @@ -13,42 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Wailing_Caverns SD%Complete: 99 SDComment: Everything seems to work, still need some checking SDCategory: Wailing Caverns EndScriptData */ - #include "precompiled.h" #include "def_wailing_caverns.h" - #define MAX_ENCOUNTER 9 - struct TRINITY_DLL_DECL instance_wailing_caverns : public ScriptedInstance { instance_wailing_caverns(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - bool yelled; uint64 NaralexGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - yelled = false; NaralexGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { if (pCreature->GetEntry() == DATA_NARALEX) NaralexGUID = pCreature->GetGUID(); } - void SetData(uint32 type, uint32 data) { switch (type) @@ -66,7 +56,6 @@ struct TRINITY_DLL_DECL instance_wailing_caverns : public ScriptedInstance } if (data == DONE)SaveToDB(); } - uint32 GetData(uint32 type) { switch (type) @@ -84,26 +73,21 @@ struct TRINITY_DLL_DECL instance_wailing_caverns : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { if (data == DATA_NARALEX)return NaralexGUID; return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; - OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - void Load(const char* in) { if (!in) @@ -111,27 +95,20 @@ struct TRINITY_DLL_DECL instance_wailing_caverns : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] != DONE) m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; } - }; - InstanceData* GetInstanceData_instance_wailing_caverns(Map* pMap) { return new instance_wailing_caverns(pMap); } - void AddSC_instance_wailing_caverns() { Script *newscript; @@ -139,4 +116,4 @@ void AddSC_instance_wailing_caverns() newscript->Name = "instance_wailing_caverns"; newscript->GetInstanceData = &GetInstanceData_instance_wailing_caverns; newscript->RegisterSelf(); -} \ No newline at end of file +} diff --git a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/wailing_caverns.cpp b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/wailing_caverns.cpp index d734e32d13b..75c23a4121e 100644 --- a/src/bindings/scripts/scripts/kalimdor/wailing_caverns/wailing_caverns.cpp +++ b/src/bindings/scripts/scripts/kalimdor/wailing_caverns/wailing_caverns.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Wailing Caverns SD%Complete: 95 SDComment: Need to add skill usage for Disciple of Naralex SDCategory: Wailing Caverns EndScriptData */ - /* ContentData EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_wailing_caverns.h" - /*###### ## npc_disciple_of_naralex ######*/ - enum eEnums { //say @@ -67,12 +62,10 @@ enum eEnums NPC_NIGHTMARE_ECTOPLASM = 5763, NPC_MUTANUS_THE_DEVOURER = 3654, }; - #define GOSSIP_ID_START_1 698 //Naralex sleeps again! #define GOSSIP_ID_START_2 699 //The fanglords are dead! #define GOSSIP_ITEM_NARALEX "Let the event begin!" #define ACHIEVEMENT_WAILING_CAVERNS 630 - struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI { npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c) @@ -84,17 +77,14 @@ struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI m_creature->setActive(true); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - uint32 eventTimer; uint32 currentEvent; uint32 eventProgress; ScriptedInstance *pInstance; - void WaypointReached(uint32 i) { if (!pInstance) return; - switch (i) { case 4: @@ -121,17 +111,13 @@ struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI break; } } - void Reset() { - } - void EnterCombat(Unit* who) { DoScriptText(SAY_ATTACKED, m_creature, who); } - void JustDied(Unit *slayer) { if (pInstance) @@ -142,17 +128,14 @@ struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI pInstance->SetData(TYPE_NARALEX_PART3, FAIL); } } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void UpdateAI(const uint32 diff) { if (currentEvent != TYPE_NARALEX_PART3) npc_escortAI::UpdateAI(diff); - if (!pInstance) return; if (eventTimer <= diff) @@ -261,7 +244,7 @@ struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievWC); } } @@ -329,16 +312,13 @@ struct TRINITY_DLL_DECL npc_disciple_of_naralexAI : public npc_escortAI }else eventTimer -= diff; } }; - CreatureAI* GetAI_npc_disciple_of_naralex(Creature* pCreature) { return new npc_disciple_of_naralexAI(pCreature); } - bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) { ScriptedInstance *pInstance = pCreature->GetInstanceData(); - if (pInstance) { pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true); @@ -347,7 +327,6 @@ bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID()); - if (!pInstance->GetData(TYPE_NARALEX_YELLED)) { DoScriptText(SAY_AT_LAST, pCreature); @@ -361,7 +340,6 @@ bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { ScriptedInstance *pInstance = pCreature->GetInstanceData(); @@ -370,23 +348,18 @@ bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, pPlayer->CLOSE_GOSSIP_MENU(); if (pInstance) pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); - DoScriptText(SAY_MAKE_PREPARATIONS, pCreature); - pCreature->setFaction(250); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); } return true; } - void AddSC_wailing_caverns() { Script *newscript; - newscript = new Script; newscript->Name = "npc_disciple_of_naralex"; newscript->pGossipHello = &GossipHello_npc_disciple_of_naralex; diff --git a/src/bindings/scripts/scripts/kalimdor/winterspring.cpp b/src/bindings/scripts/scripts/kalimdor/winterspring.cpp index cf4f019f705..ba9e628a270 100644 --- a/src/bindings/scripts/scripts/kalimdor/winterspring.cpp +++ b/src/bindings/scripts/scripts/kalimdor/winterspring.cpp @@ -13,47 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Winterspring SD%Complete: 90 SDComment: Quest support: 5126 (Loraxs' tale missing proper gossip items text). Vendor Rivern Frostwind. Obtain Cache of Mau'ari SDCategory: Winterspring EndScriptData */ - /* ContentData npc_lorax npc_rivern_frostwind npc_witch_doctor_mauari EndContentData */ - #include "precompiled.h" - /*###### ## npc_lorax ######*/ - #define GOSSIP_HL "Talk to me" - #define GOSSIP_SL1 "What do you do here?" #define GOSSIP_SL2 "I can help you" #define GOSSIP_SL3 "What deal?" #define GOSSIP_SL4 "Then what happened?" #define GOSSIP_SL5 "He is not safe, i'll make sure of that." - bool GossipHello_npc_lorax(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lorax(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -85,53 +74,40 @@ bool GossipSelect_npc_lorax(Player* pPlayer, Creature* pCreature, uint32 uiSende } return true; } - /*###### ## npc_rivern_frostwind ######*/ - bool GossipHello_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_witch_doctor_mauari ######*/ - #define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please." - bool GossipHello_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestRewardStatus(975)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(3377, pCreature->GetGUID()); }else pPlayer->SEND_GOSSIP_MENU(3375, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction ==GOSSIP_ACTION_INFO_DEF+1) @@ -139,26 +115,21 @@ bool GossipSelect_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature, pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer, 16351, false); } - return true; } - void AddSC_winterspring() { Script *newscript; - newscript = new Script; newscript->Name = "npc_lorax"; newscript->pGossipHello = &GossipHello_npc_lorax; newscript->pGossipSelect = &GossipSelect_npc_lorax; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_rivern_frostwind"; newscript->pGossipHello = &GossipHello_npc_rivern_frostwind; newscript->pGossipSelect = &GossipSelect_npc_rivern_frostwind; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_witch_doctor_mauari"; newscript->pGossipHello = &GossipHello_npc_witch_doctor_mauari; diff --git a/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp b/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp index d0111410bbd..97c62595708 100644 --- a/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp +++ b/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp @@ -13,85 +13,66 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Zulfarrak SD%Complete: 50 SDComment: Consider it temporary, no instance script made for this instance yet. SDCategory: Zul'Farrak EndScriptData */ - /* ContentData npc_sergeant_bly npc_weegli_blastfuse EndContentData */ - #include "precompiled.h" - /*###### ## npc_sergeant_bly ######*/ - #define FACTION_HOSTILE 14 #define FACTION_FRIENDLY 35 - #define SPELL_SHIELD_BASH 11972 #define SPELL_REVENGE 12170 - #define GOSSIP_BLY "[PH] In that case, I will take my reward!" - struct TRINITY_DLL_DECL npc_sergeant_blyAI : public ScriptedAI { npc_sergeant_blyAI(Creature *c) : ScriptedAI(c) { //pInstance = c->GetInstanceData(); } - //ScriptedInstance* pInstance; - uint32 ShieldBash_Timer; uint32 Revenge_Timer; //this is wrong, spell should never be used unless m_creature->getVictim() dodge, parry or block attack. Trinity support required. - void Reset() { ShieldBash_Timer = 5000; Revenge_Timer = 8000; - m_creature->setFaction(FACTION_FRIENDLY); - /*if (pInstance) pInstance->SetData(0, NOT_STARTED);*/ } - void EnterCombat(Unit *who) { /*if (pInstance) pInstance->SetData(0, IN_PROGRESS);*/ } - void JustDied(Unit *victim) { /*if (pInstance) pInstance->SetData(0, DONE);*/ } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ShieldBash_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHIELD_BASH); ShieldBash_Timer = 15000; }else ShieldBash_Timer -= diff; - if (Revenge_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_REVENGE); Revenge_Timer = 10000; }else Revenge_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -99,7 +80,6 @@ CreatureAI* GetAI_npc_sergeant_bly(Creature* pCreature) { return new npc_sergeant_blyAI (pCreature); } - bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature) { /*if (pInstance->GetData(0) == DONE) @@ -111,10 +91,8 @@ bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID()); else pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID());*/ - return true; } - bool GossipSelect_npc_sergeant_bly(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -125,50 +103,40 @@ bool GossipSelect_npc_sergeant_bly(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_weegli_blastfuse ######*/ - #define SPELL_BOMB 8858 #define SPELL_GOBLIN_LAND_MINE 21688 #define SPELL_SHOOT 6660 #define SPELL_WEEGLIS_BARREL 10772 - #define GOSSIP_WEEGLI "[PH] Please blow up the door." - struct TRINITY_DLL_DECL npc_weegli_blastfuseAI : public ScriptedAI { npc_weegli_blastfuseAI(Creature *c) : ScriptedAI(c) { //pInstance = c->GetInstanceData(); } - //ScriptedInstance* pInstance; - void Reset() { /*if (pInstance) pInstance->SetData(0, NOT_STARTED);*/ } - void EnterCombat(Unit *who) { /*if (pInstance) pInstance->SetData(0, IN_PROGRESS);*/ } - void JustDied(Unit *victim) { /*if (pInstance) pInstance->SetData(0, DONE);*/ } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; @@ -176,7 +144,6 @@ CreatureAI* GetAI_npc_weegli_blastfuse(Creature* pCreature) { return new npc_weegli_blastfuseAI (pCreature); } - bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature) { //event not implemented yet, this is only placeholder for future developement @@ -191,7 +158,6 @@ bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started return true; } - bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -201,18 +167,15 @@ bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature, uin } return true; } - /*###### ## go_shallow_grave ######*/ - enum { ZOMBIE = 7286, DEAD_HERO = 7276, ZOMBIE_CHANCE = 65, DEAD_HERO_CHANCE = 10 }; - bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo) { // randomly summon a zombie or dead hero the first time a grave is used @@ -227,53 +190,42 @@ bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo) pGo->AddUse(); return false; } - /*###### ## at_zumrah ######*/ - enum { ZUMRAH_ID = 7271, ZUMRAH_HOSTILE_FACTION = 37 }; - bool AreaTrigger_at_zumrah(Player* pPlayer, AreaTriggerEntry *at) { Creature* Zumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); - if (!Zumrah) return false; - Zumrah->setFaction(ZUMRAH_HOSTILE_FACTION); return true; } - void AddSC_zulfarrak() { Script *newscript; - newscript = new Script; newscript->Name = "npc_sergeant_bly"; newscript->GetAI = &GetAI_npc_sergeant_bly; newscript->pGossipHello = &GossipHello_npc_sergeant_bly; newscript->pGossipSelect = &GossipSelect_npc_sergeant_bly; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_weegli_blastfuse"; newscript->GetAI = &GetAI_npc_weegli_blastfuse; newscript->pGossipHello = &GossipHello_npc_weegli_blastfuse; newscript->pGossipSelect = &GossipSelect_npc_weegli_blastfuse; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_shallow_grave"; newscript->pGOHello = &GOHello_go_shallow_grave; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_zumrah"; newscript->pAreaTrigger = &AreaTrigger_at_zumrah; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_amanitar.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_amanitar.cpp index 8a77a455da0..caad936d0f9 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_amanitar.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_amanitar.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* Script Data Start SDName: boss_amanitar SDAuthor: WarHead @@ -23,31 +22,23 @@ SD%Complete: 80% SDComment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users... SDCategory: Ahn'kahet Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_amanitar' where entry = '30258'; UPDATE `creature_template` SET `ScriptName`='mob_amanitar_mushrooms' WHERE `entry` IN ('30435','30391'); *** SQL END ***/ - #include "precompiled.h" #include "def_ahnkahet.h" - #define SPELL_BASH 57094 // Victim #define SPELL_ENTANGLING_ROOTS 57095 // Random Victim 100Y #define SPELL_MINI 57055 // Self #define SPELL_VENOM_BOLT_VOLLEY 57088 // Random Victim 100Y - #define HEALTHY_MUSHROOM_SPELL_POTENT_FUNGUS 56648 // Killer 3Y - #define POISONOUS_MUSHROOM_SPELL_POISON_CLOUD 57061 // Self - Duration 8 Sec #define POISONOUS_MUSHROOM_SPELL_VISUAL_AREA 61566 // Self #define POISONOUS_MUSHROOM_SPELL_VISUAL_AURA 56741 // Self - #define SPELL_PUTRID_MUSHROOM 31690 // To make the mushrooms visible - #define HealthyMushroom 30391 #define PoisonousMushroom 30435 - struct MANGOS_DLL_DECL boss_amanitarAI : public ScriptedAI { boss_amanitarAI(Creature *c) : ScriptedAI(c) @@ -55,35 +46,26 @@ struct MANGOS_DLL_DECL boss_amanitarAI : public ScriptedAI pInstance = c->GetInstanceData(); FirstTime = true; } - ScriptedInstance* pInstance; - uint32 roottimer, bashtimer, bolttimer, spawntimer; - bool FirstTime; - void Reset() { roottimer = urand(5000,9000); bashtimer = urand(10000,14000); bolttimer = urand(15000,30000); spawntimer = 0; - m_creature->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - if (pInstance && !FirstTime) pInstance->SetData(DATA_AMANITAR, FAIL); - FirstTime = false; - if (pInstance) pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); } - void JustDied(Unit *Killer) { if (pInstance) @@ -92,26 +74,20 @@ struct MANGOS_DLL_DECL boss_amanitarAI : public ScriptedAI pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); } } - void EnterCombat(Unit *who) { m_creature->SetInCombatWithZone(); - if (pInstance) pInstance->SetData(DATA_AMANITAR, IN_PROGRESS); - m_creature->CastSpell(m_creature, SPELL_MINI, false); } - void SpawnAdds() { uint32 DSpwTime = 30000; float x = 0.0f, y = 0.0f, z = 0.0f; TempSummonType DSpwType = TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN; - for (uint8 i = 0; i < 30; ++i) { Unit* victim = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (victim) { Position pos; @@ -122,66 +98,53 @@ struct MANGOS_DLL_DECL boss_amanitarAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (spawntimer < diff) { SpawnAdds(); spawntimer = urand(35000,40000); } else spawntimer -= diff; - if (roottimer < diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) m_creature->CastSpell(target, SPELL_ENTANGLING_ROOTS, false); roottimer = urand(15000,30000); } - if (bashtimer < diff) { m_creature->CastSpell(m_creature->getVictim(), SPELL_BASH, false); bashtimer = urand(15000,30000); } else bashtimer -= diff; - if (bolttimer < diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) m_creature->CastSpell(target, SPELL_VENOM_BOLT_VOLLEY, false); bolttimer = urand(15000,30000); } else bolttimer -= diff; - DoMeleeAttackIfReady(); } }; - struct MANGOS_DLL_DECL mob_amanitar_mushroomsAI : public Scripted_NoMovementAI { mob_amanitar_mushroomsAI(Creature* c) : Scripted_NoMovementAI(c) { c->SetUInt32Value(UNIT_FIELD_DISPLAYID, 26981); // Unsichtbar... } - uint32 auratimer, deathtimer; // Without not all will despawn after 30000! :-( - void Reset() { m_creature->CastSpell(m_creature, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell... - if (m_creature->GetEntry() == PoisonousMushroom) m_creature->CastSpell(m_creature, POISONOUS_MUSHROOM_SPELL_VISUAL_AURA, true); - auratimer = 0; deathtimer = 30000; } - void DamageTaken(Unit *killer, uint32 &damage) { if (!killer || !damage) return; - if (m_creature->GetEntry() == HealthyMushroom && damage >= m_creature->GetHealth()) { if (killer->GetTypeId() == TYPEID_PLAYER && m_creature->GetDistance(killer) <= 3.0f) @@ -191,10 +154,8 @@ struct MANGOS_DLL_DECL mob_amanitar_mushroomsAI : public Scripted_NoMovementAI } } } - void EnterCombat(Unit *who) { } void AttackStart(Unit *victim) { } - void UpdateAI(const uint32 diff) { if (m_creature->GetEntry() == PoisonousMushroom) @@ -214,26 +175,21 @@ struct MANGOS_DLL_DECL mob_amanitar_mushroomsAI : public Scripted_NoMovementAI } else deathtimer -= diff; } }; - CreatureAI* GetAI_boss_amanitar(Creature* pCreature) { return new boss_amanitarAI (pCreature); } - CreatureAI* GetAI_mob_amanitar_mushrooms(Creature *pCreature) { return new mob_amanitar_mushroomsAI (pCreature); } - void AddSC_boss_amanitar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_amanitar"; newscript->GetAI = &GetAI_boss_amanitar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_amanitar_mushrooms"; newscript->GetAI = &GetAI_mob_amanitar_mushrooms; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_elder_nadox.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_elder_nadox.cpp index 35827c0aac1..654ae06190e 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_elder_nadox.cpp @@ -15,21 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_elder_nadox SD%Complete: 100 SDComment: SDCategory: Ahn'kahet EndScriptData */ - #include "precompiled.h" #include "def_ahnkahet.h" - bool DeadAhnkaharGuardian; // needed for achievement: Respect Your Elders(2038) - #define ACHIEVEMENT_RESPECT_YOUR_ELDERS 2038 - //not in db #define SAY_AGGRO -1619014 #define SAY_SLAY_1 -1619015 @@ -38,21 +33,16 @@ bool DeadAhnkaharGuardian; // needed for achievement: Respect Your Elders(2038) #define SAY_DEATH -1619018 #define SAY_EGG_SAC_1 -1619019 #define SAY_EGG_SAC_2 -1619020 - #define SPELL_BROOD_PLAGUE 56130 #define H_SPELL_BROOD_PLAGUE 59467 #define H_SPELL_BROOD_RAGE 59465 #define SPELL_ENRAGE 26662// Enraged if too far away from home - #define MOB_AHNKAHAR_SWARMER 30178 #define SPELL_SUMMON_SWARMERS 56119//2x 30178 -- 2x every 10secs - #define MOB_AHNKAHAR_GUARDIAN_ENTRY 30176 #define SPELL_SUMMON_SWARM_GUARD 56120//1x 30176 -- every 25secs #define SPELL_GUARDIAN_AURA 56151 - #define EMOTE_HATCHES "An Ahn'kahar Guardian hatches!" - struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI { boss_elder_nadoxAI(Creature *c) : ScriptedAI(c) @@ -60,53 +50,40 @@ struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 plague_Timer; uint32 rage_Timer; - uint32 swarmer_spawn_Timer; uint32 guard_spawn_Timer; uint32 enrage_Timer; - ScriptedInstance *pInstance; - void Reset() { plague_Timer = 13000; rage_Timer = 20000; - swarmer_spawn_Timer = 10000; guard_spawn_Timer = 25000; - enrage_Timer = 5000; - DeadAhnkaharGuardian = false; - if (pInstance) pInstance->SetData(DATA_ELDER_NADOX_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(SAY_DEATH,m_creature); - if (pInstance) pInstance->SetData(DATA_ELDER_NADOX_EVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void JustDied(Unit* killer) { DoScriptText(SAY_SLAY_3,m_creature); - if (HeroicMode && !DeadAhnkaharGuardian) { AchievementEntry const *AchievRespectYourElders = GetAchievementStore()->LookupEntry(ACHIEVEMENT_RESPECT_YOUR_ELDERS); @@ -116,39 +93,33 @@ struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievRespectYourElders); } } } - if (pInstance) pInstance->SetData(DATA_ELDER_NADOX_EVENT, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (plague_Timer < diff) { DoCast(m_creature->getVictim(),HEROIC(SPELL_BROOD_PLAGUE, H_SPELL_BROOD_PLAGUE)); plague_Timer = 15000; }else plague_Timer -= diff; - if (HeroicMode) if (rage_Timer < diff) { Unit* Swarmer = m_creature->FindNearestCreature(MOB_AHNKAHAR_SWARMER, 35); - if (Swarmer) { DoCast(Swarmer,H_SPELL_BROOD_RAGE,true); rage_Timer = 15000; } }else rage_Timer -= diff; - if (swarmer_spawn_Timer < diff) { DoCast(m_creature,SPELL_SUMMON_SWARMERS,true); @@ -159,19 +130,16 @@ struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI } swarmer_spawn_Timer = 10000; }else swarmer_spawn_Timer -= diff; - if (guard_spawn_Timer < diff) { m_creature->MonsterTextEmote(EMOTE_HATCHES,m_creature->GetGUID(),true); DoCast(m_creature,SPELL_SUMMON_SWARM_GUARD); guard_spawn_Timer = 25000; }else guard_spawn_Timer -= diff; - if (enrage_Timer < diff) { if (m_creature->HasAura(SPELL_ENRAGE,0)) return; - float x, y, z, o; m_creature->GetHomePosition(x, y, z, o); if (z < 24) @@ -183,48 +151,38 @@ struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI } enrage_Timer = 5000; }else enrage_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_elder_nadox(Creature* pCreature) { return new boss_elder_nadoxAI(pCreature); } - #define SPELL_SPRINT 56354 - struct TRINITY_DLL_DECL mob_ahnkahar_nerubianAI : public ScriptedAI { mob_ahnkahar_nerubianAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 sprint_Timer; - void Reset() { if (m_creature->GetEntry() == 30176) DoCast(m_creature,SPELL_GUARDIAN_AURA,true); sprint_Timer = 10000; } - void JustDied(Unit *killer) { if (m_creature->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY) DeadAhnkaharGuardian = true; } - void EnterCombat(Unit *who){} - void UpdateAI(const uint32 diff) { if (m_creature->GetEntry() == 30176) m_creature->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA); - if (pInstance) { if (pInstance->GetData(DATA_ELDER_NADOX_EVENT) != IN_PROGRESS) @@ -233,34 +191,27 @@ struct TRINITY_DLL_DECL mob_ahnkahar_nerubianAI : public ScriptedAI m_creature->RemoveCorpse(); } } - if (!UpdateVictim()) return; - if (sprint_Timer < diff) { DoCast(m_creature,SPELL_SPRINT); sprint_Timer = 25000; }else sprint_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_ahnkahar_nerubian(Creature* pCreature) { return new mob_ahnkahar_nerubianAI(pCreature); } - void AddSC_boss_elder_nadox() { Script *newscript; - newscript = new Script; newscript->Name = "boss_elder_nadox"; newscript->GetAI = &GetAI_boss_elder_nadox; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ahnkahar_nerubian"; newscript->GetAI = &GetAI_mob_ahnkahar_nerubian; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp index 33c3ba42011..4ec6df3173d 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_herald_volazj SDAuthor: Tartalo @@ -23,10 +22,8 @@ SD%Complete: 20 SDComment: Coded all but Insanity SDCategory: Ahn'kahet EndScriptData */ - #include "precompiled.h" #include "def_ahnkahet.h" - enum Spells { SPELL_INSANITY = 57496, //Dummy @@ -38,7 +35,6 @@ enum Spells SPELL_SHIVER = 57949, H_SPELL_SHIVER = 59978 }; - //not in db enum Yells { @@ -50,110 +46,88 @@ enum Yells SAY_DEATH_2 = -1619035, SAY_PHASE = -1619036 }; - enum Achievements { ACHIEVEMENT_QUICK_DEMISE = 1862 }; - struct TRINITY_DLL_DECL boss_volazjAI : public ScriptedAI { boss_volazjAI(Creature* pCreature) : ScriptedAI(pCreature) { pInstance = pCreature->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 uiMindFlayTimer; uint32 uiShadowBoltVolleyTimer; uint32 uiShiverTimer; uint32 uiEncounterTimer; - void Reset() { uiEncounterTimer = 0; uiMindFlayTimer = 8000; uiShadowBoltVolleyTimer = 5000; uiShiverTimer = 15000; - if (pInstance) pInstance->SetData(DATA_HERALD_VOLAZJ, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_HERALD_VOLAZJ, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiMindFlayTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_MIND_FLAY, H_SPELL_MIND_FLAY)); uiMindFlayTimer = 20000; } else uiMindFlayTimer -= diff; - if (uiShadowBoltVolleyTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SHADOW_BOLT_VOLLEY, H_SPELL_SHADOW_BOLT_VOLLEY)); uiShadowBoltVolleyTimer = 5000; } else uiShadowBoltVolleyTimer -= diff; - if (uiShiverTimer < diff) { if (Unit * target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, HEROIC(SPELL_SHIVER, H_SPELL_SHIVER)); uiShiverTimer = 15000; } else uiShiverTimer -= diff; - uiEncounterTimer += diff; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) { DoScriptText(SAY_DEATH_1, m_creature); - if (pInstance) pInstance->SetData(DATA_HERALD_VOLAZJ, DONE); - AchievementEntry const *AchievQuickDemise = GetAchievementStore()->LookupEntry(ACHIEVEMENT_QUICK_DEMISE); Map* pMap = m_creature->GetMap(); - if (HeroicMode && uiEncounterTimer < 120000 && pMap && pMap->IsDungeon() && AchievQuickDemise) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievQuickDemise); } } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_volazj(Creature* pCreature) { return new boss_volazjAI (pCreature); } - void AddSC_boss_volazj() { Script *newscript; - newscript = new Script; newscript->Name = "boss_volazj"; newscript->GetAI = &GetAI_boss_volazj; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp index a239c961bfa..4def5f611ef 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_jedoga_shadowseeker SDAuthor: LordVanMartin @@ -23,14 +22,11 @@ SD%Complete: 0 SDComment: SDCategory: Ahn'kahet EndScriptData */ - /*** SQL START *** update creature_template set scriptname = 'boss_jedoga' where entry = ''; *** SQL END ***/ - #include "precompiled.h" #include "def_ahnkahet.h" - #define SPELL_CYCLONE_STRIKE 56855 #define H_SPELL_CYCLONE_STRIKE 60030//kein unterschied zu 56855 außer das 60030 1,5sec cast ist #define SPELL_LIGHTNING_BOLT 56891 @@ -38,7 +34,6 @@ update creature_template set scriptname = 'boss_jedoga' where entry = ''; #define SPELL_THUNDERSHOCK 56926//AOE works #define H_SPELL_THUNDERSHOCK 60029//AOE works #define SPELL_GIFT_OF_THE_HERALD 56219//triggert if sucessfull sacreficed - //not in db #define SAY_AGGRO -1619000 #define SAY_C_SACRIFICE_1 -1619001 @@ -54,11 +49,9 @@ update creature_template set scriptname = 'boss_jedoga' where entry = ''; #define SAY_PREACHING_3 -1619011 #define SAY_PREACHING_4 -1619012 #define SAY_PREACHING_5 -1619013 - struct TRINITY_DLL_DECL boss_jedogaAI : public ScriptedAI { boss_jedogaAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) { @@ -71,33 +64,26 @@ struct TRINITY_DLL_DECL boss_jedogaAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_jedoga(Creature* pCreature) { return new boss_jedogaAI (pCreature); } - void AddSC_boss_jedoga() { Script *newscript; - newscript = new Script; newscript->Name = "boss_jedoga"; newscript->GetAI = &GetAI_boss_jedoga; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp index b6b1ac586eb..04e8aa0b498 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_prince_taldaram SDAuthor: Tartalo & tlexii @@ -23,10 +22,8 @@ SD%Complete: 0 SDComment: SDCategory: Ahn'kahet EndScriptData */ - #include "precompiled.h" #include "def_ahnkahet.h" - enum Spells { SPELL_BLOODTHIRST = 55968, //Trigger Spell + add aura @@ -78,7 +75,6 @@ enum CombatPhase VANISHED, FEEDING }; - struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI { boss_taldaramAI(Creature *c) : ScriptedAI(c) @@ -87,7 +83,6 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - uint32 uiBloodthirstTimer; uint32 uiVanishTimer; uint32 uiWaitTimer; @@ -95,18 +90,12 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI uint32 uiEmbraceTakenDamage; uint32 uiFlamesphereTimer; uint32 uiPhaseTimer; - uint64 uiSphereGuids[2]; - Unit *pEmbraceTarget; Unit *pSphereTarget; - Creature* pSpheres[3]; - CombatPhase Phase; - ScriptedInstance* pInstance; - void Reset() { uiBloodthirstTimer = 10000; @@ -120,14 +109,12 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_PRINCE_TALDARAM_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { if (pInstance) pInstance->SetData(DATA_PRINCE_TALDARAM_EVENT, IN_PROGRESS); DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -167,7 +154,6 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ()); } } - Phase = NORMAL; uiPhaseTimer = 0; break; @@ -197,7 +183,6 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_BLOODTHIRST); uiBloodthirstTimer = 10000; } else uiBloodthirstTimer -= diff; - if (uiFlamesphereTimer < diff) { DoCast(m_creature, SPELL_CONJURE_FLAME_SPHERE); @@ -205,14 +190,13 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI uiPhaseTimer = 3000 + diff; uiFlamesphereTimer = 15000; } else uiFlamesphereTimer -= diff; - if (uiVanishTimer < diff ) { //Count alive players Unit *target = NULL; std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); // exclude pets & totems @@ -231,13 +215,11 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI } uiVanishTimer = urand(25000,35000); } else uiVanishTimer -= diff; - DoMeleeAttackIfReady(); break; } } else uiPhaseTimer -= diff; } - void DamageTaken(Unit* done_by, uint32 &damage) { if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->isAlive()) @@ -252,15 +234,12 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI } } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { pInstance->SetData(DATA_PRINCE_TALDARAM_EVENT, DONE); - //The Party's Over achievement: AchievementEntry const *AchievThePartyIsOver = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_PARTY_IS_OVER); Map* pMap = m_creature->GetMap(); @@ -268,15 +247,14 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI { Map::PlayerList const &players = pMap->GetPlayers(); uint8 count = 0; - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) ++count; if (count < 5) - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievThePartyIsOver); } } } - void KilledUnit(Unit *victim) { if (victim == m_creature) @@ -289,27 +267,24 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI } DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - bool CheckSpheres() { if(!pInstance) - return false; + return false; uiSphereGuids[0] = pInstance->GetData64(DATA_SPHERE1); uiSphereGuids[1] = pInstance->GetData64(DATA_SPHERE2); - GameObject *pSpheres[2]; for (uint8 i=0; i < 2; ++i) { - pSpheres[i] = pInstance->instance->GetGameObject(uiSphereGuids[i]); - if (!pSpheres[i]) - return false; - if (pSpheres[i]->GetGoState() != GO_STATE_ACTIVE) - return false; + pSpheres[i] = pInstance->instance->GetGameObject(uiSphereGuids[i]); + if (!pSpheres[i]) + return false; + if (pSpheres[i]->GetGoState() != GO_STATE_ACTIVE) + return false; } RemovePrison(); return true; } - void RemovePrison() { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); @@ -321,17 +296,14 @@ struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI pInstance->HandleGameObject(prison_GUID,true); } }; - struct TRINITY_DLL_DECL mob_taldaram_flamesphereAI : public ScriptedAI { mob_taldaram_flamesphereAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiDespawnTimer; ScriptedInstance* pInstance; - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -343,15 +315,12 @@ struct TRINITY_DLL_DECL mob_taldaram_flamesphereAI : public ScriptedAI DoCast(m_creature, HEROIC(SPELL_FLAME_SPHERE_PERIODIC, H_SPELL_FLAME_SPHERE_PERIODIC)); uiDespawnTimer = 10000; } - void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} - void JustDied(Unit* slayer) { DoCast(m_creature, SPELL_FLAME_SPHERE_DEATH_EFFECT); } - void UpdateAI(const uint32 diff) { if (uiDespawnTimer < diff) @@ -360,53 +329,43 @@ struct TRINITY_DLL_DECL mob_taldaram_flamesphereAI : public ScriptedAI uiDespawnTimer -= diff; } }; - CreatureAI* GetAI_boss_taldaram(Creature* pCreature) { return new boss_taldaramAI (pCreature); } - CreatureAI* GetAI_mob_taldaram_flamesphere(Creature* pCreature) { return new mob_taldaram_flamesphereAI (pCreature); } - bool GOHello_prince_taldaram_sphere(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); - Creature *pPrinceTaldaram = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_PRINCE_TALDARAM) : 0); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) { // maybe these are hacks :( pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); pGO->SetGoState(GO_STATE_ACTIVE); - switch(pGO->GetEntry()) { case 193093: pInstance->SetData(DATA_SPHERE1_EVENT,IN_PROGRESS); break; case 193094: pInstance->SetData(DATA_SPHERE2_EVENT,IN_PROGRESS); break; } - CAST_AI(boss_taldaramAI, pPrinceTaldaram->AI())->CheckSpheres(); } return true; } - void AddSC_boss_taldaram() { Script *newscript; - newscript = new Script; newscript->Name = "boss_taldaram"; newscript->GetAI = &GetAI_boss_taldaram; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_taldaram_flamesphere"; newscript->GetAI = &GetAI_mob_taldaram_flamesphere; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "prince_taldaram_sphere"; newscript->pGOHello = &GOHello_prince_taldaram_sphere; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h index 9c17171d019..c988d44688c 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h @@ -15,26 +15,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_AHNKAHET_H #define DEF_AHNKAHET_H - #define DATA_ELDER_NADOX 1 #define DATA_PRINCE_TALDARAM 2 #define DATA_JEDOGA_SHADOWSEEKER 3 #define DATA_HERALD_VOLAZJ 4 #define DATA_AMANITAR 5 - #define DATA_ELDER_NADOX_EVENT 6 #define DATA_PRINCE_TALDARAM_EVENT 7 #define DATA_JEDOGA_SHADOWSEEKER_EVENT 8 #define DATA_HERALD_VOLAZJ_EVENT 9 #define DATA_AMANITAR_EVENT 10 - #define DATA_SPHERE1 11 #define DATA_SPHERE2 12 #define DATA_SPHERE1_EVENT 13 #define DATA_SPHERE2_EVENT 14 #define DATA_PRINCE_TALDARAM_PLATFORM 15 - #endif diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp index c8a0fc22c3c..bb522258266 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp @@ -15,19 +15,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Azjol_Nerub SD%Complete: 0 SDComment: SDCategory: Azjol Nerub EndScriptData */ - #include "precompiled.h" #include "def_ahnkahet.h" - #define MAX_ENCOUNTER 5 - /* Ahn'kahet encounters: 0 - Elder Nadox 1 - Prince Taldaram @@ -35,24 +31,19 @@ EndScriptData */ 3 - Herald Volazj 4 - Amanitar (Heroic only) */ - struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance { instance_ahnkahet(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 Elder_Nadox; uint64 Prince_Taldaram; uint64 Jedoga_Shadowseeker; uint64 Herald_Volazj; uint64 Amanitar; - uint64 Prince_TaldaramSpheres[2]; uint64 Prince_TaldaramPlatform; uint64 Prince_TaldaramGate; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 spheres[2]; - void Initialize() { Elder_Nadox =0; @@ -60,22 +51,18 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance Jedoga_Shadowseeker =0; Herald_Volazj =0; Amanitar =0; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) m_auiEncounter[i] = NOT_STARTED; spheres[0] = NOT_STARTED; spheres[1] = NOT_STARTED; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -87,7 +74,6 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance case 30258: Amanitar = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -114,7 +100,6 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance if (m_auiEncounter[1] == DONE)HandleGameObject(NULL,true,pGo);break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -130,37 +115,37 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) { - case DATA_ELDER_NADOX_EVENT: - m_auiEncounter[0] = data;break; - case DATA_PRINCE_TALDARAM_EVENT: - if (data == DONE) - { - HandleGameObject(Prince_TaldaramGate,true); - } - m_auiEncounter[1] = data; break; - case DATA_JEDOGA_SHADOWSEEKER_EVENT: - m_auiEncounter[2] = data; break; - case DATA_HERALD_VOLAZJ: - m_auiEncounter[3] = data; break; - case DATA_AMANITAR: - m_auiEncounter[4] = data; break; - case DATA_SPHERE1_EVENT: - spheres[0] = data; break; - case DATA_SPHERE2_EVENT: - spheres[1] = data; break; - } - + case DATA_ELDER_NADOX_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_PRINCE_TALDARAM_EVENT: + if (data == DONE) + HandleGameObject(Prince_TaldaramGate,true); + m_auiEncounter[1] = data; + break; + case DATA_JEDOGA_SHADOWSEEKER_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_HERALD_VOLAZJ: + m_auiEncounter[3] = data; + break; + case DATA_AMANITAR: + m_auiEncounter[4] = data; + break; + case DATA_SPHERE1_EVENT: + spheres[0] = data; + break; + case DATA_SPHERE2_EVENT: + spheres[1] = data; + break; + } if (data == DONE) - { SaveToDB(); - } } - uint32 GetData(uint32 type) { switch(type) @@ -175,24 +160,18 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance } return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::string str_data; - std::ostringstream saveStream; saveStream << "A K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << spheres[0] << " " << spheres[1]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -200,15 +179,11 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0,data1,data2,data3,data4, data5, data6; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6; - if (dataHead1 == 'A' && dataHead2 == 'K') { m_auiEncounter[0] = data0; @@ -216,25 +191,19 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance m_auiEncounter[2] = data2; m_auiEncounter[3] = data3; m_auiEncounter[4] = data4; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - spheres[0] = data5; spheres[1] = data6; - }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_ahnkahet(Map* pMap) { return new instance_ahnkahet(pMap); } - void AddSC_instance_ahnkahet() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp index 8172c9a3f66..18b95192c96 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_anubarak SDAuthor: LordVanMartin @@ -23,20 +22,16 @@ SD%Complete: 0 SDComment: SDCategory: Azjol Nerub EndScriptData */ - /*** SQL START *** update creature_template set scriptname = 'boss_anub_arak' where entry = ''; *** SQL END ***/ - #include "precompiled.h" #include "def_azjol_nerub.h" - //Spells #define SPELL_CARRION_BEETLES 53520 #define SPELL_LOCUST_SWARM 53467 #define SPELL_IMPALE 53454 #define SPELL_POUND 53472 - // not in db //Yell #define SAY_INTRO -1601010 @@ -50,13 +45,10 @@ update creature_template set scriptname = 'boss_anub_arak' where entry = ''; #define SAY_SUBMERGE_1 -1601008 #define SAY_SUBMERGE_2 -1601009 #define SAY_DEATH -1601004 - struct TRINITY_DLL_DECL boss_anub_arakAI : public ScriptedAI { boss_anub_arakAI(Creature *c) : ScriptedAI(c) {} - uint32 phase; - void Reset() {} void EnterCombat(Unit* who) { @@ -69,14 +61,11 @@ struct TRINITY_DLL_DECL boss_anub_arakAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - phase =1; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 33) phase = 2; if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 15) phase = 3; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -87,20 +76,16 @@ struct TRINITY_DLL_DECL boss_anub_arakAI : public ScriptedAI { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_anub_arak(Creature* pCreature) { return new boss_anub_arakAI (pCreature); } - void AddSC_boss_anub_arak() { Script *newscript; - newscript = new Script; newscript->Name = "boss_anub_arak"; newscript->GetAI = &GetAI_boss_anub_arak; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_hadronox.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_hadronox.cpp index b9a0a7e670d..d27997ee8cd 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_hadronox.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_hadronox.cpp @@ -15,19 +15,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_hadronox SD%Complete: 0 SDComment: Placeholder SDCategory: Azjol Nerub EndScriptData */ - #include "precompiled.h" #include "def_azjol_nerub.h" - #define SPELL_WEB_FRONT_DOORS 53177//dummy - #define SPELL_ACID_CLOUD 53400 #define H_SPELL_ACID_CLOUD 59419 #define SPELL_LEECH_POISON 53030 @@ -36,7 +32,6 @@ EndScriptData */ #define SPELL_PIECE_ARMOR 53418 #define SPELL_WEB_GRAB 53406 #define H_SPELL_WEB_GRAB 59420 - /* Script Data Start SDName: Boss hadronox SDAuthor: LordVanMartin @@ -44,35 +39,27 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_hadronox' where entry = ''; *** SQL END ***/ - //Spells #define SPELL_LEECH_POISON 53030 #define SPELL_ACID_CLOUD 53400 #define SPELL_PIERCE_ARMOR 53418 //Source SUN++ #define SPELL_WEB_GRAB 53406 - //Phase 0 => Gauntlet Event described below //Phase 1 => Boss Encounter - /*When your group enters the main room (the one after the bridge), you will notice a group of 3 Nerubians. When you engage them, 2 more groups like this one spawn behind the first one - it is important to pull the first group back, so you don't aggro all 3. Hadronox will be under you, fighting Nerubians. - This is the timed gauntlet - waves of non-elite spiders will spawn from the 3 doors located a little above the main room, and will then head down to fight Hadronox. After clearing the main room, it is recommended to just stay in it, kill the occasional non-elites that will attack you instead of the boss, and wait for Hadronox to make his way to you. When Hadronox enters the main room, she will web the doors, and no more non-elites will spawn.*/ - struct TRINITY_DLL_DECL boss_hadronoxAI : public ScriptedAI { boss_hadronoxAI(Creature *c) : ScriptedAI(c) {} - uint32 phase; - void Reset() {} void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} @@ -82,31 +69,24 @@ struct TRINITY_DLL_DECL boss_hadronoxAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - phase =1; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) {} - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - //when Hadronox kills any enemy (that includes a party member) she will regain 10% of her HP if the target had Leech Poison on } }; - CreatureAI* GetAI_boss_hadronox(Creature* pCreature) { return new boss_hadronoxAI (pCreature); } - void AddSC_boss_hadronox() { Script *newscript; - newscript = new Script; newscript->Name = "boss_hadronox"; newscript->GetAI = &GetAI_boss_hadronox; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp index 377a9d58c8f..5fbca03945f 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp @@ -15,21 +15,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_krikthir_the_gatewatcher SD%Complete: 80 % SDComment: Find in the future best timers and the event is not implemented. SDCategory: Azjol Nerub EndScriptData */ - /*** SQL START *** update creature_template set scriptname = 'boss_krik_thir' where entry = ''; *** SQL END ***/ - #include "precompiled.h" #include "def_azjol_nerub.h" - enum Spells { SPELL_MIND_FLAY = 52586, @@ -37,44 +33,33 @@ enum Spells SPELL_CURSE_OF_FATIGUE = 52592, H_SPELL_CURSE_OF_FATIGUE = 59368, SPELL_FRENZY = 28747, //maybe 53361 - SPELL_SUMMON_SKITTERING_SWARMER = 52438, //AOE Effect 140, maybe 52439 SPELL_SUMMON_SKITTERING_SWARMER_1 = 52439, //Summon 3x 28735 - H_SPELL_ACID_SPLASH = 59363, SPELL_ACID_SPLASH = 52446, - SPELL_CHARGE = 16979,//maybe is another spell SPELL_BACKSTAB = 52540, - SPELL_SHADOW_BOLT = 52534, H_SPELL_SHADOW_BOLT = 59357, SPELL_SHADOW_NOVA = 52535, H_SPELL_SHADOW_NOVA = 59358, - SPELL_STRIKE = 52532, SPELL_CLEAVE = 49806, - SPELL_ENRAGE = 52470, - SPELL_INFECTED_BITE = 52469, H_SPELL_INFECTED_BITE = 59364, SPELL_WEB_WRAP = 52086,//the spell is not working propperly - SPELL_BLINDING_WEBS = 52524, H_SPELL_BLINDING_WEBS = 59365, - SPELL_POSION_SPRAY = 52493, H_SPELL_POSION_SPRAY = 59366, }; - enum Mobs { MOB_SKITTERING_SWARMER = 28735, MOB_SKITTERING_SWARMER_CONTROLLER = 32593, MOB_SKITTERING_INFECTIOR = 28736, }; - enum Yells { SAY_AGGRO = -1601000, @@ -102,33 +87,26 @@ struct TRINITY_DLL_DECL boss_krik_thirAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint32 MindFlayTimer; uint32 CurseFatigueTimer; uint32 SummonTimer; - void Reset() { MindFlayTimer = 15000; CurseFatigueTimer = 12000; - if (pInstance) pInstance->SetData(DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); Summon(); SummonTimer = 15000; - if (pInstance) pInstance->SetData(DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, IN_PROGRESS); } - void Summon() { m_creature->SummonCreature(MOB_SKITTERING_SWARMER,566.164,682.087,769.079,2.21657,TEMPSUMMON_TIMED_DESPAWN,25000); @@ -148,46 +126,37 @@ struct TRINITY_DLL_DECL boss_krik_thirAI : public ScriptedAI m_creature->SummonCreature(MOB_SKITTERING_SWARMER,552.625,706.408,777.177,3.4383,TEMPSUMMON_TIMED_DESPAWN,25000); m_creature->SummonCreature(MOB_SKITTERING_SWARMER,552.625,706.408,777.177,3.4383,TEMPSUMMON_TIMED_DESPAWN,25000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(SummonTimer < diff) { Summon(); SummonTimer = 15000; } else SummonTimer -= diff; - if (MindFlayTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_MIND_FLAY, H_SPELL_MIND_FLAY)); MindFlayTimer = 15000; } else MindFlayTimer -= diff; - if (CurseFatigueTimer < diff) { //WowWiki say "Curse of Fatigue-Kirk'thir will cast Curse of Fatigue on 2-3 targets periodically. " Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); Unit* target_1 = SelectUnit(SELECT_TARGET_RANDOM, 1); - DoCast(target, HEROIC(SPELL_CURSE_OF_FATIGUE, H_SPELL_CURSE_OF_FATIGUE)); DoCast(target_1, HEROIC(SPELL_CURSE_OF_FATIGUE, H_SPELL_CURSE_OF_FATIGUE)); - CurseFatigueTimer = 10000; } else CurseFatigueTimer -= diff; - if (!m_creature->HasAura(SPELL_FRENZY) && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 10) m_creature->CastSpell(m_creature,SPELL_FRENZY,true); - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { pInstance->SetData(DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, DONE); @@ -201,7 +170,7 @@ struct TRINITY_DLL_DECL boss_krik_thirAI : public ScriptedAI HeroicMode && pMap && pMap->IsDungeon() && AchievWatchHimDie) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievWatchHimDie); } } @@ -210,46 +179,36 @@ struct TRINITY_DLL_DECL boss_krik_thirAI : public ScriptedAI { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustSummoned(Creature* summoned) { summoned->GetMotionMaster()->MovePoint(m_creature->GetEntry(),m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ()); } }; - struct TRINITY_DLL_DECL npc_skittering_infectorAI : public ScriptedAI { npc_skittering_infectorAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* killer) { //The spell is not working propperly DoCast(m_creature->getVictim(),HEROIC(SPELL_ACID_SPLASH, H_SPELL_ACID_SPLASH), true); } - }; - struct TRINITY_DLL_DECL npc_anub_ar_skirmisherAI : public ScriptedAI { npc_anub_ar_skirmisherAI(Creature *c) : ScriptedAI(c) {} - uint32 ChargeTimer; uint32 BackstabTimer; - void Reset() { ChargeTimer = 11000; BackstabTimer = 7000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(ChargeTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) @@ -258,301 +217,238 @@ struct TRINITY_DLL_DECL npc_anub_ar_skirmisherAI : public ScriptedAI m_creature->AddThreat(pTarget,1.0f); DoCast(pTarget,SPELL_CHARGE,true); } - ChargeTimer = 15000; } else ChargeTimer -= diff; - if(BackstabTimer < diff) { DoCast(m_creature->getVictim(),SPELL_BACKSTAB); BackstabTimer = 12000; } else BackstabTimer -= diff; - DoMeleeAttackIfReady(); - } }; - struct TRINITY_DLL_DECL npc_anub_ar_shadowcasterAI : public ScriptedAI { npc_anub_ar_shadowcasterAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowBoltTimer; uint32 ShadowNovaTimer; - void Reset() { ShadowBoltTimer = 6000; ShadowNovaTimer = 15000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(ShadowBoltTimer < diff) { if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(target, HEROIC(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT), true); ShadowBoltTimer = 15000; } else ShadowBoltTimer -= diff; - if(ShadowNovaTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SHADOW_NOVA, H_SPELL_SHADOW_NOVA), true); ShadowNovaTimer = 17000; } else ShadowNovaTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL npc_anub_ar_warriorAI : public ScriptedAI { npc_anub_ar_warriorAI(Creature *c) : ScriptedAI(c){} - uint32 CleaveTimer; uint32 StrikeTimer; - void Reset() { CleaveTimer = 11000; StrikeTimer = 6000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(StrikeTimer < diff) { m_creature->CastSpell(m_creature->getVictim(), SPELL_STRIKE, true); StrikeTimer = 15000; } else StrikeTimer -= diff; - if(CleaveTimer < diff) { m_creature->CastSpell(m_creature->getVictim(), SPELL_CLEAVE, true); CleaveTimer = 17000; } else CleaveTimer -= diff; - DoMeleeAttackIfReady(); - } - }; - struct TRINITY_DLL_DECL npc_watcher_gashraAI : public ScriptedAI { npc_watcher_gashraAI(Creature *c) : ScriptedAI(c) {} - uint32 WebWrapTimer; uint32 InfectedBiteTimer; - void Reset() { WebWrapTimer = 11000; InfectedBiteTimer = 4000; } - void EnterCombat(Unit* who) { m_creature->CastSpell(m_creature,SPELL_ENRAGE,true); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(WebWrapTimer < diff) { if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) m_creature->CastSpell(target, SPELL_WEB_WRAP,true); WebWrapTimer = 17000; } else WebWrapTimer -= diff; - if(InfectedBiteTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_INFECTED_BITE, H_SPELL_INFECTED_BITE), true); InfectedBiteTimer = 15000; } else InfectedBiteTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL npc_watcher_narjilAI : public ScriptedAI { npc_watcher_narjilAI(Creature *c) : ScriptedAI(c) {} - uint32 WebWrapTimer; uint32 InfectedBiteTimer; uint32 BlindingWebsTimer; - void Reset() { WebWrapTimer = 11000; InfectedBiteTimer = 4000; BlindingWebsTimer = 17000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(WebWrapTimer < diff) { if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(target, SPELL_WEB_WRAP,true); WebWrapTimer = 15000; } else WebWrapTimer -= diff; - if(InfectedBiteTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_INFECTED_BITE, H_SPELL_INFECTED_BITE), true); InfectedBiteTimer = 11000; } else InfectedBiteTimer -= diff; - if(BlindingWebsTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_BLINDING_WEBS, H_SPELL_BLINDING_WEBS), true); BlindingWebsTimer = 17000; } else BlindingWebsTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL npc_watcher_silthikAI : public ScriptedAI { npc_watcher_silthikAI(Creature *c) : ScriptedAI(c) {} - uint32 WebWrapTimer; uint32 InfectedBiteTimer; uint32 PosionSprayTimer; - void Reset() { WebWrapTimer = 11000; InfectedBiteTimer = 4000; PosionSprayTimer = 15000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(WebWrapTimer < diff) { if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(target, SPELL_WEB_WRAP,true); - WebWrapTimer = 15000; } else WebWrapTimer -= diff; - if(InfectedBiteTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_INFECTED_BITE, H_SPELL_INFECTED_BITE), true); InfectedBiteTimer = 15000; } else InfectedBiteTimer -= diff; - if(PosionSprayTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_POSION_SPRAY, H_SPELL_POSION_SPRAY), true); PosionSprayTimer = 17000; } else PosionSprayTimer -= diff; - DoMeleeAttackIfReady(); - } }; - CreatureAI* GetAI_boss_krik_thir(Creature* pCreature) { return new boss_krik_thirAI (pCreature); } - CreatureAI* GetAI_npc_anub_ar_skirmisher (Creature* pCreature) { return new npc_anub_ar_skirmisherAI (pCreature); } - CreatureAI* GetAI_npc_skittering_infector (Creature* pCreature) { return new npc_skittering_infectorAI (pCreature); } - CreatureAI* GetAI_npc_anub_ar_shadowcaster (Creature* pCreature) { return new npc_anub_ar_shadowcasterAI (pCreature); } - CreatureAI* GetAI_npc_anub_ar_warrior (Creature* pCreature) { return new npc_anub_ar_warriorAI (pCreature); } - CreatureAI* GetAI_npc_watcher_gashra (Creature* pCreature) { return new npc_watcher_gashraAI (pCreature); } - CreatureAI* GetAI_npc_watcher_narjil (Creature* pCreature) { return new npc_watcher_narjilAI (pCreature); } - CreatureAI* GetAI_npc_watcher_silthik (Creature* pCreature) { return new npc_watcher_silthikAI (pCreature); } - void AddSC_boss_krik_thir() { Script *newscript; - newscript = new Script; newscript->Name = "boss_krik_thir"; newscript->GetAI = &GetAI_boss_krik_thir; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_skittering_infector"; newscript->GetAI = &GetAI_npc_skittering_infector; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_anub_ar_skirmisher"; newscript->GetAI = &GetAI_npc_anub_ar_skirmisher; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_anub_ar_shadowcaster"; newscript->GetAI = &GetAI_npc_anub_ar_shadowcaster; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_watcher_gashra"; newscript->GetAI = &GetAI_npc_watcher_gashra; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_anub_ar_warrior"; newscript->GetAI = &GetAI_npc_anub_ar_warrior; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_watcher_silthik"; newscript->GetAI = &GetAI_npc_watcher_silthik; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_watcher_narjil"; newscript->GetAI = &GetAI_npc_watcher_narjil; diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/def_azjol_nerub.h b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/def_azjol_nerub.h index df02f9e13d3..64bb38d235c 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/def_azjol_nerub.h +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/def_azjol_nerub.h @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_AZJOL_NERUB_H #define DEF_AZJOL_NERUB_H - enum Data64 { DATA_KRIKTHIR_THE_GATEWATCHER, @@ -34,5 +32,4 @@ enum Data DATA_HADRONOX_EVENT, DATA_ANUBARAK_EVENT }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp index d06335bdbd3..05b507c9ffa 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp @@ -15,44 +15,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Azjol_Nerub SD%Complete: 0 SDComment: Placeholder SDCategory: Azjol Nerub EndScriptData */ - #include "precompiled.h" #include "def_azjol_nerub.h" - #define MAX_ENCOUNTER 3 - /* Azjol Nerub encounters: 0 - Krik'thir the Gatewatcher 1 - Hadronox 2 - Anub'arak */ - struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance { instance_azjol_nerub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 m_uiKrikthir; uint64 m_uiHadronox; uint64 m_uiAnubarak; uint64 m_uiWatcherGashra; uint64 m_uiWatcherSilthik; uint64 m_uiWatcherNarjil; - uint64 m_uiKrikthirDoor; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiKrikthir = 0; m_uiHadronox = 0; m_uiAnubarak = 0; @@ -61,16 +51,13 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance m_uiWatcherNarjil = 0; m_uiKrikthirDoor = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -83,7 +70,6 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance case 28729: m_uiWatcherNarjil = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch (pGo->GetEntry()) @@ -95,7 +81,6 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -107,10 +92,8 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance case DATA_WATCHER_SILTHIK: return m_uiWatcherSilthik; case DATA_WATCHER_NARJIL: return m_uiWatcherNarjil; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -125,13 +108,11 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance case DATA_ANUBARAK_EVENT: m_auiEncounter[2] = data; break; } - if (data == DONE) { SaveToDB(); } } - uint32 GetData(uint32 type) { switch(type) @@ -140,26 +121,19 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance case DATA_HADRONOX_EVENT: return m_auiEncounter[1]; case DATA_ANUBARAK_EVENT: return m_auiEncounter[2]; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::string str_data; - std::ostringstream saveStream; saveStream << "A N " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -167,36 +141,27 @@ struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0,data1,data2; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; - if (dataHead1 == 'A' && dataHead2 == 'N') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_azjol_nerub(Map* pMap) { return new instance_azjol_nerub(pMap); } - void AddSC_instance_azjol_nerub() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp index 85fc89940db..3bed5fb8e54 100644 --- a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp +++ b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Borean_Tundra SD%Complete: 100 SDComment: Quest support: 11708. Taxi vendors. SDCategory: Borean Tundra EndScriptData */ - /* ContentData npc_fizzcrank_fullthrottle npc_surristrasz @@ -28,16 +26,12 @@ npc_tiare npc_iruk npc_corastrasza EndContentData */ - #include "precompiled.h" - /*###### ## npc_fizzcrank_fullthrottle ######*/ - #define GOSSIP_ITEM_GO_ON "Go on." #define GOSSIP_ITEM_TELL_ME "Tell me what's going on out here, Fizzcrank." - enum eFizzcrank { GOSSIP_TEXTID_FIZZCRANK1 = 12456, @@ -49,22 +43,17 @@ enum eFizzcrank GOSSIP_TEXTID_FIZZCRANK7 = 12462, GOSSIP_TEXTID_FIZZCRANK8 = 12463, GOSSIP_TEXTID_FIZZCRANK9 = 12464, - QUEST_THE_MECHAGNOMES = 11708 }; - bool GossipHello_npc_fizzcrank_fullthrottle(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_THE_MECHAGNOMES) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELL_ME, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_fizzcrank_fullthrottle(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -108,68 +97,53 @@ bool GossipSelect_npc_fizzcrank_fullthrottle(Player* pPlayer, Creature* pCreatur } return true; } - /*###### ## npc_surristrasz ######*/ - #define GOSSIP_ITEM_FREE_FLIGHT "I'd like passage to the Transitus Shield." #define GOSSIP_ITEM_FLIGHT "May I use a drake to fly elsewhere?" - enum eSurristrasz { SPELL_ABMER_TO_COLDARRA = 46064 }; - bool GossipHello_npc_surristrasz(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isTaxi()) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FREE_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_GOSSIP); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_TAXIVENDOR); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_surristrasz(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_OPTION_GOSSIP) { pPlayer->CLOSE_GOSSIP_MENU(); - //TaxiPath 795 (amber to coldarra) pPlayer->CastSpell(pPlayer, SPELL_ABMER_TO_COLDARRA, true); } - if (uiAction == GOSSIP_OPTION_TAXIVENDOR) pPlayer->GetSession()->SendTaxiMenu(pCreature); - return true; } - /*###### ## npc_tiare ######*/ - #define GOSSIP_ITEM_TELEPORT "Teleport me to Amber Ledge, please." - enum eTiare { SPELL_TELEPORT_COLDARRA = 50135 }; - bool GossipHello_npc_tiare(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_GOSSIP); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_tiare(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_OPTION_GOSSIP) @@ -179,11 +153,9 @@ bool GossipSelect_npc_tiare(Player* pPlayer, Creature* pCreature, uint32 uiSende } return true; } - /*###### ## npc_sinkhole_kill_credit ######*/ - enum eSinkhole { SPELL_SET_CART = 46797, @@ -191,27 +163,22 @@ enum eSinkhole SPELL_SUMMON_CART = 46798, SPELL_SUMMON_WORM = 46800, }; - struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI { npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){} - uint32 Phase_Timer; uint8 Phase; uint64 casterGuid; - void Reset() { Phase_Timer = 500; Phase = 0; casterGuid = 0; } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (Phase) return; - if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE) { @@ -219,14 +186,11 @@ struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI casterGuid = caster->GetGUID(); } } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (!Phase) return; - if (Phase_Timer < diff) { switch (Phase) @@ -282,31 +246,23 @@ struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI break; } } else Phase_Timer -= diff; - } - }; - CreatureAI* GetAI_npc_sinkhole_kill_credit(Creature* pCreature) { return new npc_sinkhole_kill_creditAI(pCreature); } - /*###### ## npc_khunok_the_behemoth ######*/ - struct TRINITY_DLL_DECL npc_khunok_the_behemothAI : public ScriptedAI { npc_khunok_the_behemothAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit *who) { ScriptedAI::MoveInLineOfSight(who); - if (who->GetTypeId() != TYPEID_UNIT) return; - if (who->GetEntry() == 25861 && me->IsWithinDistInMap(who, 10.0f)) { if (Unit *owner = who->GetOwner()) @@ -320,36 +276,27 @@ struct TRINITY_DLL_DECL npc_khunok_the_behemothAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_khunok_the_behemoth(Creature* pCreature) { return new npc_khunok_the_behemothAI(pCreature); } - /*###### ## npc_keristrasza ######*/ - enum eKeristrasza { SPELL_TELEPORT_TO_SARAGOSA = 46772 }; - #define GOSSIP_HELLO_KERI "I am prepared to face Saragosa!" - bool GossipHello_npc_keristrasza(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(11957) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KERI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_keristrasza(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -357,76 +304,57 @@ bool GossipSelect_npc_keristrasza(Player* pPlayer, Creature* pCreature, uint32 u pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_TO_SARAGOSA, true); } - return true; } - /*###### ## npc_corastrasza ######*/ - #define GOSSIP_ITEM_C_1 "I... I think so..." - enum eCorastrasza { SPELL_SUMMON_WYRMREST_SKYTALON = 61240, SPELL_WYRMREST_SKYTALON_RIDE_PERIODIC = 61244, - QUEST_ACES_HIGH_DAILY = 13414, QUEST_ACES_HIGH = 13413 }; - bool GossipHello_npc_corastrasza(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_ACES_HIGH) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_ACES_HIGH_DAILY) == QUEST_STATUS_INCOMPLETE) //It's the same dragon for both quests. { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_C_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_corastrasza(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SUMMON_WYRMREST_SKYTALON, true); pPlayer->CastSpell(pPlayer, SPELL_WYRMREST_SKYTALON_RIDE_PERIODIC, true); - } - return true; } - /*###### ## npc_iruk ######*/ - #define GOSSIP_ITEM_I "" - enum eIruk { QUEST_SPIRITS_WATCH_OVER_US = 11961, SPELL_CREATURE_TOTEM_OF_ISSLIRUK = 46816, GOSSIP_TEXT_I = 12585 }; - bool GossipHello_npc_iruk(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestStatus(QUEST_SPIRITS_WATCH_OVER_US) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_I, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_iruk(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -435,16 +363,13 @@ bool GossipSelect_npc_iruk(Player* pPlayer, Creature* pCreature, uint32 uiSender pPlayer->CastSpell(pPlayer, SPELL_CREATURE_TOTEM_OF_ISSLIRUK, true); pPlayer->CLOSE_GOSSIP_MENU(); break; - } return true; } /*###### ## mob_nerubar_victim ######*/ - #define WARSONG_PEON 25270 - const uint32 nerubarVictims[3] = { 45526, 45527, 45514 @@ -452,11 +377,9 @@ const uint32 nerubarVictims[3] = struct TRINITY_DLL_DECL mob_nerubar_victimAI : public ScriptedAI { mob_nerubar_victimAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} - void JustDied(Unit* Killer) { if(Killer->GetTypeId() == TYPEID_PLAYER) @@ -482,53 +405,44 @@ CreatureAI* GetAI_mob_nerubar_victim(Creature *pCreature) void AddSC_borean_tundra() { Script *newscript; - newscript = new Script; newscript->Name = "npc_fizzcrank_fullthrottle"; newscript->pGossipHello = &GossipHello_npc_fizzcrank_fullthrottle; newscript->pGossipSelect = &GossipSelect_npc_fizzcrank_fullthrottle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_surristrasz"; newscript->pGossipHello = &GossipHello_npc_surristrasz; newscript->pGossipSelect = &GossipSelect_npc_surristrasz; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tiare"; newscript->pGossipHello = &GossipHello_npc_tiare; newscript->pGossipSelect = &GossipSelect_npc_tiare; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_sinkhole_kill_credit"; newscript->GetAI = &GetAI_npc_sinkhole_kill_credit; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_khunok_the_behemoth"; newscript->GetAI = &GetAI_npc_khunok_the_behemoth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_keristrasza"; newscript->pGossipHello = &GossipHello_npc_keristrasza; newscript->pGossipSelect = &GossipSelect_npc_keristrasza; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_corastrasza"; newscript->pGossipHello = &GossipHello_npc_corastrasza; newscript->pGossipSelect = &GossipSelect_npc_corastrasza; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_iruk"; newscript->pGossipHello = &GossipHello_npc_iruk; newscript->pGossipSelect = &GossipSelect_npc_iruk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_nerubar_victim"; newscript->GetAI = &GetAI_mob_nerubar_victim; diff --git a/src/bindings/scripts/scripts/northrend/dragonblight.cpp b/src/bindings/scripts/scripts/northrend/dragonblight.cpp index 31deb88c069..b129285a320 100644 --- a/src/bindings/scripts/scripts/northrend/dragonblight.cpp +++ b/src/bindings/scripts/scripts/northrend/dragonblight.cpp @@ -13,41 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Dragonblight SD%Complete: 100 SDComment: SDCategory: Dragonblight EndScriptData */ - /* ContentData npc_alexstrasza_wr_gate EndContentData */ - #include "precompiled.h" - enum eEnums { QUEST_RETURN_TO_AG_A = 12499, QUEST_RETURN_TO_AG_H = 12500, MOVIE_ID_GATES = 14 }; - #define GOSSIP_ITEM_WHAT_HAPPENED "Alexstrasza, can you show me what happened here?" - bool GossipHello_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WHAT_HAPPENED, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -55,14 +46,11 @@ bool GossipSelect_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature, pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->SendMovieStart(MOVIE_ID_GATES); } - return true; } - void AddSC_dragonblight() { Script *newscript; - newscript = new Script; newscript->Name = "npc_alexstrasza_wr_gate"; newscript->pGossipHello = &GossipHello_npc_alexstrasza_wr_gate; diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_dred.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_dred.cpp index eedc97e3e36..b4b8d22c5fa 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_dred.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_dred.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_drak_tharon_keep.h" - enum Spells { SPELL_BELLOWING_ROAR = 44863, // fears the group, can be resisted/dispelled @@ -22,53 +20,43 @@ enum Spells SPELL_PIERCING_SLASH = 48878, //debuff -->Armor reduced by 75% SPELL_RAPTOR_CALL = 59416 //dummy }; - struct TRINITY_DLL_DECL boss_dredAI : public ScriptedAI { boss_dredAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void Reset() { if (pInstance) pInstance->SetData(DATA_DRED_EVENT,NOT_STARTED); } - void EnterCombat(Unit* who) { if (pInstance) pInstance->SetData(DATA_DRED_EVENT,IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(DATA_DRED_EVENT,DONE); } }; - CreatureAI* GetAI_boss_dred(Creature* pCreature) { return new boss_dredAI (pCreature); } - void AddSC_boss_dred() { Script *newscript; - newscript = new Script; newscript->Name = "boss_dred"; newscript->GetAI = &GetAI_boss_dred; diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_novos.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_novos.cpp index 2f07378c992..eead65d916f 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_novos.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_novos.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_novos' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_drak_tharon_keep.h" - enum Spells { SPELL_ARCANE_BLAST = 49198, @@ -52,15 +50,12 @@ enum Achievement { ACHIEVEMENT_OH_NOVOS = 2057 }; - struct Location { float x,y,z; }; - static Location AddSpawnPoint = { -379.20, -816.76, 59.70}; static Location AddDestinyPoint = { -282.169, -711.369, 27.375}; - struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI { boss_novosAI(Creature *c) : Scripted_NoMovementAI(c) @@ -68,18 +63,12 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI pInstance = c->GetInstanceData(); Reset(); } - uint32 uiTimer; uint32 uiCrystalHandlerTimer; - bool bAchiev; - std::list luiCrystals; - CombatPhase Phase; - ScriptedInstance* pInstance; - void Reset() { Phase = IDLE; @@ -99,7 +88,6 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI } } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); @@ -120,7 +108,6 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void UpdateAI(const uint32 diff) { switch (Phase) @@ -160,7 +147,6 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI { if (pInstance) pInstance->SetData(DATA_NOVOS_EVENT, DONE); - if (HeroicMode && bAchiev) { AchievementEntry const *AchievOhNovos = GetAchievementStore()->LookupEntry(ACHIEVEMENT_OH_NOVOS); @@ -170,20 +156,18 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievOhNovos); } } } } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; DoScriptText(SAY_KILL, m_creature); } - void RemoveCrystal() { if (!luiCrystals.empty()) @@ -204,32 +188,26 @@ struct TRINITY_DLL_DECL boss_novosAI : public Scripted_NoMovementAI } } }; - struct TRINITY_DLL_DECL mob_crystal_handlerAI : public ScriptedAI { mob_crystal_handlerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - void JustDied(Unit* killer) { if (Creature* pNovos = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_NOVOS) : 0)) CAST_AI(boss_novosAI,pNovos->AI())->RemoveCrystal(); } }; - struct TRINITY_DLL_DECL mob_novos_minionAI : public ScriptedAI { mob_novos_minionAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - void MovementInform(uint32 type, uint32 id) { if(type != POINT_MOTION_TYPE) @@ -238,36 +216,29 @@ struct TRINITY_DLL_DECL mob_novos_minionAI : public ScriptedAI CAST_AI(boss_novosAI, pNovos->AI())->bAchiev = false; } }; - CreatureAI* GetAI_boss_novos(Creature* pCreature) { return new boss_novosAI (pCreature); } - CreatureAI* GetAI_mob_crystal_handler(Creature* pCreature) { return new mob_crystal_handlerAI (pCreature); } - CreatureAI* GetAI_mob_novos_minion(Creature* pCreature) { return new mob_novos_minionAI (pCreature); } - void AddSC_boss_novos() { Script *newscript; - newscript = new Script; newscript->Name = "boss_novos"; newscript->GetAI = &GetAI_boss_novos; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_crystal_handler"; newscript->GetAI = &GetAI_mob_crystal_handler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_novos_minion"; newscript->GetAI = &GetAI_mob_novos_minion; diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp index 185d062b11a..3d65f24fc89 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_tharon_ja' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_drak_tharon_keep.h" - enum Spells { SPELL_COURSE_OF_LIFE = 49527, @@ -40,7 +38,6 @@ enum PlayerSkills }; //Phase 1 all abilities except Eye beam //Phase 2 turns players to skeletons with new abilities, boss grows skin - //not in db enum Yells { @@ -53,16 +50,13 @@ enum Yells SAY_SKELETON_2 = -1600017, SAY_DEATH = -1600018 }; - struct TRINITY_DLL_DECL boss_tharon_jaAI : public ScriptedAI { boss_tharon_jaAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void Reset() { if (pInstance) @@ -71,7 +65,6 @@ struct TRINITY_DLL_DECL boss_tharon_jaAI : public ScriptedAI void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_THARON_JA_EVENT, IN_PROGRESS); } @@ -82,33 +75,26 @@ struct TRINITY_DLL_DECL boss_tharon_jaAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2),m_creature); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH,m_creature); - if (pInstance) pInstance->SetData(DATA_THARON_JA_EVENT, DONE); } }; - CreatureAI* GetAI_boss_tharon_ja(Creature* pCreature) { return new boss_tharon_jaAI (pCreature); } - void AddSC_boss_tharon_ja() { Script *newscript; - newscript = new Script; newscript->Name = "boss_tharon_ja"; newscript->GetAI = &GetAI_boss_tharon_ja; diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp index 64c476296cc..b2b16a8b234 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_trollgore' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_drak_tharon_keep.h" - enum Spells { SPELL_INFECTED_WOUND = 49637, @@ -31,26 +29,21 @@ enum Yells SAY_EXPLODE = -1600009, SAY_DEATH = -1600010 }; - struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI { boss_trollgoreAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void Reset() { if (pInstance) pInstance->SetData(DATA_TROLLGORE_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_TROLLGORE_EVENT, IN_PROGRESS); } @@ -61,13 +54,11 @@ struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_TROLLGORE_EVENT, DONE); } @@ -78,16 +69,13 @@ struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI DoScriptText(SAY_KILL, m_creature); } }; - CreatureAI* GetAI_boss_trollgore(Creature* pCreature) { return new boss_trollgoreAI (pCreature); } - void AddSC_boss_trollgore() { Script *newscript; - newscript = new Script; newscript->Name = "boss_trollgore"; newscript->GetAI = &GetAI_boss_trollgore; diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/instance_drak_tharon_keep.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/instance_drak_tharon_keep.cpp index 4b498223838..bfbf25b80f7 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/instance_drak_tharon_keep.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/instance_drak_tharon_keep.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" #include "def_drak_tharon_keep.h" - #define MAX_ENCOUNTER 4 /* Drak'Tharon Keep encounters: 0 - Trollgore @@ -8,25 +7,19 @@ 2 - King Dred 3 - Tharon Ja */ - struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance { instance_drak_tharon(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 uiTrollgore; uint64 uiNovos; uint64 uiDred; uint64 uiTharonJa; - uint64 uiNovosCrystal1; uint64 uiNovosCrystal2; uint64 uiNovosCrystal3; uint64 uiNovosCrystal4; - uint8 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - void Initialize() { uiTrollgore = 0; @@ -38,15 +31,12 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance uiNovosCrystal3 = 0; uiNovosCrystal4 = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -65,7 +55,6 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -84,7 +73,6 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -98,10 +86,8 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance case DATA_NOVOS_CRYSTAL_3: return uiNovosCrystal3; case DATA_NOVOS_CRYSTAL_4: return uiNovosCrystal4; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -119,13 +105,11 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance m_auiEncounter[3] = data; break; } - if (data == DONE) { SaveToDB(); } } - uint32 GetData(uint32 type) { switch (type) @@ -137,23 +121,17 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance } return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::string str_data; - std::ostringstream saveStream; saveStream << "D K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -161,36 +139,28 @@ struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0,data1,data2,data3; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'D' && dataHead2 == 'K') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; m_auiEncounter[3] = data3; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_drak_tharon(Map* pMap) { return new instance_drak_tharon(pMap); } - void AddSC_instance_drak_tharon() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp b/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp index 2d115bcdeb8..0e289b2dfbc 100644 --- a/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp +++ b/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp @@ -13,51 +13,40 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Grizzly_Hills SD%Complete: 80 SDComment: Quest support: 12231, 12247 SDCategory: Grizzly Hills EndScriptData */ - /* ContentData npc_orsonn_and_kodian EndContentData */ - #include "precompiled.h" - #define GOSSIP_ITEM1 "You're free to go Orsonn, but first tell me what's wrong with the furbolg." #define GOSSIP_ITEM2 "What happened then?" #define GOSSIP_ITEM3 "Thank you, Son of Ursoc. I'll see what can be done." #define GOSSIP_ITEM4 "Who was this stranger?" #define GOSSIP_ITEM5 "Thank you, Kodian. I'll do what I can." - enum eEnums { GOSSIP_TEXTID_ORSONN1 = 12793, GOSSIP_TEXTID_ORSONN2 = 12794, GOSSIP_TEXTID_ORSONN3 = 12796, - GOSSIP_TEXTID_KODIAN1 = 12797, GOSSIP_TEXTID_KODIAN2 = 12798, - NPC_ORSONN = 27274, NPC_KODIAN = 27275, - //trigger creatures NPC_ORSONN_CREDIT = 27322, NPC_KODIAN_CREDIT = 27321, - QUEST_CHILDREN_OF_URSOC = 12247, QUEST_THE_BEAR_GODS_OFFSPRING = 12231 }; - bool GossipHello_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_CHILDREN_OF_URSOC) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_THE_BEAR_GODS_OFFSPRING) == QUEST_STATUS_INCOMPLETE) { switch(pCreature->GetEntry()) @@ -80,11 +69,9 @@ bool GossipHello_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature) break; } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -101,7 +88,6 @@ bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, ui pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->TalkedToCreature(NPC_ORSONN_CREDIT, pCreature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+4: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN2, pCreature->GetGUID()); @@ -111,14 +97,11 @@ bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, ui pPlayer->TalkedToCreature(NPC_KODIAN_CREDIT, pCreature->GetGUID()); break; } - return true; } - void AddSC_grizzly_hills() { Script* newscript; - newscript = new Script; newscript->Name = "npc_orsonn_and_kodian"; newscript->pGossipHello = &GossipHello_npc_orsonn_and_kodian; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_drakkari_colossus.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_drakkari_colossus.cpp index 3ca1abdd8f1..4542cbd124f 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/boss_drakkari_colossus.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_drakkari_colossus.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* Script Data Start SDName: Boss Drakkari Colossus SDAuthor: Manuel @@ -23,178 +22,137 @@ SD%Complete: 95 % SDComment: The event with the Living Mojos is not implemented, just is done that when one of the mojos around the boss take damage will make that the boss enter in combat! SDCategory: Script Data End */ - #include "precompiled.h" #include "def_gundrak.h" - enum Spells { SPELL_EMERGE = 54850, SPELL_EMERGE_2 = 54851, - SPELL_MIGHTY_BLOW = 54719, - SPELL_MERGE = 54878, SPELL_SURGE = 54801, - SPELL_FREEZE_ANIM = 16245, - SPELL_MOJO_PUDDLE = 55627, H_SPELL_MOJO_PUDDLE = 58994, - SPELL_MOJO_WAVE = 55626, H_SPELL_MOJO_WAVE = 58993 }; - enum Entries { DRAKKARI_COLOSSUS = 29307, //DRAKKARI_ELEMENTAL = 29573 }; - struct TRINITY_DLL_DECL boss_drakkari_colossusAI : public ScriptedAI { boss_drakkari_colossusAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - bool Summoned; - uint32 Summon_Timer; uint32 MightyBlowTimer; - void Reset() { if (pInstance) pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); - m_creature->clearUnitState(UNIT_STAT_STUNNED); m_creature->SetReactState(REACT_PASSIVE); - Summoned = false; - MightyBlowTimer = 10000; } - void EnterCombat(Unit* who) { if (pInstance) pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); } - void PrepareToSummonElemental() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->addUnitState(UNIT_STAT_STUNNED); m_creature->CastSpell(m_creature,SPELL_EMERGE,false); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Summoned == false && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 6) { PrepareToSummonElemental(); m_creature->CastSpell(m_creature->getVictim(), SPELL_EMERGE_2, true); Summoned = true; } - if (Summoned == true && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 5) { m_creature->RemoveAllAuras(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->addUnitState(UNIT_STAT_STUNNED); m_creature->RemoveAllAuras(); - Summoned = false; } - if (MightyBlowTimer < diff) { if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) { m_creature->CastSpell(m_creature->getVictim(),SPELL_MIGHTY_BLOW,true); } - MightyBlowTimer = 10000; } else MightyBlowTimer -= diff; - if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature->getVictim()); } }; - struct TRINITY_DLL_DECL boss_drakkari_elementalAI : public ScriptedAI { boss_drakkari_elementalAI(Creature *c) : ScriptedAI(c) { Colossus = c->FindNearestCreature(DRAKKARI_COLOSSUS, 30.0f, true); } - Creature* Colossus; - uint32 SurgeTimer; - bool PreparationDone; bool GoToColossus; bool Checked; - void Reset() { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->clearUnitState(UNIT_STAT_STUNNED); - SurgeTimer = 7000; - GoToColossus = false; PreparationDone = false; Checked = false; } - void UpdateAI(const uint32 diff) { //Return since we have no target if(!UpdateVictim()) return; - if(GoToColossus == false && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->CastSpell(Colossus ,SPELL_MERGE,true); - GoToColossus = true; PreparationDone = true; } - if(GoToColossus == true && PreparationDone == true) { m_creature->addUnitState(UNIT_STAT_STUNNED); m_creature->SetVisibility(VISIBILITY_OFF); m_creature->CastSpell(Colossus ,SPELL_MERGE,true); - PreparationDone = false; - Colossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Colossus->clearUnitState(UNIT_STAT_STUNNED); } - if (SurgeTimer < diff) { if(m_creature->GetVisibility() == VISIBILITY_ON) @@ -202,10 +160,8 @@ struct TRINITY_DLL_DECL boss_drakkari_elementalAI : public ScriptedAI Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); m_creature->CastSpell(target,SPELL_SURGE,false); } - SurgeTimer = 7000; } else SurgeTimer -= diff; - if(Checked == false && Colossus->GetHealth()*100 / Colossus->GetMaxHealth() <= 5) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -213,30 +169,24 @@ struct TRINITY_DLL_DECL boss_drakkari_elementalAI : public ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); Checked = true; } - //prevent do melee if is invisible if(m_creature->GetVisibility() == VISIBILITY_ON) DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { Colossus->Kill(Colossus); } }; - struct TRINITY_DLL_DECL npc_living_mojoAI : public ScriptedAI { npc_living_mojoAI(Creature *c) : ScriptedAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 MojoWaveTimer; uint32 MojoPuddleTimer; - void Reset() { //Check if the npc is near of Drakkari Colossus. @@ -249,7 +199,6 @@ struct TRINITY_DLL_DECL npc_living_mojoAI : public ScriptedAI MojoPuddleTimer = 7000; } } - void DamageTaken(Unit* pDone_by, uint32& uiDamage) { if (m_creature->HasReactState(REACT_PASSIVE)) @@ -264,59 +213,47 @@ struct TRINITY_DLL_DECL npc_living_mojoAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (MojoWaveTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_MOJO_WAVE, H_SPELL_MOJO_WAVE)); MojoWaveTimer = 15000; } else MojoWaveTimer -= diff; - if (MojoPuddleTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_MOJO_PUDDLE, H_SPELL_MOJO_PUDDLE)); MojoPuddleTimer = 18000; } else MojoPuddleTimer -= diff; - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_boss_drakkari_colossus(Creature* pCreature) { return new boss_drakkari_colossusAI (pCreature); } - CreatureAI* GetAI_boss_drakkari_elemental(Creature* pCreature) { return new boss_drakkari_elementalAI (pCreature); } - CreatureAI* GetAI_npc_living_mojo(Creature* pCreature) { return new npc_living_mojoAI (pCreature); } - void AddSC_boss_drakkari_colossus() { Script *newscript; - newscript = new Script; newscript->Name = "boss_drakkari_colossus"; newscript->GetAI = &GetAI_boss_drakkari_colossus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_drakkari_elemental"; newscript->GetAI = &GetAI_boss_drakkari_elemental; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_living_mojo"; newscript->GetAI = &GetAI_npc_living_mojo; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_eck.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_eck.cpp index af0ebba511b..ed428f3730b 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/boss_eck.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_eck.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: Only appears in Heroic mode SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_gundrak.h" - enum Spells { SPELL_ECK_BERSERK = 55816, //Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%. @@ -26,53 +24,42 @@ struct TRINITY_DLL_DECL boss_eckAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 uiBerserkTimer; uint32 uiBiteTimer; uint32 uiSpitTimer; uint32 uiSpringTimer; - bool bBerserk; - ScriptedInstance* pInstance; - void Reset() { uiBerserkTimer = 60000 + rand()%30000; //60-90 secs according to wowwiki uiBiteTimer = 5000; uiSpitTimer = 10000; uiSpringTimer = 8000; - bBerserk = false; - if (pInstance) pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { if (pInstance) pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiBiteTimer < diff) { DoCast(m_creature->getVictim(),SPELL_ECK_BITE); uiBiteTimer = 8000 + rand()%4000; } else uiBiteTimer -= diff; - if (uiSpitTimer < diff) { DoCast(m_creature->getVictim(),SPELL_ECK_SPIT); uiSpitTimer = 6000 + rand()%8000; } else uiSpitTimer -= diff; - if (uiSpringTimer < diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); @@ -82,7 +69,6 @@ struct TRINITY_DLL_DECL boss_eckAI : public ScriptedAI uiSpringTimer = 5000 + rand()%10000; } } else uiSpringTimer -= diff; - //Berserk on timer or 20% of health if (!bBerserk) { @@ -101,26 +87,21 @@ struct TRINITY_DLL_DECL boss_eckAI : public ScriptedAI } } } - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); } }; - CreatureAI* GetAI_boss_eck(Creature* pCreature) { return new boss_eckAI (pCreature); } - void AddSC_boss_eck() { Script *newscript; - newscript = new Script; newscript->Name = "boss_eck"; newscript->GetAI = &GetAI_boss_eck; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_gal_darah.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_gal_darah.cpp index b82f937c157..36a08a7394a 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/boss_gal_darah.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_gal_darah.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_gundrak.h" - //Spells enum Spells { @@ -27,7 +25,6 @@ enum Spells SPELL_WHIRLING_SLASH = 55249, H_SPELL_WHIRLING_SLASH = 55825 }; - //Yells enum Yells { @@ -42,33 +39,26 @@ enum Yells SAY_TRANSFORM_1 = -1604008, //Phase change SAY_TRANSFORM_2 = -1604009 }; - enum CombatPhase { TROLL, RHINO }; - struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI { boss_gal_darahAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiStampedeTimer; uint32 uiWhirlingSlashTimer; uint32 uiPunctureTimer; uint32 uiEnrageTimer; uint32 uiImpalingChargeTimer; uint32 uiStompTimer; - CombatPhase Phase; - uint8 uiPhaseCounter; - ScriptedInstance* pInstance; - void Reset() { uiStampedeTimer = 10000; @@ -77,27 +67,21 @@ struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI uiEnrageTimer = 15000; uiImpalingChargeTimer = 20000; uiStompTimer = 25000; - Phase = TROLL; - if (pInstance) pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - switch (Phase) { case TROLL: @@ -116,7 +100,6 @@ struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),m_creature); uiStampedeTimer = 15000; } else uiStampedeTimer -= diff; - if (uiWhirlingSlashTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_WHIRLING_SLASH, H_SPELL_WHIRLING_SLASH)); @@ -140,19 +123,16 @@ struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI DoCast(m_creature->getVictim(), HEROIC(SPELL_PUNCTURE, H_SPELL_PUNCTURE)); uiPunctureTimer = 8000; } else uiPunctureTimer -= diff; - if (uiEnrageTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_ENRAGE, H_SPELL_ENRAGE)); uiEnrageTimer = 20000; } else uiEnrageTimer -= diff; - if(uiStompTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_STOMP, H_SPELL_STOMP)); uiStompTimer = 20000; } else uiStompTimer -= diff; - if (uiImpalingChargeTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) @@ -163,36 +143,28 @@ struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI } break; } - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_gal_darah(Creature* pCreature) { return new boss_gal_darahAI (pCreature); } - void AddSC_boss_gal_darah() { Script *newscript; - newscript = new Script; newscript->Name = "boss_gal_darah"; newscript->GetAI = &GetAI_boss_gal_darah; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp index a352310a78d..eaf6a35c34e 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp @@ -5,26 +5,19 @@ SD%Complete: 100% SDComment: Maybe needs better timers. SDCategory: Gundrak Script Data End */ - #include "precompiled.h" #include "def_gundrak.h" - //Spells - #define SPELL_DETERMINED_STAB 55104 #define SPELL_GROUND_TREMOR 55142 #define SPELL_NUMBING_SHOUT 55106 - #define SPELL_DETERMINED_GORE 55102 #define SPELL_DETERMINED_GORE_1 59444 #define SPELL_QUAKE 55101 #define SPELL_NUMBING_ROAR 55100 - #define SPELL_MOJO_FRENZY 55163 #define SPELL_TRANSFORMATION 55098 //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects. - #define ACHIEVEMENT_LESS_RABI 2040 - //Yell #define SAY_AGGRO -1604010 //#define SAY_SLAY_1 -1604011 // not in db @@ -34,14 +27,12 @@ Script Data End */ #define SAY_TRANSFORM -1604015 #define SAY_QUAKE -1604016 #define EMOTE_TRANSFORM -1604017 - struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI { boss_moorabiAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; bool Phase; uint32 SPELL_QUAKE_TIMER; @@ -49,7 +40,6 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI uint32 SPELL_GROUND_TREMOR_TIMER; uint32 SPELL_DETERMINED_STAB_TIMER; uint32 SPELL_TRANSFORMATION_TIMER; - void Reset() { SPELL_GROUND_TREMOR_TIMER = 18000; @@ -57,46 +47,37 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI SPELL_DETERMINED_STAB_TIMER = 20000; SPELL_TRANSFORMATION_TIMER = 12000; Phase = false; - if (pInstance) pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); m_creature->CastSpell(m_creature,SPELL_MOJO_FRENZY,true); - if (pInstance) pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if(Phase == false && m_creature->HasAura(SPELL_TRANSFORMATION)) Phase = true; - if(Phase == true) { m_creature->RemoveAura(SPELL_MOJO_FRENZY); - if (SPELL_GROUND_TREMOR_TIMER < diff) { DoScriptText(SAY_QUAKE, m_creature); m_creature->CastSpell(m_creature->getVictim(),SPELL_QUAKE,true); SPELL_GROUND_TREMOR_TIMER = 10000; } else SPELL_GROUND_TREMOR_TIMER -= diff; - if (SPELL_NUMBING_SHOUT_TIMER < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_NUMBING_ROAR,true); SPELL_NUMBING_SHOUT_TIMER = 10000; } else SPELL_NUMBING_SHOUT_TIMER -=diff; - if (SPELL_DETERMINED_STAB_TIMER < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_DETERMINED_GORE, SPELL_DETERMINED_GORE_1)); @@ -113,7 +94,6 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI m_creature->CastSpell(m_creature,SPELL_TRANSFORMATION,false); SPELL_TRANSFORMATION_TIMER = 10000; } else SPELL_TRANSFORMATION_TIMER -= diff; - //CAST GROUND TERMOR || QUAKE if (SPELL_GROUND_TREMOR_TIMER < diff) { @@ -121,27 +101,23 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI m_creature->CastSpell(m_creature->getVictim(),SPELL_GROUND_TREMOR,true); SPELL_GROUND_TREMOR_TIMER = 10000; } else SPELL_GROUND_TREMOR_TIMER -= diff; - //CAST NUMBING SHOUT || DETERMINED_STAB if (SPELL_NUMBING_SHOUT_TIMER < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_NUMBING_SHOUT,true); SPELL_NUMBING_SHOUT_TIMER = 10000; } else SPELL_NUMBING_SHOUT_TIMER -= diff; - if (SPELL_DETERMINED_STAB_TIMER < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_DETERMINED_STAB,true); SPELL_DETERMINED_STAB_TIMER = 8000; } else SPELL_DETERMINED_STAB_TIMER -= diff; } - DoMeleeAttackIfReady(); } void JustDied(Unit *killer) { DoScriptText(SAY_DEATH, m_creature); - if (HeroicMode && Phase == false) { AchievementEntry const *AchievLessRabi = GetAchievementStore()->LookupEntry(ACHIEVEMENT_LESS_RABI); @@ -151,12 +127,11 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievLessRabi); } } } - if (pInstance) pInstance->SetData(DATA_MOORABI_EVENT, DONE); } @@ -164,20 +139,16 @@ struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI *GetAI_boss_moorabi(Creature *pCreature) { return new boss_moorabiAI(pCreature); } - void AddSC_boss_moorabi() { Script *newscript; - newscript = new Script; newscript->Name = "boss_moorabi"; newscript->GetAI = &GetAI_boss_moorabi; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_slad_ran.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_slad_ran.cpp index 95f74af7e35..81767b128d1 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/boss_slad_ran.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_slad_ran.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_slad_ran' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_gundrak.h" - //Spells enum Spells { @@ -22,7 +20,6 @@ enum Spells SPELL_VENOM_BOLT = 54970, H_SPELL_VENOM_BOLT = 59839 }; - //Yell enum Yells { @@ -34,14 +31,12 @@ enum Yells SAY_SUMMON_SNAKES = -1604022, SAY_SUMMON_CONSTRICTORS = -1604023 }; - //Creatures enum Creatures { CREATURE_SNAKE = 29680, CREATURE_CONSTRICTORS = 29713 }; - //Creatures' spells enum ConstrictorSpells { @@ -49,13 +44,11 @@ enum ConstrictorSpells SPELL_VENOMOUS_BITE = 54987, H_SPELL_VENOMOUS_BITE = 58996 }; - // Spawning locations struct Locations { float x, y, z, orientation; }; - static Locations SpawnLoc[]= { {1783.81, 646.637, 133.948, 3.71755}, @@ -64,23 +57,18 @@ static Locations SpawnLoc[]= {1765.66, 646.542, 134.02, 5.11381}, {1716.76, 635.159, 129.282, 0.191986} }; - struct TRINITY_DLL_DECL boss_slad_ranAI : public ScriptedAI { boss_slad_ranAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiPoisonNovaTimer; uint32 uiPowerfullBiteTimer; uint32 uiVenomBoltTimer; uint32 uiSpawnTimer; - uint8 uiPhase; - ScriptedInstance* pInstance; - void Reset() { uiPoisonNovaTimer = 10000; @@ -88,57 +76,48 @@ struct TRINITY_DLL_DECL boss_slad_ranAI : public ScriptedAI uiVenomBoltTimer = 15000; uiSpawnTimer = 5000; uiPhase = 0; - if (pInstance) pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiPoisonNovaTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_POISON_NOVA, H_SPELL_POISON_NOVA)); uiPoisonNovaTimer = 15000; } else uiPoisonNovaTimer -= diff; - if (uiPowerfullBiteTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_POWERFULL_BITE, H_SPELL_POWERFULL_BITE)); uiPowerfullBiteTimer = 10000; } else uiPowerfullBiteTimer -= diff; - if (uiVenomBoltTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_VENOM_BOLT, H_SPELL_VENOM_BOLT)); uiVenomBoltTimer = 10000; } else uiVenomBoltTimer -= diff; - if (uiPhase) { if(uiSpawnTimer < diff) { if (uiPhase == 1) - for (uint8 i = 0;i < (HeroicMode ? 5 : 3); ++i) + for (uint8 i = 0; i < (HeroicMode ? 5 : 3); ++i) m_creature->SummonCreature(CREATURE_SNAKE, SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, SpawnLoc[i].orientation, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); if (uiPhase == 2) - for (uint8 i = 0;i < (HeroicMode ? 5 : 3); ++i) + for (uint8 i = 0; i < (HeroicMode ? 5 : 3); ++i) m_creature->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, SpawnLoc[i].orientation, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); uiSpawnTimer = 5000; } else uiSpawnTimer -= diff; } - if ((uiPhase == 0) && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30) { DoScriptText(SAY_SUMMON_SNAKES,m_creature); @@ -149,41 +128,31 @@ struct TRINITY_DLL_DECL boss_slad_ranAI : public ScriptedAI DoScriptText(SAY_SUMMON_CONSTRICTORS,m_creature); uiPhase = 2; } - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void JustSummoned(Creature* summoned) { summoned->GetMotionMaster()->MovePoint(0,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ()); - } }; - struct TRINITY_DLL_DECL mob_slad_ran_constrictorAI : public ScriptedAI { mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {} - uint32 uiGripOfSladRanTimer; - void Reset() { uiGripOfSladRanTimer = 1000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -194,28 +163,21 @@ struct TRINITY_DLL_DECL mob_slad_ran_constrictorAI : public ScriptedAI uiGripOfSladRanTimer = 5000; } else uiGripOfSladRanTimer -= diff;; } - ScriptedInstance* pInstance; }; - struct TRINITY_DLL_DECL mob_slad_ran_viperAI : public ScriptedAI { mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {} - uint32 uiVenomousBiteTimer; - ScriptedInstance* pInstance; - void Reset() { uiVenomousBiteTimer = 2000; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (uiVenomousBiteTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_VENOMOUS_BITE, H_SPELL_VENOMOUS_BITE)); @@ -223,36 +185,29 @@ struct TRINITY_DLL_DECL mob_slad_ran_viperAI : public ScriptedAI } else uiVenomousBiteTimer -= diff; } }; - CreatureAI* GetAI_boss_slad_ran(Creature* pCreature) { return new boss_slad_ranAI (pCreature); } - CreatureAI* GetAI_mob_slad_ran_constrictor(Creature* pCreature) { return new mob_slad_ran_constrictorAI (pCreature); } - CreatureAI* GetAI_mob_slad_ran_viper(Creature* pCreature) { return new mob_slad_ran_viperAI (pCreature); } - void AddSC_boss_slad_ran() { Script *newscript; - newscript = new Script; newscript->Name = "boss_slad_ran"; newscript->GetAI = &GetAI_boss_slad_ran; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_slad_ran_constrictor"; newscript->GetAI = &GetAI_mob_slad_ran_constrictor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_slad_ran_viper"; newscript->GetAI = &GetAI_mob_slad_ran_viper; diff --git a/src/bindings/scripts/scripts/northrend/gundrak/def_gundrak.h b/src/bindings/scripts/scripts/northrend/gundrak/def_gundrak.h index 957bb9d2367..3428b6dd0e3 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/def_gundrak.h +++ b/src/bindings/scripts/scripts/northrend/gundrak/def_gundrak.h @@ -1,6 +1,5 @@ #ifndef DEF_GUNDRAK_H #define DEF_GUNDRAK_H - enum Data { DATA_SLAD_RAN_EVENT, @@ -9,7 +8,6 @@ enum Data DATA_GAL_DARAH_EVENT, DATA_ECK_THE_FEROCIOUS_EVENT }; - enum Data64 { DATA_SLAD_RAN_ALTAR, @@ -19,5 +17,4 @@ enum Data64 DATA_MOORABI_STATUE, DATA_DRAKKARI_COLOSSUS_STATUE }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/gundrak/instance_gundrak.cpp b/src/bindings/scripts/scripts/northrend/gundrak/instance_gundrak.cpp index 3b8dd7edea2..e67c3888a61 100644 --- a/src/bindings/scripts/scripts/northrend/gundrak/instance_gundrak.cpp +++ b/src/bindings/scripts/scripts/northrend/gundrak/instance_gundrak.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" #include "def_gundrak.h" - #define MAX_ENCOUNTER 5 - /* GunDrak encounters: 0 - Slad'Ran 1 - Moorabi @@ -10,7 +8,6 @@ 3 - Gal'Darah 4 - Eck the Ferocious */ - struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance { instance_gundrak(Map* pMap) : ScriptedInstance(pMap) @@ -18,15 +15,12 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance bHeroicMode = pMap->IsHeroic(); Initialize(); }; - bool bHeroicMode; - uint64 uiSladRan; uint64 uiMoorabi; uint64 uiDrakkariColossus; uint64 uiGalDarah; uint64 uiEckTheFerocious; - uint64 uiSladRanAltar; uint64 uiMoorabiAltar; uint64 uiDrakkariColossusAltar; @@ -38,11 +32,8 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance uint64 uiGalDarahDoor2; uint64 uiBridge; uint64 uiCollision; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - void Initialize() { uiSladRan = 0; @@ -50,33 +41,25 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance uiDrakkariColossus = 0; uiGalDarah = 0; uiEckTheFerocious = 0; - uiSladRanAltar = 0; uiMoorabiAltar = 0; uiDrakkariColossusAltar = 0; - uiSladRanStatue = 0; uiMoorabiStatue = 0; uiDrakkariColossusStatue = 0; - uiEckTheFerociousDoor = 0; uiGalDarahDoor1 = 0; uiGalDarahDoor2 = 0; - uiBridge = 0; uiCollision = 0; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -88,7 +71,6 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance case 29932: uiEckTheFerocious = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -142,7 +124,6 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -188,11 +169,9 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance m_auiEncounter[4] = data; break; } - if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -203,10 +182,8 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3]; case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; } - return 0; } - uint64 GetData64(uint32 type) { switch(type) @@ -218,24 +195,18 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance case DATA_MOORABI_STATUE: return uiMoorabiStatue; case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -243,15 +214,11 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0, data1, data2, data3, data4; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - if (dataHead1 == 'G' && dataHead2 == 'D') { m_auiEncounter[0] = data0; @@ -259,21 +226,17 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance m_auiEncounter[2] = data2; m_auiEncounter[3] = data3; m_auiEncounter[4] = data4; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } - void CheckAltars() { GameObject* pSladRanAltar = instance->GetGameObject(uiSladRanAltar); GameObject* pMoorabiAltar = instance->GetGameObject(uiMoorabiAltar); GameObject* pDrakkariColossusAltar = instance->GetGameObject(uiDrakkariColossusAltar); - if (pSladRanAltar && pSladRanAltar->GetGoState() == GO_STATE_ACTIVE && pMoorabiAltar && pMoorabiAltar->GetGoState() == GO_STATE_ACTIVE && pDrakkariColossusAltar && pDrakkariColossusAltar->GetGoState() == GO_STATE_ACTIVE) @@ -283,15 +246,12 @@ struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance } } }; - bool GOHello_altar(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); uint32 uiStatue; - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); pGO->SetGoState(GO_STATE_ACTIVE); - if (pInstance) { switch(pGO->GetEntry()) @@ -306,12 +266,10 @@ bool GOHello_altar(Player *pPlayer, GameObject *pGO) } return false; } - InstanceData* GetInstanceData_instance_gundrak(Map* pMap) { return new instance_gundrak(pMap); } - void AddSC_instance_gundrak() { Script *newscript; @@ -319,7 +277,6 @@ void AddSC_instance_gundrak() newscript->Name = "instance_gundrak"; newscript->GetInstanceData = &GetInstanceData_instance_gundrak; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_gundrak_altar"; newscript->pGOHello = &GOHello_altar; diff --git a/src/bindings/scripts/scripts/northrend/howling_fjord.cpp b/src/bindings/scripts/scripts/northrend/howling_fjord.cpp index cabb00d748f..e7df7d38ce5 100644 --- a/src/bindings/scripts/scripts/northrend/howling_fjord.cpp +++ b/src/bindings/scripts/scripts/northrend/howling_fjord.cpp @@ -14,22 +14,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Sholazar_Basin SD%Complete: 100 SDComment: Quest support: 11253, 11241. SDCategory: howling_fjord EndScriptData */ - /* ContentData npc_plaguehound_tracker npc_apothecary_hanes EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_apothecary_hanes ######*/ @@ -42,7 +38,6 @@ enum Entries QUEST_TRAIL_OF_FIRE = 11241, SPELL_COSMETIC_LOW_POLY_FIRE = 56274 }; - bool QuestAccept_npc_apothecary_hanes(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_TRAIL_OF_FIRE) @@ -60,24 +55,20 @@ bool QuestAccept_npc_apothecary_hanes(Player* pPlayer, Creature* pCreature, Ques } return true; } - struct TRINITY_DLL_DECL npc_Apothecary_HanesAI : public npc_escortAI { npc_Apothecary_HanesAI(Creature* pCreature) : npc_escortAI(pCreature){} uint32 PotTimer; - void Reset () { SetDespawnAtFar(false); PotTimer = 10000; //10 sec cooldown on potion } - void JustDied(Unit* killer) { if (Player* pPlayer = GetPlayerForEscort()) pPlayer->FailQuest(QUEST_TRAIL_OF_FIRE); } - void UpdateEscortAI(const uint32 diff) { if(HealthBelowPct(75)) @@ -91,7 +82,6 @@ struct TRINITY_DLL_DECL npc_Apothecary_HanesAI : public npc_escortAI if (GetAttack() && UpdateVictim()) DoMeleeAttackIfReady(); } - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); @@ -148,22 +138,18 @@ CreatureAI* GetAI_npc_apothecary_hanes(Creature* pCreature) /*###### ## npc_plaguehound_tracker ######*/ - enum ePlaguehound { QUEST_SNIFF_OUT_ENEMY = 11253 }; - struct TRINITY_DLL_DECL npc_plaguehound_trackerAI : public npc_escortAI { npc_plaguehound_trackerAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void Reset() { InitScriptData(); } - void InitScriptData() { Player* pPlayer = NULL; @@ -171,14 +157,11 @@ struct TRINITY_DLL_DECL npc_plaguehound_trackerAI : public npc_escortAI if(Unit* summoner = CAST_SUM(me)->GetSummoner()) if(summoner->GetTypeId() == TYPEID_PLAYER) pPlayer = CAST_PLR(summoner); - if (!pPlayer) return; - me->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); Start(false, false, pPlayer->GetGUID()); } - void WaypointReached(uint32 i) { Player* pPlayer = NULL; @@ -186,10 +169,8 @@ struct TRINITY_DLL_DECL npc_plaguehound_trackerAI : public npc_escortAI if(Unit* summoner = CAST_SUM(me)->GetSummoner()) if(summoner->GetTypeId() == TYPEID_PLAYER) pPlayer = CAST_PLR(summoner); - if (!pPlayer) return; - switch(i) { case 26: @@ -198,19 +179,15 @@ struct TRINITY_DLL_DECL npc_plaguehound_trackerAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_plaguehound_tracker(Creature* pCreature) { return new npc_plaguehound_trackerAI(pCreature); } - /*###### ## npc_razael_and_lyana ######*/ - #define GOSSIP_RAZAEL_REPORT "High Executor Anselm wants a report on the situation." #define GOSSIP_LYANA_REPORT "High Executor Anselm requests your report." - enum eRazael { QUEST_REPORTS_FROM_THE_FIELD = 11221, @@ -221,7 +198,6 @@ enum eRazael GOSSIP_TEXTID_LYANA1 = 11586, GOSSIP_TEXTID_LYANA2 = 11588 }; - bool GossipHello_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_REPORTS_FROM_THE_FIELD) == QUEST_STATUS_INCOMPLETE) @@ -247,7 +223,6 @@ bool GossipHello_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -263,22 +238,18 @@ bool GossipSelect_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature, uin } return true; } - void AddSC_howling_fjord() { Script *newscript; - newscript = new Script; newscript->Name = "npc_apothecary_hanes"; newscript->GetAI = &GetAI_npc_apothecary_hanes; newscript->pQuestAccept = &QuestAccept_npc_apothecary_hanes; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_plaguehound_tracker"; newscript->GetAI = &GetAI_npc_plaguehound_tracker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_razael_and_lyana"; newscript->pGossipHello = &GossipHello_npc_razael_and_lyana; diff --git a/src/bindings/scripts/scripts/northrend/icecrown.cpp b/src/bindings/scripts/scripts/northrend/icecrown.cpp index 443b6603943..99c251604c5 100644 --- a/src/bindings/scripts/scripts/northrend/icecrown.cpp +++ b/src/bindings/scripts/scripts/northrend/icecrown.cpp @@ -13,24 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Icecrown SD%Complete: 100 SDComment: Quest support: 12807 SDCategory: Icecrown EndScriptData */ - /* ContentData npc_arete EndContentData */ - #include "precompiled.h" - /*###### ## npc_arete ######*/ - #define GOSSIP_ARETE_ITEM1 "Lord-Commander, I would hear your tale." #define GOSSIP_ARETE_ITEM2 "" #define GOSSIP_ARETE_ITEM3 "I thought that they now called themselves the Scarlet Onslaught?" @@ -38,7 +33,6 @@ EndContentData */ #define GOSSIP_ARETE_ITEM5 "That's fine. When do I start?" #define GOSSIP_ARETE_ITEM6 "Let's finish this!" #define GOSSIP_ARETE_ITEM7 "That's quite a tale, Lord-Commander." - enum eArete { GOSSIP_TEXTID_ARETE1 = 13525, @@ -48,26 +42,21 @@ enum eArete GOSSIP_TEXTID_ARETE5 = 13529, GOSSIP_TEXTID_ARETE6 = 13530, GOSSIP_TEXTID_ARETE7 = 13531, - QUEST_THE_STORY_THUS_FAR = 12807 }; - bool GossipHello_npc_arete(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_THE_STORY_THUS_FAR) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE1, pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_arete(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -101,14 +90,11 @@ bool GossipSelect_npc_arete(Player* pPlayer, Creature* pCreature, uint32 uiSende pPlayer->AreaExploredOrEventHappens(QUEST_THE_STORY_THUS_FAR); break; } - return true; } - void AddSC_icecrown() { Script *newscript; - newscript = new Script; newscript->Name = "npc_arete"; newscript->pGossipHello = &GossipHello_npc_arete; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_anubrekhan.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_anubrekhan.cpp index 2de7abcf392..f14dd5d4daa 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_anubrekhan.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_anubrekhan.cpp @@ -13,53 +13,39 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_GREET RAND(-1533000,-1533004,-1533005,-1533006,-1533007) #define SAY_AGGRO RAND(-1533001,-1533002,-1533003) #define SAY_SLAY -1533008 - #define SPELL_IMPALE HEROIC(28783,56090) #define SPELL_LOCUSTSWARM HEROIC(28785,54021) - #define SPELL_SELF_SPAWN_5 29105 //This spawns 5 corpse scarabs ontop of us (most likely the player casts this on death) - #define EVENT_IMPALE 1 #define EVENT_LOCUST 2 - #define MOB_CRYPT_GUARD 16573 - struct TRINITY_DLL_DECL boss_anubrekhanAI : public BossAI { boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) { Prepare(); } - bool HasTaunted; - void Prepare() { HasTaunted = false; - if (HeroicMode) { DoSpawnCreature(MOB_CRYPT_GUARD, 0, -10, 0, me->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); DoSpawnCreature(MOB_CRYPT_GUARD, 0, 10, 0, me->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); } } - void InitializeAI() { Prepare(); BossAI::InitializeAI(); } void JustReachedHome() { Prepare(); _JustReachedHome(); } - void KilledUnit(Unit* victim) { //Force the player to spawn corpse scarabs via spell victim->CastSpell(victim, SPELL_SELF_SPAWN_5, true, NULL, NULL, me->GetGUID()); - if (!(rand()%5)) DoScriptText(SAY_SLAY, me); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -67,7 +53,6 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public BossAI events.ScheduleEvent(EVENT_IMPALE, 15000, 1); events.ScheduleEvent(EVENT_LOCUST, 80000 + rand()%40000, 1); } - void MoveInLineOfSight(Unit *who) { if (!HasTaunted && me->IsWithinDistInMap(who, 60.0f)) @@ -77,14 +62,11 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public BossAI } ScriptedAI::MoveInLineOfSight(who); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -105,16 +87,13 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_anubrekhan(Creature* pCreature) { return new boss_anubrekhanAI (pCreature); } - void AddSC_boss_anubrekhan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_faerlina.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_faerlina.cpp index e7cd19d3b26..8675a47ed87 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_faerlina.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_faerlina.cpp @@ -15,35 +15,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_GREET -1533009 #define SAY_AGGRO RAND(-1533010,-1533011,-1533012,-1533013) #define SAY_SLAY RAND(-1533014,-1533015) #define SAY_DEATH -1533016 - //#define SOUND_RANDOM_AGGRO 8955 //soundId containing the 4 aggro sounds, we not using this - #define SPELL_POSION_BOLT_VOLLEY HEROIC(28796,54098) #define SPELL_RAIN_OF_FIRE HEROIC(28794,54099) #define SPELL_FRENZY HEROIC(28798,54100) #define SPELL_WIDOWS_EMBRACE HEROIC(28732,54097) - enum Events { EVENT_POSION = 1, EVENT_FIRE, EVENT_FRENZY, }; - struct TRINITY_DLL_DECL boss_faerlinaAI : public BossAI { boss_faerlinaAI(Creature *c) : BossAI(c, BOSS_FAERLINA), greet(false) {} - bool greet; - void EnterCombat(Unit *who) { _EnterCombat(); @@ -52,7 +44,6 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public BossAI events.ScheduleEvent(EVENT_FIRE, 5000 + rand()%15000); events.ScheduleEvent(EVENT_FRENZY, 60000 + rand()%20000); } - void MoveInLineOfSight(Unit *who) { if (!greet) @@ -62,26 +53,21 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public BossAI } BossAI::MoveInLineOfSight(who); } - void KilledUnit(Unit* victim) { if (!(rand()%3)) DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, me); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -102,16 +88,13 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_faerlina(Creature* pCreature) { return new boss_faerlinaAI (pCreature); } - void AddSC_boss_faerlina() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_four_horsemen.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_four_horsemen.cpp index a39e76a24b6..c841a6877a5 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_four_horsemen.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_four_horsemen.cpp @@ -13,10 +13,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - enum Horsemen { HORSEMEN_THANE, @@ -24,14 +22,12 @@ enum Horsemen HORSEMEN_BARON, HORSEMEN_SIR, }; - enum Events { EVENT_MARK = 1, EVENT_CAST, EVENT_BERSERK, }; - const uint32 MOB_HORSEMEN[] = {16064, 16065, 30549, 16063}; const uint32 SPELL_MARK[] = {28832, 28833, 28834, 28835}; #define SPELL_PRIMARY(i) HEROIC(SPELL_PRIMARY_N[i],SPELL_PRIMARY_H[i]) @@ -42,7 +38,6 @@ const uint32 SPELL_SECONDARY_N[]= {0, 57374, 0, 57376}; const uint32 SPELL_SECONDARY_H[]= {0, 57464, 0, 57465}; const uint32 SPELL_PUNISH[] = {0, 57381, 0, 57377}; #define SPELL_BERSERK 26662 - // used by 16063,16064,16065,30549, but signed for 16063 const int32 SAY_AGGRO[] = {-1533051, -1533044, -1533065, -1533058}; const int32 SAY_TAUNT[3][4] ={ {-1533052, -1533045, -1533071, -1533059}, @@ -51,31 +46,26 @@ const int32 SAY_TAUNT[3][4] ={ {-1533052, -1533045, -1533071, -1533059}, const int32 SAY_SPECIAL[] = {-1533055, -1533048, -1533070, -1533062}; const int32 SAY_SLAY[] = {-1533056, -1533049, -1533068, -1533063}; const int32 SAY_DEATH[] = {-1533057, -1533050, -1533074, -1533064}; - #define SAY_BARON_AGGRO RAND(-1533065,-1533066,-1533067) #define SAY_BARON_SLAY RAND(-1533068,-1533069) - struct TRINITY_DLL_DECL boss_four_horsemenAI : public BossAI { boss_four_horsemenAI(Creature *c) : BossAI(c, BOSS_HORSEMEN) { id = Horsemen(0); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) if (me->GetEntry() == MOB_HORSEMEN[i]) id = Horsemen(i); caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); } - Horsemen id; bool caster; - void MoveInLineOfSight(Unit *who) { BossAI::MoveInLineOfSight(who); if (caster) SelectNearestTarget(who); } - void AttackStart(Unit *who) { if (caster) @@ -83,7 +73,6 @@ struct TRINITY_DLL_DECL boss_four_horsemenAI : public BossAI else BossAI::AttackStart(who); } - void KilledUnit(Unit* victim) { if (!(rand()%5)) @@ -94,13 +83,11 @@ struct TRINITY_DLL_DECL boss_four_horsemenAI : public BossAI DoScriptText(SAY_SLAY[id], me); } } - void JustDied(Unit* killer) { _JustDied(); DoScriptText(SAY_DEATH[id], me); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -112,17 +99,13 @@ struct TRINITY_DLL_DECL boss_four_horsemenAI : public BossAI events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000); events.ScheduleEvent(EVENT_BERSERK, 15*100*1000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -145,19 +128,16 @@ struct TRINITY_DLL_DECL boss_four_horsemenAI : public BossAI return; } } - if (!caster) DoMeleeAttackIfReady(); else if (!DoSpellAttackIfReady(SPELL_SECONDARY(id))) DoCastAOE(SPELL_PUNISH[id]); } }; - CreatureAI* GetAI_four_horsemen(Creature* pCreature) { return new boss_four_horsemenAI (pCreature); } - void AddSC_boss_four_horsemen() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_gluth.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_gluth.cpp index ed38cbe62c4..05a551d76f2 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_gluth.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_gluth.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SPELL_MORTAL_WOUND 25646 #define SPELL_ENRAGE HEROIC(28371,54427) #define SPELL_DECIMATE HEROIC(28374,54426) #define SPELL_BERSERK 26662 #define SPELL_INFECTED_WOUND 29306 - #define MOB_ZOMBIE 16360 - const Position PosSummon[3] = { {3267.9, -3172.1, 297.42, 0.94}, {3253.2, -3132.3, 297.42, 0}, {3308.3, -3185.8, 297.42, 1.58}, }; - enum Events { EVENT_WOUND = 1, @@ -40,9 +35,7 @@ enum Events EVENT_BERSERK, EVENT_SUMMON, }; - #define EMOTE_NEARBY " spots a nearby zombie to devour!" - struct TRINITY_DLL_DECL boss_gluthAI : public BossAI { boss_gluthAI(Creature *c) : BossAI(c, BOSS_GLUTH) @@ -50,15 +43,12 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI // Do not let Gluth be affected by zombies' debuff me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); } - std::vector triggers; - void Reset() { triggers.clear(); _Reset(); } - void MoveInLineOfSight(Unit *who) { if (who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 15)) @@ -69,10 +59,9 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI else BossAI::MoveInLineOfSight(who); } - void EnterCombat(Unit *who) { - for(uint32 i = 0; i < 3; ++i) + for (uint32 i = 0; i < 3; ++i) if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummon[i])) triggers.push_back(trigger); if (triggers.size() < 3) @@ -81,7 +70,6 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI EnterEvadeMode(); return; } - _EnterCombat(); events.ScheduleEvent(EVENT_WOUND, 10000); events.ScheduleEvent(EVENT_ENRAGE, 30000); @@ -89,7 +77,6 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI events.ScheduleEvent(EVENT_BERSERK, 8*60000); events.ScheduleEvent(EVENT_SUMMON, 10000); } - void JustSummoned(Creature *summon) { if (summon->GetEntry() == WORLD_TRIGGER) @@ -98,14 +85,11 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI summon->AI()->AttackStart(me); summons.Summon(summon); } - void UpdateAI(const uint32 diff) { if (!UpdateVictimWithGaze() || !CheckInRoom()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -126,13 +110,12 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI DoCast(me, SPELL_BERSERK); return; case EVENT_SUMMON: - for(uint32 i = 0; i < HEROIC(1,2); ++i) + for (uint32 i = 0; i < HEROIC(1,2); ++i) DoSummon(MOB_ZOMBIE, triggers[rand()%3]); events.ScheduleEvent(EVENT_SUMMON, 10000); return; } } - if (me->getVictim()->GetEntry() == MOB_ZOMBIE) { if (me->IsWithinMeleeRange(me->getVictim())) @@ -145,12 +128,10 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_gluth(Creature* pCreature) { return new boss_gluthAI (pCreature); } - void AddSC_boss_gluth() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_gothik.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_gothik.cpp index 647c62a32eb..e9278b33223 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_gothik.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_gothik.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_SPEECH -1533040 #define SAY_KILL -1533041 #define SAY_DEATH -1533042 #define SAY_TELEPORT -1533043 - //Gothik #define SPELL_HARVEST_SOUL 28679 #define SPELL_SHADOW_BOLT HEROIC(29317,56405) - #define SPELL_INFORM_LIVE_TRAINEE 27892 #define SPELL_INFORM_LIVE_KNIGHT 27928 #define SPELL_INFORM_LIVE_RIDER 27935 #define SPELL_INFORM_DEAD_TRAINEE 27915 #define SPELL_INFORM_DEAD_KNIGHT 27931 #define SPELL_INFORM_DEAD_RIDER 27937 - #define MOB_LIVE_TRAINEE 16124 #define MOB_LIVE_KNIGHT 16125 #define MOB_LIVE_RIDER 16126 @@ -40,7 +35,6 @@ #define MOB_DEAD_KNIGHT 16148 #define MOB_DEAD_RIDER 16150 #define MOB_DEAD_HORSE 16149 - const struct Waves { uint32 entry, number, time; } waves[] = { @@ -69,26 +63,21 @@ waves[] = {MOB_LIVE_TRAINEE, 2, 29000}, {0, 0, 0}, }; - #define POS_Y_GATE -3360.78f - enum Events { EVENT_SUMMON = 1, EVENT_HARVEST, EVENT_BOLT, }; - #define POS_LIVE 3 #define POS_DEAD 5 - const Position PosSummonLive[POS_LIVE] = { {2669.7, -3430.9, 268.56, 1.6}, {2692.0, -3430.9, 268.56, 1.6}, {2714.1, -3430.9, 268.56, 1.6}, }; - const Position PosSummonDead[POS_DEAD] = { {2725.1, -3310.0, 268.85, 3.4}, @@ -97,18 +86,14 @@ const Position PosSummonDead[POS_DEAD] = {2682.8, -3304.2, 268.85, 3.9}, {2664.8, -3340.7, 268.23, 3.7}, }; - const float PosGround[4] = {2691.2, -3362.7, 267.68, 1.7}; const float PosPlatform[4] = {2640.5, -3360.6, 285.26, 0}; - struct TRINITY_DLL_DECL boss_gothikAI : public BossAI { boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} - uint32 waveCount; typedef std::vector TriggerVct; TriggerVct liveTrigger, deadTrigger; - void Reset() { liveTrigger.clear(); @@ -117,23 +102,20 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI me->SetReactState(REACT_PASSIVE); _Reset(); } - void EnterCombat(Unit *who) { - for(uint32 i = 0; i < POS_LIVE; ++i) + for (uint32 i = 0; i < POS_LIVE; ++i) if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) liveTrigger.push_back(trigger); - for(uint32 i = 0; i < POS_DEAD; ++i) + for (uint32 i = 0; i < POS_DEAD; ++i) if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) deadTrigger.push_back(trigger); - if (liveTrigger.size() < POS_LIVE || deadTrigger.size() < POS_DEAD) { error_log("Script Gothik: cannot summon triggers!"); EnterEvadeMode(); return; } - _EnterCombat(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); waveCount = 0; @@ -143,7 +125,6 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI if (instance) instance->SetData(DATA_GOTHIK_GATE, 1); } - void JustSummoned(Creature *summon) { if (summon->GetEntry() == WORLD_TRIGGER) @@ -155,27 +136,23 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI } summons.Summon(summon); } - void SummonedCreatureDespawn(Creature *summon) { if (summon->GetEntry() == WORLD_TRIGGER) { - //for(TriggerVct::iterator itr = liveTrigger.begin(); itr != liveTrigger.end(); ++itr) + //for (TriggerVct::iterator itr = liveTrigger.begin(); itr != liveTrigger.end(); ++itr) // if(*itr == summon) error_log("boss_gothikAI: trigger is despawned!"); EnterEvadeMode(); return; } - summons.Despawn(summon); } - void KilledUnit(Unit* victim) { if (!(rand()%5)) DoScriptText(SAY_KILL, me); } - void JustDied(Unit* Killer) { liveTrigger.clear(); @@ -183,7 +160,6 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI _JustDied(); DoScriptText(SAY_DEATH, me); } - void SpellHit(Unit *caster, const SpellEntry *spell) { uint32 spellId = 0; @@ -199,12 +175,10 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI me->CastSpell(deadTrigger[rand()%POS_DEAD], spellId, true); } } - void SpellHitTarget(Unit *target, const SpellEntry *spell) { if (!me->isInCombat()) return; - switch(spell->Id) { case SPELL_INFORM_DEAD_TRAINEE: DoSummon(MOB_DEAD_TRAINEE, target, 0); break; @@ -213,17 +187,13 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI DoSummon(MOB_DEAD_HORSE, target, 1.0f); break; } } - void UpdateAI(const uint32 diff) { if (!UpdateCombatState() || !CheckInRoom()) return; - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -231,7 +201,7 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI case EVENT_SUMMON: if (waves[waveCount].entry) { - for(uint32 i = 0; i < waves[waveCount].number; ++i) + for (uint32 i = 0; i < waves[waveCount].number; ++i) DoSummon(waves[waveCount].entry, liveTrigger[rand()%POS_LIVE], 1.0f); events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); ++waveCount; @@ -260,34 +230,27 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_gothik_minionAI : public CombatAI { mob_gothik_minionAI(Creature *c) : CombatAI(c) { liveSide = me->GetPositionY() < POS_Y_GATE; } - bool liveSide; bool gateClose; - #define SIDE_CHECK(who) (liveSide == (who->GetPositionY() < POS_Y_GATE)) - void DoAction(const int32 param) { gateClose = param; } - void DamageTaken(Unit *attacker, uint32 &damage) { if (gateClose && !SIDE_CHECK(attacker)) damage = 0; } - void JustDied(Unit *killer) { if (me->isSummon()) @@ -296,7 +259,6 @@ struct TRINITY_DLL_DECL mob_gothik_minionAI : public CombatAI CombatAI::JustDied(owner); } } - void EnterEvadeMode() { if (!gateClose) @@ -304,15 +266,13 @@ struct TRINITY_DLL_DECL mob_gothik_minionAI : public CombatAI CombatAI::EnterEvadeMode(); return; } - if (!_EnterEvadeMode()) return; - Map* pMap = me->GetMap(); if (pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive() && SIDE_CHECK(i->getSource())) { @@ -321,11 +281,9 @@ struct TRINITY_DLL_DECL mob_gothik_minionAI : public CombatAI } } } - me->GetMotionMaster()->MoveIdle(); Reset(); } - void UpdateAI(const uint32 diff) { if (gateClose && (!SIDE_CHECK(me) || me->getVictim() && !SIDE_CHECK(me->getVictim()))) @@ -333,21 +291,17 @@ struct TRINITY_DLL_DECL mob_gothik_minionAI : public CombatAI EnterEvadeMode(); return; } - CombatAI::UpdateAI(diff); } }; - CreatureAI* GetAI_boss_gothik(Creature* pCreature) { return new boss_gothikAI (pCreature); } - CreatureAI* GetAI_mob_gothik_minion(Creature* pCreature) { return new mob_gothik_minionAI (pCreature); } - void AddSC_boss_gothik() { Script *newscript; @@ -355,7 +309,6 @@ void AddSC_boss_gothik() newscript->Name = "boss_gothik"; newscript->GetAI = &GetAI_boss_gothik; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_gothik_minion"; newscript->GetAI = &GetAI_mob_gothik_minion; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp index 38edde2c327..3a346798e9d 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp @@ -13,32 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SPELL_BOMBARD_SLIME 28280 - #define SPELL_POISON_CLOUD 28240 #define SPELL_MUTATING_INJECTION 28169 #define SPELL_SLIME_SPRAY HEROIC(28157,54364) #define SPELL_BERSERK 26662 #define SPELL_POISON_CLOUD_ADD 59116 - #define EVENT_BERSERK 1 #define EVENT_CLOUD 2 #define EVENT_INJECT 3 #define EVENT_SPRAY 4 - #define MOB_FALLOUT_SLIME 16290 - struct TRINITY_DLL_DECL boss_grobbulusAI : public BossAI { boss_grobbulusAI(Creature *c) : BossAI(c, BOSS_GROBBULUS) { me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -47,7 +40,6 @@ struct TRINITY_DLL_DECL boss_grobbulusAI : public BossAI events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); //not sure events.ScheduleEvent(EVENT_BERSERK, 12*60000); } - void SpellHitTarget(Unit *target, const SpellEntry *spell) { if (spell->Id == SPELL_SLIME_SPRAY) @@ -56,14 +48,11 @@ struct TRINITY_DLL_DECL boss_grobbulusAI : public BossAI DoZoneInCombat(slime); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -87,26 +76,21 @@ struct TRINITY_DLL_DECL boss_grobbulusAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI { npc_grobbulus_poison_cloudAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) { Reset(); } - uint32 Cloud_Timer; - void Reset() { Cloud_Timer = 1000; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void UpdateAI(const uint32 diff) { if (Cloud_Timer < diff) @@ -116,17 +100,14 @@ struct TRINITY_DLL_DECL npc_grobbulus_poison_cloudAI : public Scripted_NoMovemen } else Cloud_Timer -= diff; } }; - CreatureAI* GetAI_boss_grobbulus(Creature* pCreature) { return new boss_grobbulusAI (pCreature); } - CreatureAI* GetAI_npc_grobbulus_poison_cloud(Creature* pCreature) { return new npc_grobbulus_poison_cloudAI(pCreature); } - void AddSC_boss_grobbulus() { Script *newscript; @@ -134,7 +115,6 @@ void AddSC_boss_grobbulus() newscript->Name = "boss_grobbulus"; newscript->GetAI = &GetAI_boss_grobbulus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_grobbulus_poison_cloud"; newscript->GetAI = &GetAI_npc_grobbulus_poison_cloud; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_heigan.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_heigan.cpp index 4cf9eb0ffcb..417dc61b5cf 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_heigan.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_heigan.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_AGGRO RAND(-1533109,-1533110,-1533111) #define SAY_SLAY -1533112 #define SAY_TAUNT RAND(-1533113,-1533114,-1533115,-1533116,-1533117) #define SAY_DEATH -1533118 - #define SPELL_SPELL_DISRUPTION 29310 #define SPELL_DECREPIT_FEVER HEROIC(29998,55011) #define SPELL_PLAGUE_CLOUD 29350 - enum Events { EVENT_DISRUPT = 1, @@ -33,43 +29,35 @@ enum Events EVENT_ERUPT, EVENT_PHASE, }; - enum Phases { PHASE_FIGHT = 1, PHASE_DANCE, }; - //Spell by eye stalks #define SPELL_MIND_FLAY 26143 - struct TRINITY_DLL_DECL boss_heiganAI : public BossAI { boss_heiganAI(Creature *c) : BossAI(c, BOSS_HEIGAN) {} - uint32 eruptSection; bool eruptDirection; Phases phase; - void KilledUnit(Unit* Victim) { if (!(rand()%5)) DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, me); } - void EnterCombat(Unit *who) { _EnterCombat(); DoScriptText(SAY_AGGRO, me); EnterPhase(PHASE_FIGHT); } - void EnterPhase(Phases newPhase) { phase = newPhase; @@ -92,14 +80,11 @@ struct TRINITY_DLL_DECL boss_heiganAI : public BossAI events.ScheduleEvent(EVENT_ERUPT, 5000); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -118,28 +103,22 @@ struct TRINITY_DLL_DECL boss_heiganAI : public BossAI case EVENT_ERUPT: instance->SetData(DATA_HEIGAN_ERUPT, eruptSection); TeleportCheaters(); - if (eruptSection == 0) eruptDirection = true; else if (eruptSection == 3) eruptDirection = false; - eruptDirection ? ++eruptSection : --eruptSection; - events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000); break; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_heigan(Creature* pCreature) { return new boss_heiganAI (pCreature); } - void AddSC_boss_heigan() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_kelthuzad.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_kelthuzad.cpp index 2e395ecec03..a07c09ff748 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_kelthuzad.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_kelthuzad.cpp @@ -13,45 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_KelThuzud SD%Complete: 0 SDComment: VERIFY SCRIPT SDCategory: Naxxramas EndScriptData */ - #include "precompiled.h" #include "def_naxxramas.h" - //when shappiron dies. dialog between kel and lich king (in this order) #define SAY_SAPP_DIALOG1 -1533084 //not used #define SAY_SAPP_DIALOG2_LICH -1533085 //not used #define SAY_SAPP_DIALOG3 -1533086 //not used #define SAY_SAPP_DIALOG4_LICH -1533087 //not used #define SAY_SAPP_DIALOG5 -1533088 //not used - //when cat dies #define SAY_CAT_DIED -1533089 //not used - //when each of the 4 wing bosses dies #define SAY_TAUNT1 -1533090 //not used #define SAY_TAUNT2 -1533091 //not used #define SAY_TAUNT3 -1533092 //not used #define SAY_TAUNT4 -1533093 //not used - #define SAY_SUMMON_MINIONS -1533105 //start of phase 1 not used - #define SAY_AGGRO RAND(-1533094,-1533095,-1533096) //start of phase 2 #define SAY_SLAY RAND(-1533097,-1533098) #define SAY_DEATH -1533099 #define SAY_CHAIN RAND(-1533100,-1533101) #define SAY_FROST_BLAST -1533102 #define SAY_SPECIAL RAND(-1533106,-1533107,-1533108) - #define SAY_REQUEST_AID -1533103 //start of phase 3 #define SAY_ANSWER_REQUEST -1533104 //lich king answer - enum Event { EVENT_BOLT = 1, @@ -60,15 +51,12 @@ enum Event EVENT_DETONATE, EVENT_FISSURE, EVENT_BLAST, - EVENT_WASTE, EVENT_ABOMIN, EVENT_WEAVER, EVENT_ICECROWN, - EVENT_PHASE, }; - #define SPELL_FROST_BOLT HEROIC(28478,55802) #define SPELL_FROST_BOLT_AOE HEROIC(28479,55807) #define SPELL_SHADOW_FISURE 27810 @@ -77,12 +65,10 @@ enum Event #define SPELL_FROST_BLAST 27808 #define SPELL_CHAINS_OF_KELTHUZAD 28410 //28408 script effect #define SPELL_BERSERK 28498 - #define MOB_WASTE 16427 // Soldiers of the Frozen Wastes #define MOB_ABOMINATION 16428 // Unstoppable Abominations #define MOB_WEAVER 16429 // Soul Weavers #define MOB_ICECROWN 16441 // Guardians of Icecrown - const Position Pos[12] = { {3783.272705, -5062.697266, 143.711203,3.617599},//LEFT_FAR @@ -98,38 +84,29 @@ const Position Pos[12] = {3707.990733,-5151.450195,142.032562,1.376855},//RIGHT_MIDDLE {3739.500000,-5141.883989,142.0141130, 2.121412}//RIGHT_NEAR }; - struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI { boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD) {} - uint32 GuardiansOfIcecrown_Count; - uint32 Phase; uint32 GuardiansOfIcecrown_Timer; - void Reset() { _Reset(); me->SetReactState(REACT_AGGRESSIVE); GuardiansOfIcecrown_Count = 0; - GuardiansOfIcecrown_Timer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 - Phase=0; } - void KilledUnit() { DoScriptText(SAY_SLAY, m_creature); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit* who) { _EnterCombat(); @@ -142,14 +119,11 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI events.ScheduleEvent(EVENT_WEAVER, 20000); events.ScheduleEvent(EVENT_PHASE, 228000); } - void UpdateAI(const uint32 diff) { if (!UpdateCombatState()) return; - events.Update(diff); - if (Phase == 1) { while(uint32 eventId = events.GetEvent()) @@ -210,10 +184,8 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI } else GuardiansOfIcecrown_Timer -= diff; } - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - if (uint32 eventId = events.GetEvent()) { switch(eventId) @@ -236,14 +208,13 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI { std::vector unitList; std::list *threatList = &me->getThreatManager().getThreatList(); - for(std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) + for (std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA && (*itr)->getTarget()->GetPower(POWER_MANA)) unitList.push_back((*itr)->getTarget()); } - if (!unitList.empty()) { std::vector::iterator itr = unitList.begin(); @@ -251,7 +222,6 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI DoCast(*itr, SPELL_MANA_DETONATION); DoScriptText(SAY_SPECIAL, me); } - events.RepeatEvent(20000); return; } @@ -272,17 +242,14 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public BossAI return; } } - DoMeleeAttackIfReady(); } } }; - CreatureAI* GetAI_boss_kelthuzadAI(Creature* pCreature) { return new boss_kelthuzadAI (pCreature); } - void AddSC_boss_kelthuzad() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_loatheb.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_loatheb.cpp index c87caf2beae..9790f40fda3 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_loatheb.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_loatheb.cpp @@ -15,26 +15,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SPELL_NECROTIC_AURA 55593 #define SPELL_SUMMON_SPORE 29234 #define SPELL_DEATHBLOOM HEROIC(29865,55053) #define SPELL_INEVITABLE_DOOM HEROIC(29204,55052) - enum Events { EVENT_AURA = 1, EVENT_BLOOM, EVENT_DOOM, }; - struct TRINITY_DLL_DECL boss_loathebAI : public BossAI { boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} - void EnterCombat(Unit *who) { _EnterCombat(); @@ -42,14 +37,11 @@ struct TRINITY_DLL_DECL boss_loathebAI : public BossAI events.ScheduleEvent(EVENT_BLOOM, 30000); events.ScheduleEvent(EVENT_DOOM, 120000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -69,16 +61,13 @@ struct TRINITY_DLL_DECL boss_loathebAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_loatheb(Creature* pCreature) { return new boss_loathebAI (pCreature); } - void AddSC_boss_loatheb() { Script *newscript; @@ -86,7 +75,6 @@ void AddSC_boss_loatheb() newscript->Name = "boss_loatheb"; newscript->GetAI = &GetAI_boss_loatheb; newscript->RegisterSelf(); - // Fungal Creep GetAISpellInfo(29232)->condition = AICOND_DIE; } diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_maexxna.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_maexxna.cpp index ff84d1077e4..b9b0085e230 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_maexxna.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_maexxna.cpp @@ -15,19 +15,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SPELL_WEB_WRAP 28622 #define SPELL_WEB_SPRAY HEROIC(29484,54125) #define SPELL_POISON_SHOCK HEROIC(28741,54122) #define SPELL_NECROTIC_POISON HEROIC(54121,28776) #define SPELL_FRENZY HEROIC(54123,54124) - #define MOB_WEB_WRAP 16486 #define MOB_SPIDERLING 17055 - #define MAX_POS_WRAP 3 const float PosWrap[MAX_POS_WRAP][3] = { @@ -35,7 +31,6 @@ const float PosWrap[MAX_POS_WRAP][3] = {3531.271, -3847.424, 299.450+20}, {3497.067, -3843.384, 302.384+20}, }; - enum Events { EVENT_SPRAY = 1, @@ -44,13 +39,10 @@ enum Events EVENT_WRAP, EVENT_SUMMON, }; - struct TRINITY_DLL_DECL boss_maexxnaAI : public BossAI { boss_maexxnaAI(Creature *c) : BossAI(c, BOSS_MAEXXNA) {} - bool enraged; - void EnterCombat(Unit *who) { _EnterCombat(); @@ -61,20 +53,17 @@ struct TRINITY_DLL_DECL boss_maexxnaAI : public BossAI events.ScheduleEvent(EVENT_POISON, 5000); events.ScheduleEvent(EVENT_SUMMON, 40000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_WRAP: - for(uint32 i = 0; i < HEROIC(1,2); ++i) + for (uint32 i = 0; i < HEROIC(1,2); ++i) { if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) { @@ -105,14 +94,13 @@ struct TRINITY_DLL_DECL boss_maexxnaAI : public BossAI case EVENT_SUMMON: { uint32 amount = 8+rand()%2; - for(uint32 i = 0; i < amount; ++i) + for (uint32 i = 0; i < amount; ++i) DoSummon(MOB_SPIDERLING, me); events.ScheduleEvent(EVENT_SUMMON, 40000); break; } } } - if (!enraged && HealthBelowPct(30)) { DoCast(me, SPELL_FRENZY); @@ -122,16 +110,13 @@ struct TRINITY_DLL_DECL boss_maexxnaAI : public BossAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_maexxna(Creature* pCreature) { return new boss_maexxnaAI (pCreature); } - void AddSC_boss_maexxna() { Script *newscript; - newscript = new Script; newscript->Name = "boss_maexxna"; newscript->GetAI = &GetAI_boss_maexxna; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_noth.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_noth.cpp index c4ba86a91d6..594fe83620f 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_noth.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_noth.cpp @@ -13,34 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_AGGRO RAND(-1533075,-1533076,-1533077) #define SAY_SUMMON -1533078 #define SAY_SLAY RAND(-1533079,-1533080) #define SAY_DEATH -1533081 - #define SOUND_DEATH 8848 - #define SPELL_CURSE_PLAGUEBRINGER HEROIC(29213,54835) #define SPELL_BLINK RAND(29208,29209,29210,29211) #define SPELL_CRIPPLE HEROIC(29212,54814) #define SPELL_TELEPORT 29216 - #define MOB_WARRIOR 16984 #define MOB_CHAMPION 16983 #define MOB_GUARDIAN 16981 - // Teleport position of Noth on his balcony #define TELE_X 2631.370 #define TELE_Y -3529.680 #define TELE_Z 274.040 #define TELE_O 6.277 - #define MAX_SUMMON_POS 5 - const float SummonPos[MAX_SUMMON_POS][4] = { {2728.12, -3544.43, 261.91, 6.04}, @@ -49,7 +41,6 @@ const float SummonPos[MAX_SUMMON_POS][4] = {2704.11, -3456.81, 265.53, 4.51}, {2663.56, -3464.43, 262.66, 5.20}, }; - enum Events { EVENT_BERSERK = 1, @@ -60,20 +51,16 @@ enum Events EVENT_WAVE, EVENT_GROUND, }; - struct TRINITY_DLL_DECL boss_nothAI : public BossAI { boss_nothAI(Creature *c) : BossAI(c, BOSS_NOTH) {} - uint32 waveCount, balconyCount; - void Reset() { me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); _Reset(); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -81,7 +68,6 @@ struct TRINITY_DLL_DECL boss_nothAI : public BossAI balconyCount = 0; EnterPhaseGround(); } - void EnterPhaseGround() { me->SetReactState(REACT_AGGRESSIVE); @@ -98,43 +84,36 @@ struct TRINITY_DLL_DECL boss_nothAI : public BossAI events.ScheduleEvent(EVENT_BLINK, 20000+rand()%10000); } } - void KilledUnit(Unit* victim) { if (!(rand()%5)) DoScriptText(SAY_SLAY, me); } - void JustSummoned(Creature *summon) { summons.Summon(summon); summon->setActive(true); summon->AI()->DoZoneInCombat(); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, me); } - void SummonUndead(uint32 entry, uint32 num) { - for(uint32 i = 0; i < num; ++i) + for (uint32 i = 0; i < num; ++i) { uint32 pos = rand()%MAX_SUMMON_POS; me->SummonCreature(entry, SummonPos[pos][0], SummonPos[pos][1], SummonPos[pos][2], SummonPos[pos][3], TEMPSUMMON_CORPSE_DESPAWN, 60000); } } - void UpdateAI(const uint32 diff) { if (!UpdateCombatState() || !CheckInRoom()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -189,17 +168,14 @@ struct TRINITY_DLL_DECL boss_nothAI : public BossAI } } } - if (me->HasReactState(REACT_AGGRESSIVE)) DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_noth(Creature* pCreature) { return new boss_nothAI (pCreature); } - void AddSC_boss_noth() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_patchwerk.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_patchwerk.cpp index 5077f0267ed..34ebdfe3e1c 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_patchwerk.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_patchwerk.cpp @@ -13,48 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define SAY_AGGRO RAND(-1533017,-1533018) #define SAY_SLAY -1533019 #define SAY_DEATH -1533020 - #define EMOTE_BERSERK -1533021 #define EMOTE_ENRAGE -1533022 - #define SPELL_HATEFULSTRIKE HEROIC(41926,59192) #define SPELL_FRENZY 28131 #define SPELL_BERSERK 26662 #define SPELL_SLIMEBOLT 32309 - #define EVENT_BERSERK 1 #define EVENT_HATEFUL 2 #define EVENT_SLIME 3 - #define ACHIEVEMENT_MAKE_QUICK_WERK_OF_HIM HEROIC(1856, 1857) #define MAX_ENCOUNTER_TIME 3 * 60 * 1000 - struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI { boss_patchwerkAI(Creature *c) : BossAI(c, BOSS_PATCHWERK) {} - bool Enraged; - uint32 EncounterTime; - void KilledUnit(Unit* Victim) { if (!(rand()%5)) DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, me); - if(EncounterTime <= MAX_ENCOUNTER_TIME) { AchievementEntry const *AchievMakeQuickWerkOfHim = GetAchievementStore()->LookupEntry(ACHIEVEMENT_MAKE_QUICK_WERK_OF_HIM); @@ -64,13 +52,12 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI if(pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievMakeQuickWerkOfHim); } } } } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -80,16 +67,12 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI events.ScheduleEvent(EVENT_HATEFUL, 1200); events.ScheduleEvent(EVENT_BERSERK, 360000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - EncounterTime += diff; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -101,7 +84,7 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI uint32 MostHP = 0; Unit* pMostHPTarget = NULL; std::list::iterator i = me->getThreatManager().getThreatList().begin(); - for(; i != me->getThreatManager().getThreatList().end(); ++i) + for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit* target = (*i)->getTarget(); if (target->isAlive() && target->GetHealth() > MostHP && me->IsWithinMeleeRange(target)) @@ -110,10 +93,8 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI pMostHPTarget = target; } } - if (pMostHPTarget) DoCast(pMostHPTarget, SPELL_HATEFULSTRIKE, true); - events.ScheduleEvent(EVENT_HATEFUL, 1200); return; } @@ -128,7 +109,6 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI return; } } - if (!Enraged && HealthBelowPct(5)) { DoCast(m_creature, SPELL_FRENZY); @@ -136,16 +116,13 @@ struct TRINITY_DLL_DECL boss_patchwerkAI : public BossAI Enraged = true; return; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_patchwerk(Creature* pCreature) { return new boss_patchwerkAI (pCreature); } - void AddSC_boss_patchwerk() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_razuvious.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_razuvious.cpp index 7f92978e8b1..71698e1c25c 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_razuvious.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_razuvious.cpp @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - //Razuvious - NO TEXT sound only //8852 aggro01 - Hah hah, I'm just getting warmed up! //8853 aggro02 Stand and fight! @@ -32,18 +30,15 @@ //8861 Sweep the leg! Do you have a problem with that? //8860 death - An honorable... death... //8947 - Aggro Mixed? - ? - #define SOUND_AGGRO RAND(8852,8853,8854) #define SOUND_SLAY RAND(8861,8863) #define SOUND_COMMND RAND(8855,8856,8858,8859,8861) #define SOUND_DEATH 8860 #define SOUND_AGGROMIX 8847 - #define SPELL_UNBALANCING_STRIKE 26613 #define SPELL_DISRUPTING_SHOUT HEROIC(29107,55543) #define SPELL_JAGGED_KNIFE 55550 #define SPELL_HOPELESS 29125 - enum Events { EVENT_STRIKE, @@ -51,17 +46,14 @@ enum Events EVENT_KNIFE, EVENT_COMMAND, }; - struct TRINITY_DLL_DECL boss_razuviousAI : public BossAI { boss_razuviousAI(Creature *c) : BossAI(c, BOSS_RAZUVIOUS) {} - void KilledUnit(Unit* victim) { if (!(rand()%3)) DoPlaySoundToSet(me, SOUND_SLAY); } - void DamageTaken(Unit* pDone_by, uint32& uiDamage) { // Damage done by the controlled Death Knight understudies should also count toward damage done by players @@ -70,14 +62,12 @@ struct TRINITY_DLL_DECL boss_razuviousAI : public BossAI me->LowerPlayerDamageReq(uiDamage); } } - void JustDied(Unit* killer) { _JustDied(); DoPlaySoundToSet(me, SOUND_DEATH); me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -86,14 +76,11 @@ struct TRINITY_DLL_DECL boss_razuviousAI : public BossAI events.ScheduleEvent(EVENT_SHOUT, 25000); events.ScheduleEvent(EVENT_COMMAND, 40000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -117,16 +104,13 @@ struct TRINITY_DLL_DECL boss_razuviousAI : public BossAI return; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_razuvious(Creature* pCreature) { return new boss_razuviousAI (pCreature); } - void AddSC_boss_razuvious() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp index e5fb1c6463a..4ec38e2a446 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_sapphiron.cpp @@ -15,13 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - #define EMOTE_BREATH -1533082 #define EMOTE_ENRAGE -1533083 - #define SPELL_FROST_AURA HEROIC(28531,55799) #define SPELL_CLEAVE 19983 #define SPELL_TAIL_SWEEP HEROIC(55697,55696) @@ -33,15 +30,11 @@ #define SPELL_FROST_MISSILE 30101 #define SPELL_BERSERK 26662 #define SPELL_DIES 29357 - #define SPELL_CHILL HEROIC(28547,55699) - #define MOB_BLIZZARD 16474 #define GO_ICEBLOCK 181247 - #define ACHIEVEMENT_THE_HUNDRED_CLUB HEROIC(2146, 2147) #define MAX_FROST_RESISTANCE 100 - enum Phases { PHASE_NULL = 0, @@ -49,7 +42,6 @@ enum Phases PHASE_GROUND, PHASE_FLIGHT, }; - enum Events { EVENT_BERSERK = 1, @@ -66,9 +58,7 @@ enum Events EVENT_GROUND, EVENT_BIRTH, }; - typedef std::map IceBlockMap; - struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI { boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) @@ -76,15 +66,12 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI { pMap = m_creature->GetMap(); } - Phases phase; uint32 iceboltCount; IceBlockMap iceblocks; - bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147) uint32 CheckFrostResistTimer; Map* pMap; - void InitializeAI() { float x, y, z; @@ -93,35 +80,25 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI me->SetVisibility(VISIBILITY_OFF); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); - ScriptedAI::InitializeAI(); } - void Reset() { _Reset(); - if (phase = PHASE_FLIGHT) ClearIceBlock(); - phase = PHASE_NULL; - CanTheHundredClub = true; CheckFrostResistTimer = 5000; } - void EnterCombat(Unit *who) { _EnterCombat(); - me->CastSpell(me, SPELL_FROST_AURA, true); - events.ScheduleEvent(EVENT_BERSERK, 15*60000); EnterPhaseGround(); - CheckPlayersFrostResist(); } - void SpellHitTarget(Unit *target, const SpellEntry *spell) { if (spell->Id == SPELL_ICEBOLT) @@ -134,12 +111,10 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI } } } - void JustDied(Unit* who) { _JustDied(); me->CastSpell(me, SPELL_DIES, true); - CheckPlayersFrostResist(); if(CanTheHundredClub) { @@ -149,19 +124,17 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI if(pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievTheHundredClub); } } } } - void MovementInform(uint32, uint32 id) { if (id == 1) events.ScheduleEvent(EVENT_LIFTOFF, 0); } - void DoAction(const int32 param) { if (param == DATA_SAPPHIRON_BIRTH) @@ -170,13 +143,12 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI events.ScheduleEvent(EVENT_BIRTH, 23000); } } - void CheckPlayersFrostResist() { if(CanTheHundredClub && pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if(itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) { @@ -186,7 +158,6 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI } } } - void EnterPhaseGround() { phase = PHASE_GROUND; @@ -198,10 +169,9 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_FLIGHT, 45000); } - void ClearIceBlock() { - for(IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) + for (IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) { if (Player* pPlayer = Unit::GetPlayer(itr->first)) pPlayer->RemoveAura(SPELL_ICEBOLT); @@ -210,17 +180,13 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI } iceblocks.clear(); } - void UpdateAI(const uint32 diff) { if (!phase) return; - events.Update(diff); - if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom()) return; - if(CanTheHundredClub) { if(CheckFrostResistTimer < diff) @@ -229,7 +195,6 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI CheckFrostResistTimer = (rand() % 5 + 5) * 1000; }else CheckFrostResistTimer -= diff; } - if (phase == PHASE_GROUND) { while(uint32 eventId = events.ExecuteEvent()) @@ -271,7 +236,6 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI return; } } - DoMeleeAttackIfReady(); } else @@ -291,10 +255,9 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI { std::vector targets; std::list::iterator i = me->getThreatManager().getThreatList().begin(); - for(; i != me->getThreatManager().getThreatList().end(); ++i) + for (; i != me->getThreatManager().getThreatList().end(); ++i) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) targets.push_back((*i)->getTarget()); - if (targets.empty()) iceboltCount = 0; else @@ -305,7 +268,6 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI DoCast(*itr, SPELL_ICEBOLT); --iceboltCount; } - if (iceboltCount) events.ScheduleEvent(EVENT_ICEBOLT, 1000); else @@ -342,26 +304,23 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI }//if (uint32 eventId = events.ExecuteEvent()) }//if (phase == PHASE_GROUND) } - void CastExplosion() { DoZoneInCombat(); // make sure everyone is in threatlist std::vector targets; std::list::iterator i = me->getThreatManager().getThreatList().begin(); - for(; i != me->getThreatManager().getThreatList().end(); ++i) + for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit *target = (*i)->getTarget(); if (target->GetTypeId() != TYPEID_PLAYER) continue; - if (target->HasAura(SPELL_ICEBOLT)) { target->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); targets.push_back(target); continue; } - - for(IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) + for (IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) { if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) { @@ -375,19 +334,15 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI } } } - me->CastSpell(me, SPELL_FROST_EXPLOSION, true); - - for(std::vector::iterator itr = targets.begin(); itr != targets.end(); ++itr) + for (std::vector::iterator itr = targets.begin(); itr != targets.end(); ++itr) (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); } }; - CreatureAI* GetAI_boss_sapphiron(Creature* pCreature) { return new boss_sapphironAI (pCreature); } - void AddSC_boss_sapphiron() { Script *newscript; @@ -395,7 +350,6 @@ void AddSC_boss_sapphiron() newscript->Name = "boss_sapphiron"; newscript->GetAI = &GetAI_boss_sapphiron; newscript->RegisterSelf(); - // Chill GetAISpellInfo(28547)->cooldown = 1000; GetAISpellInfo(55699)->cooldown = 1000; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_thaddius.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_thaddius.cpp index 173bb84dba7..477ac69df87 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_thaddius.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_thaddius.cpp @@ -15,32 +15,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - //Stalagg #define SAY_STAL_AGGRO -1533023 //not used #define SAY_STAL_SLAY -1533024 //not used #define SAY_STAL_DEATH -1533025 //not used - #define SPELL_POWERSURGE 28134 - //Feugen #define SAY_FEUG_AGGRO -1533026 //not used #define SAY_FEUG_SLAY -1533027 //not used #define SAY_FEUG_DEATH -1533028 //not used - #define SPELL_MANABURN 28135 - //both #define SPELL_WARSTOMP 28125 - //generic #define C_TESLA_COIL 16218 //the coils (emotes "Tesla Coil overloads!") - //Thaddus #define SAY_GREET -1533029 //not used #define SAY_AGGRO RAND(-1533030,-1533031,-1533032) @@ -51,19 +43,16 @@ #define SAY_SCREAM2 -1533037 //not used #define SAY_SCREAM3 -1533038 //not used #define SAY_SCREAM4 -1533039 //not used - #define SPELL_POLARITY_SHIFT 28089 #define SPELL_BALL_LIGHTNING 28299 #define SPELL_CHAIN_LIGHTNING HEROIC(28167,54531) #define SPELL_BERSERK 27680 - enum Events { EVENT_SHIFT = 1, EVENT_CHAIN, EVENT_BERSERK, }; - struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI { boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS) @@ -71,19 +60,16 @@ struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI // temp me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); } - void KilledUnit(Unit* victim) { if (!(rand()%5)) DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* Killer) { _JustDied(); DoScriptText(SAY_DEATH, me); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -92,17 +78,13 @@ struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI events.ScheduleEvent(EVENT_CHAIN, 10000+rand()%10000); events.ScheduleEvent(EVENT_BERSERK, 6*60000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -120,19 +102,16 @@ struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI return; } } - if (events.GetTimer() > 15000 && !me->IsWithinMeleeRange(me->getVictim())) DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); else DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_thaddius(Creature* pCreature) { return new boss_thaddiusAI (pCreature); } - void AddSC_boss_thaddius() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/def_naxxramas.h b/src/bindings/scripts/scripts/northrend/naxxramas/def_naxxramas.h index 383200d4600..06692a009d4 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/def_naxxramas.h +++ b/src/bindings/scripts/scripts/northrend/naxxramas/def_naxxramas.h @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_NAXXRAMAS_H #define DEF_NAXXRAMAS_H - enum Encounter { BOSS_ANUBREKHAN, @@ -38,15 +36,12 @@ enum Encounter BOSS_KELTHUZAD, MAX_BOSS_NUMBER }; - enum Data { DATA_HEIGAN_ERUPT, DATA_GOTHIK_GATE, DATA_SAPPHIRON_BIRTH, }; - #define GO_BIRTH 181356 - #endif diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/instance_naxxramas.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/instance_naxxramas.cpp index 189eac62ca8..f6ea3d6bca9 100644 --- a/src/bindings/scripts/scripts/northrend/naxxramas/instance_naxxramas.cpp +++ b/src/bindings/scripts/scripts/northrend/naxxramas/instance_naxxramas.cpp @@ -13,10 +13,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_naxxramas.h" - const DoorData doorData[] = { {181126, BOSS_ANUBREKHAN,DOOR_TYPE_ROOM, BOUNDARY_S}, @@ -44,7 +42,6 @@ const DoorData doorData[] = {181225, BOSS_SAPPHIRON, DOOR_TYPE_PASSAGE, BOUNDARY_W}, {0, 0, DOOR_TYPE_ROOM, 0}, // EOF }; - const MinionData minionData[] = { //{16573, BOSS_ANUBREKHAN}, there is no spawn point in db, so we do not add them here @@ -56,16 +53,13 @@ const MinionData minionData[] = {30549, BOSS_HORSEMEN}, {0, 0,} }; - enum eEnums { GO_HORSEMEN_CHEST_HERO = 193426, GO_HORSEMEN_CHEST = 181366, //four horsemen event, DoRespawnGameObject() when event == DONE GO_GOTHIK_GATE = 181170, - SPELL_ERUPTION = 29371 }; - const float HeiganPos[2] = {2796, -3707}; const float HeiganEruptionSlope[3] = { @@ -73,7 +67,6 @@ const float HeiganEruptionSlope[3] = (-3647 - HeiganPos[1]) /(2749 - HeiganPos[0]), (-3637 - HeiganPos[1]) /(2771 - HeiganPos[0]), }; - // 0 H x // 1 ^ // 2 | @@ -83,18 +76,15 @@ inline uint32 GetEruptionSection(float x, float y) y -= HeiganPos[1]; if (y < 1.0f) return 0; - x -= HeiganPos[0]; if (x > -1.0f) return 3; - float slope = y/x; - for(uint32 i = 0; i < 3; ++i) + for (uint32 i = 0; i < 3; ++i) if (slope > HeiganEruptionSlope[i]) return i; return 3; } - struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData { instance_naxxramas(Map* pMap) : InstanceData(pMap) @@ -104,22 +94,18 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData LoadDoorData(doorData); LoadMinionData(minionData); } - std::set HeiganEruption[4]; GameObject* pGothikGate, *HorsemenChest; Creature* Sapphiron; uint32 HorsemenNum; - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) { case 15989: Sapphiron = add ? pCreature : NULL; return; } - AddMinion(pCreature, add); } - void OnGameObjectCreate(GameObject* pGo, bool add) { if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) @@ -131,7 +117,6 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData HeiganEruption[section].erase(pGo); return; } - switch(pGo->GetEntry()) { case GO_BIRTH: if (!add && Sapphiron) Sapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); return; @@ -139,10 +124,8 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData case GO_HORSEMEN_CHEST: HorsemenChest = add ? pGo : NULL; break; case GO_HORSEMEN_CHEST_HERO: HorsemenChest = add ? pGo : NULL; break; } - AddDoor(pGo, add); } - void SetData(uint32 id, uint32 value) { switch(id) @@ -156,26 +139,21 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData break; } } - bool SetBossState(uint32 id, EncounterState state) { if (!InstanceData::SetBossState(id, state)) return false; - if (id == BOSS_HORSEMEN && state == DONE && HorsemenChest) HorsemenChest->SetRespawnTime(HorsemenChest->GetRespawnDelay()); - return true; } - void HeiganErupt(uint32 section) { - for(uint32 i = 0; i < 4; ++i) + for (uint32 i = 0; i < 4; ++i) { if (i == section) continue; - - for(std::set::iterator itr = HeiganEruption[i].begin(); itr != HeiganEruption[i].end(); ++itr) + for (std::set::iterator itr = HeiganEruption[i].begin(); itr != HeiganEruption[i].end(); ++itr) { (*itr)->SendCustomAnim(); (*itr)->CastSpell(NULL, SPELL_ERUPTION); @@ -183,26 +161,21 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData } } }; - bool AreaTrigger_at_naxxramas_frostwyrm_wing(Player* pPlayer, AreaTriggerEntry *at) { if (pPlayer->isGameMaster()) return false; - InstanceData *data = pPlayer->GetInstanceData(); if (data) - for(uint32 i = BOSS_ANUBREKHAN; i < BOSS_SAPPHIRON; ++i) + for (uint32 i = BOSS_ANUBREKHAN; i < BOSS_SAPPHIRON; ++i) if (data->GetBossState(i) != DONE) return true; - return false; } - InstanceData* GetInstanceData_instance_naxxramas(Map* pMap) { return new instance_naxxramas(pMap); } - void AddSC_instance_naxxramas() { Script *newscript; @@ -210,7 +183,6 @@ void AddSC_instance_naxxramas() newscript->Name = "instance_naxxramas"; newscript->GetInstanceData = &GetInstanceData_instance_naxxramas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_naxxramas_frostwyrm_wing"; newscript->pAreaTrigger = &AreaTrigger_at_naxxramas_frostwyrm_wing; diff --git a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/boss_malygos.cpp b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/boss_malygos.cpp index e96d6893380..a8e261a80a5 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/boss_malygos.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/boss_malygos.cpp @@ -5,12 +5,10 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_ARCANE_BREATH_N 56272 #define SPELL_ARCANE_BREATH_H 60072 @@ -23,7 +21,6 @@ update creature_template set scriptname = '' where entry = ''; #define SPELL_SURGE_OF_POWER_2 57407 #define SPELL_SURGE_OF_POWER_3 60936 #define SPELL_VORTEX 56105 - //Dragon "mounts" spells in Phase3 //they use Rugelike energy #define SPELL_DMOUNT_FLAME_SPIKE 56091 //maybe not accurate @@ -32,7 +29,6 @@ update creature_template set scriptname = '' where entry = ''; #define SPELL_DMOUNT_LIFE_BURST 57143 #define SPELL_DMOUNT_FLAME_SHIELD 57108 //#define SPELL_DMOUNT_UNKNOWN XYZ //Increases your drake's flight speed by 500%. - //not in db //Yell //-->Other @@ -57,9 +53,7 @@ update creature_template set scriptname = '' where entry = ''; #define SAY_PHASE1_SLAY_1 -1616015 #define SAY_PHASE1_SLAY_2 -1616016 #define SAY_PHASE1_SLAY_3 -1616017 - //--> Phase2 at 50% HP, - /*Malygos himself is not targetable during this phase, it will end when the adds he spawns are all killed. However, he does continue to play a part in the encounter. During this phase he drops anti-magic zones onto the ground the raid MUST stand inside of, it reduces magical damage taken by 50%. They shrink over time, so it's important that your raid moves to each new one he drops. Throughout the phase, he will deep breath doing ~4k damage per second, unless you are standing inside of the anti-magic zone. @@ -68,7 +62,6 @@ The Lords will move down onto the group, and need to be tanked (They will one-sh It is recommended to let melee take the first disks, then ranged. As those mobs die, they also drop disks, which allows the rest of your dps to get onto them. The Scions will continually cast Arcane Blast on random targets on the floor, which is mitigated by the anti-magic zones. While mounted on a disk, you will not take damage. After all of the NPCs riding on the disks die, the players on the disks need to dismount as Phase 3 is about to begin.*/ - //not in db #define SAY_PHASE2_AGGRO -1616018 #define SAY_PHASE2_END -1616019 @@ -82,14 +75,11 @@ After all of the NPCs riding on the disks die, the players on the disks need to #define SAY_PHASE3_SLAY_2 -1616026 #define SAY_PHASE3_SLAY_3 -1616027 #define SAY_PHASE3_BIG_ATTACK -1616028 - struct TRINITY_DLL_DECL boss_malygosAI : public ScriptedAI { boss_malygosAI(Creature *c) : ScriptedAI(c) {} - uint32 phase, enrage; - void Reset() { //Source Deadly Boss Mod @@ -112,14 +102,12 @@ struct TRINITY_DLL_DECL boss_malygosAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50){ phase = 2; //spawn adds //set malygos unatackable untill all adds spawned dead //start phase3 } - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -130,7 +118,6 @@ struct TRINITY_DLL_DECL boss_malygosAI : public ScriptedAI { if (victim == m_creature) return; - if (phase ==1) DoScriptText(RAND(SAY_PHASE1_SLAY_1,SAY_PHASE1_SLAY_2,SAY_PHASE1_SLAY_3), m_creature); if (phase ==2) @@ -139,16 +126,13 @@ struct TRINITY_DLL_DECL boss_malygosAI : public ScriptedAI DoScriptText(RAND(SAY_PHASE3_SLAY_1,SAY_PHASE3_SLAY_2,SAY_PHASE3_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_malygos(Creature* pCreature) { return new boss_malygosAI (pCreature); } - void AddSC_boss_malygos() { Script *newscript; - newscript = new Script; newscript->Name = "boss_malygos"; newscript->GetAI = &GetAI_boss_malygos; diff --git a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/def_eye_of_eternity.h b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/def_eye_of_eternity.h index caa82a92e95..b2624ea1796 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/def_eye_of_eternity.h +++ b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/def_eye_of_eternity.h @@ -1,4 +1,3 @@ #ifndef DEF_EYE_OF_ETERNITY_H #define DEF_EYE_OF_ETERNITY_H - #endif diff --git a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/instance_eye_of_eternity.cpp b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/instance_eye_of_eternity.cpp index 7c89a117d92..aa2c7107ad4 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/instance_eye_of_eternity.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/eye_of_eternity/instance_eye_of_eternity.cpp @@ -1,16 +1,13 @@ #include "precompiled.h" #include "def_eye_of_eternity.h" - struct TRINITY_DLL_DECL instance_eye_of_eternity : public ScriptedInstance { instance_eye_of_eternity(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; }; - InstanceData* GetInstanceData_instance_eye_of_eternity(Map* pMap) { return new instance_eye_of_eternity(pMap); } - void AddSC_instance_eye_of_eternity() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_anomalus.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_anomalus.cpp index f0759804235..4a1dc380925 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_anomalus.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_anomalus.cpp @@ -13,23 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Anomalus SD%Complete: SDComment: SDCategory: The Nexus, The Nexus EndScriptData */ - #include "precompiled.h" #include "def_nexus.h" - bool DeadChaoticRift; // needed for achievement: Chaos Theory(2037) - enum eEnums { ACHIEVEMENT_CHAOS_THEORY = 2037, - //Spells SPELL_SPARK_N = 47751, SPELL_SPARK_H = 57062, @@ -37,20 +32,17 @@ enum eEnums SPELL_CHARGE_RIFT = 47747, //Works wrong (affect players, not rifts) SPELL_CREATE_RIFT = 47743, //Don't work, using WA SPELL_ARCANE_ATTRACTION = 57063, //No idea, when it's used - MOB_CRAZED_MANA_WRAITH = 26746, MOB_CHAOTIC_RIFT = 26918, SPELL_CHAOTIC_ENERGY_BURST = 47688, SPELL_CHARGED_CHAOTIC_ENERGY_BURST = 47737, SPELL_ARCANEFORM = 48019, //Chaotic Rift visual - //Yell SAY_AGGRO = -1576010, SAY_DEATH = -1576011, SAY_RIFT = -1576012, SAY_SHIELD = -1576013 }; - float RiftLocation[6][3]= { {652.64, -273.70, -8.75}, @@ -60,7 +52,6 @@ float RiftLocation[6][3]= {639.87, -314.11, -9.49}, {651.72, -297.44, -9.37} }; - struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI { boss_anomalusAI(Creature *c) : ScriptedAI(c) @@ -68,40 +59,31 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint8 Phase; uint32 SPELL_SPARK_Timer; uint32 SPELL_CREATE_RIFT_Timer; uint64 ChaoticRiftGUID; - void Reset() { Phase = 0; SPELL_SPARK_Timer = 5000; SPELL_CREATE_RIFT_Timer = 25000; ChaoticRiftGUID = 0; - DeadChaoticRift = false; - if (pInstance) pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (HeroicMode && !DeadChaoticRift) { AchievementEntry const *AchievChaosTheory = GetAchievementStore()->LookupEntry(ACHIEVEMENT_CHAOS_THEORY); @@ -111,21 +93,18 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievChaosTheory); } } } - if (pInstance) pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->HasAura(SPELL_RIFT_SHIELD)) { if (ChaoticRiftGUID) @@ -140,13 +119,11 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI } } else ChaoticRiftGUID = 0; - if ((Phase == 0) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.75)) { Phase = 1; DoScriptText(SAY_SHIELD, m_creature); DoCast(m_creature, SPELL_RIFT_SHIELD); - int tmp = rand()%(2); Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (Rift) @@ -158,13 +135,11 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI DoScriptText(SAY_RIFT , m_creature); } } - if ((Phase == 1) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.50)) { Phase = 2; DoScriptText(SAY_SHIELD , m_creature); DoCast(m_creature,SPELL_RIFT_SHIELD); - int tmp = rand()%(2); Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (Rift) @@ -176,13 +151,11 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI DoScriptText(SAY_RIFT , m_creature); } } - if ((Phase == 2) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) { Phase = 3; DoScriptText(SAY_SHIELD , m_creature); DoCast(m_creature,SPELL_RIFT_SHIELD); - int tmp = rand()%(2); Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (Rift) @@ -194,18 +167,15 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI DoScriptText(SAY_RIFT , m_creature); } } - if (SPELL_SPARK_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, HEROIC(SPELL_SPARK_N, SPELL_SPARK_H)); SPELL_SPARK_Timer = 5000; }else SPELL_SPARK_Timer -=diff; - if (SPELL_CREATE_RIFT_Timer < diff) { DoScriptText(SAY_RIFT , m_creature); - int tmp = rand()%(2); Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (Rift) @@ -213,28 +183,22 @@ struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI Rift->AI()->AttackStart(target); SPELL_CREATE_RIFT_Timer = 25000; }else SPELL_CREATE_RIFT_Timer -=diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_anomalus(Creature* pCreature) { return new boss_anomalusAI (pCreature); } - struct TRINITY_DLL_DECL mob_chaotic_riftAI : public Scripted_NoMovementAI { mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 SPELL_CHAOTIC_ENERGY_BURST_Timer; uint32 SUMMON_CRAZED_MANA_WRAITH_Timer; - void Reset() { SPELL_CHAOTIC_ENERGY_BURST_Timer = 1000; @@ -244,17 +208,14 @@ struct TRINITY_DLL_DECL mob_chaotic_riftAI : public Scripted_NoMovementAI //Set model to horde number DoCast(m_creature, SPELL_ARCANEFORM, false); } - void JustDied(Unit *killer) { DeadChaoticRift = true; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (SPELL_CHAOTIC_ENERGY_BURST_Timer < diff) { Unit* Anomalus = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); @@ -265,7 +226,6 @@ struct TRINITY_DLL_DECL mob_chaotic_riftAI : public Scripted_NoMovementAI DoCast(target, SPELL_CHAOTIC_ENERGY_BURST); SPELL_CHAOTIC_ENERGY_BURST_Timer = 1000; }else SPELL_CHAOTIC_ENERGY_BURST_Timer -=diff; - if (SUMMON_CRAZED_MANA_WRAITH_Timer < diff) { Creature* Wraith = m_creature->SummonCreature(MOB_CRAZED_MANA_WRAITH, m_creature->GetPositionX()+1, m_creature->GetPositionY()+1, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); @@ -280,21 +240,17 @@ struct TRINITY_DLL_DECL mob_chaotic_riftAI : public Scripted_NoMovementAI }else SUMMON_CRAZED_MANA_WRAITH_Timer -=diff; } }; - CreatureAI* GetAI_mob_chaotic_rift(Creature* pCreature) { return new mob_chaotic_riftAI (pCreature); } - void AddSC_boss_anomalus() { Script *newscript; - newscript = new Script; newscript->Name = "boss_anomalus"; newscript->GetAI = &GetAI_boss_anomalus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_chaotic_rift"; newscript->GetAI = &GetAI_mob_chaotic_rift; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp index 4845119a89e..6274bf3d1f8 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp @@ -13,23 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Keristrasza SD%Complete: SDComment: SDCategory: The Nexus, The Nexus EndScriptData */ - #include "precompiled.h" #include "def_nexus.h" - enum eEnums { CONTAINMENT_SPHERES = 3, - ACHIEVEMENT_INTENSE_COLD = 2036, - //Spells SPELL_FROZEN_PRISON = 47854, SPELL_TAIL_SWEEP = 50155, @@ -40,7 +35,6 @@ enum eEnums SPELL_CRYSTALIZE = 48179, SPELL_INTENSE_COLD = 48094, SPELL_INTENSE_COLD_TRIGGERED = 48095, - //Yell SAY_AGGRO = -1576040, SAY_SLAY = -1576041, @@ -48,7 +42,6 @@ enum eEnums SAY_DEATH = -1576043, SAY_CRYSTAL_NOVA = -1576044 }; - struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI { boss_keristraszaAI(Creature *c) : ScriptedAI(c) @@ -56,51 +49,38 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint32 CRYSTALFIRE_BREATH_Timer; uint32 CRYSTAL_CHAINS_CRYSTALIZE_Timer; uint32 TAIL_SWEEP_Timer; bool Enrage; - uint64 ContainmentSphereGUIDs[CONTAINMENT_SPHERES]; - uint32 CheckIntenseColdTimer; bool MoreThanTwoIntenseCold; // needed for achievement: Intense Cold(2036) - void Reset() { CRYSTALFIRE_BREATH_Timer = 14000; CRYSTAL_CHAINS_CRYSTALIZE_Timer = HEROIC(30000,11000); TAIL_SWEEP_Timer = 5000; Enrage = false; - CheckIntenseColdTimer = 2000; MoreThanTwoIntenseCold = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - RemovePrison(CheckContainmentSpheres()); - if (pInstance) pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoCastAOE(SPELL_INTENSE_COLD); - if (pInstance) pInstance->SetData(DATA_KERISTRASZA_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (HeroicMode && !MoreThanTwoIntenseCold) { AchievementEntry const *AchievIntenseCold = GetAchievementStore()->LookupEntry(ACHIEVEMENT_INTENSE_COLD); @@ -110,33 +90,27 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievIntenseCold); } } } - if (pInstance) pInstance->SetData(DATA_KERISTRASZA_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_SLAY, m_creature); } - bool CheckContainmentSpheres(bool remove_prison = false) { if(!pInstance) return false; - ContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE); ContainmentSphereGUIDs[1] = pInstance->GetData64(ORMOROKS_CONTAINMET_SPHERE); ContainmentSphereGUIDs[2] = pInstance->GetData64(TELESTRAS_CONTAINMET_SPHERE); - GameObject *ContainmentSpheres[CONTAINMENT_SPHERES]; - - for(uint8 i = 0; i < CONTAINMENT_SPHERES; ++i) + for (uint8 i = 0; i < CONTAINMENT_SPHERES; ++i) { ContainmentSpheres[i] = pInstance->instance->GetGameObject(ContainmentSphereGUIDs[i]); if (!ContainmentSpheres[i]) @@ -148,7 +122,6 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI RemovePrison(true); return true; } - void RemovePrison(bool remove) { if (remove) @@ -165,21 +138,18 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI m_creature->CastSpell(m_creature, SPELL_FROZEN_PRISON, false); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CheckIntenseColdTimer < diff && !MoreThanTwoIntenseCold) { std::list ThreatList = m_creature->getThreatManager().getThreatList(); - for(std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++) + for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++) { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!target || target->GetTypeId() != TYPEID_PLAYER) continue; - Aura *AuraIntenseCold = target->GetAura(SPELL_INTENSE_COLD_TRIGGERED); if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2) { @@ -189,26 +159,22 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI } CheckIntenseColdTimer = 2000; } else CheckIntenseColdTimer -= diff; - if (!Enrage && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) { DoScriptText(SAY_ENRAGE, m_creature); DoCast(m_creature, SPELL_ENRAGE); Enrage = true; } - if (CRYSTALFIRE_BREATH_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_CRYSTALFIRE_BREATH_N, SPELL_CRYSTALFIRE_BREATH_H)); CRYSTALFIRE_BREATH_Timer = 14000; } else CRYSTALFIRE_BREATH_Timer -=diff; - if (TAIL_SWEEP_Timer < diff) { DoCast(m_creature, SPELL_TAIL_SWEEP); TAIL_SWEEP_Timer = 5000; } else TAIL_SWEEP_Timer -=diff; - if (CRYSTAL_CHAINS_CRYSTALIZE_Timer < diff) { DoScriptText(SAY_CRYSTAL_NOVA, m_creature); @@ -218,41 +184,33 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI DoCast(target, SPELL_CRYSTAL_CHAINS); CRYSTAL_CHAINS_CRYSTALIZE_Timer = HEROIC(30000,11000); } else CRYSTAL_CHAINS_CRYSTALIZE_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_keristrasza(Creature* pCreature) { return new boss_keristraszaAI (pCreature); } - bool GOHello_containment_sphere(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); - Creature *Keristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); if (Keristrasza && Keristrasza->isAlive()) { // maybe these are hacks :( pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); pGO->SetGoState(GO_STATE_ACTIVE); - CAST_AI(boss_keristraszaAI, Keristrasza->AI())->CheckContainmentSpheres(true); } return true; } - void AddSC_boss_keristrasza() { Script *newscript; - newscript = new Script; newscript->Name = "boss_keristrasza"; newscript->GetAI = &GetAI_boss_keristrasza; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "containment_sphere"; newscript->pGOHello = &GOHello_containment_sphere; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_magus_telestra.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_magus_telestra.cpp index d043705ab54..5b7d2000c6c 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_magus_telestra.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_magus_telestra.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Magus_Telestra SD%Complete: SDComment: SDCategory: The Nexus, The Nexus EndScriptData */ - #include "precompiled.h" #include "def_nexus.h" - enum eEnums { //Spells @@ -33,16 +30,13 @@ enum eEnums SPELL_FIREBOMB_H = 56934, SPELL_GRAVITY_WELL = 47756, SPELL_TELESTRA_BACK = 47714, - //At 50% HP - 3 clones, Frost, Fire, Arcane (and in 10% HP in Heroic) MOB_FIRE_MAGUS = 26928, MOB_FROST_MAGUS = 26930, MOB_ARCANE_MAGUS = 26929, - SPELL_FIRE_MAGUS_VISUAL = 47705, SPELL_FROST_MAGUS_VISUAL = 47706, SPELL_ARCANE_MAGUS_VISUAL = 47704, - //Yell SAY_AGGRO = -1576000, SAY_KILL = -1576001, @@ -50,17 +44,14 @@ enum eEnums SAY_MERGE = -1576003, SAY_SPLIT_1 = -1576004, SAY_SPLIT_2 = -1576005, - //Achievement ACHIEV_SPLIT_PERSONALITY = 2150, ACHIEV_TIMER = 5 * 1000 }; - float CenterOfRoom[1][4] = { {504.80, 89.07, -16.12, 6.27} }; - struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI { boss_magus_telestraAI(Creature* c) : ScriptedAI(c) @@ -68,31 +59,24 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint64 FireMagusGUID; uint64 FrostMagusGUID; uint64 ArcaneMagusGUID; bool FireMagusDead; bool FrostMagusDead; bool ArcaneMagusDead; - uint32 AppearDelay_Timer; bool AppearDelay; - uint8 Phase; - uint32 SPELL_ICE_NOVA_Timer; uint32 SPELL_FIREBOMB_Timer; uint32 SPELL_GRAVITY_WELL_Timer; uint32 Cooldown; - bool AchievementTimerRunning; uint8 AchievementProgress; uint32 AchievementTimer; - void Reset() { Phase = 0; @@ -101,36 +85,27 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI SPELL_FIREBOMB_Timer = 0; SPELL_GRAVITY_WELL_Timer = 15000; Cooldown = 0; - FireMagusGUID = 0; FrostMagusGUID = 0; ArcaneMagusGUID = 0; - AchievementProgress = 0; AchievementTimer = 0; AchievementTimerRunning = false; - AppearDelay = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); - if (pInstance) pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (HeroicMode && AchievementProgress == 2) { AchievementEntry const *AchievSplitPersonality = GetAchievementStore()->LookupEntry(ACHIEV_SPLIT_PERSONALITY); @@ -140,21 +115,18 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievSplitPersonality); } } } - if (pInstance) pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - uint64 SplitPersonality(uint32 entry) { Creature* Summoned = m_creature->SummonCreature(entry, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); @@ -184,7 +156,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI } return 0; } - void UpdateAI(const uint32 diff) { //Return since we have no target @@ -192,7 +163,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI { return; } - if (AppearDelay) { m_creature->StopMoving(); @@ -205,7 +175,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI return; } - if ((Phase == 1)||(Phase == 3)) { Unit* FireMagus; @@ -260,7 +229,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI }else return; } - if ((Phase == 0) && (m_creature->GetHealth() <= (m_creature->GetMaxHealth() * 0.5))) { Phase = 1; @@ -277,7 +245,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), m_creature); return; } - if (HeroicMode && (Phase == 2) && (m_creature->GetHealth() <= (m_creature->GetMaxHealth() * 0.1))) { Phase = 3; @@ -294,7 +261,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), m_creature); return; } - if (Cooldown) { if (Cooldown < diff) @@ -305,7 +271,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI return; } } - if (SPELL_ICE_NOVA_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -315,7 +280,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI } SPELL_ICE_NOVA_Timer = 15000; }else SPELL_ICE_NOVA_Timer -=diff; - if (SPELL_GRAVITY_WELL_Timer < diff) { if (Unit* target = m_creature->getVictim()) @@ -325,7 +289,6 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI } SPELL_GRAVITY_WELL_Timer = 15000; }else SPELL_GRAVITY_WELL_Timer -=diff; - if (SPELL_FIREBOMB_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -335,20 +298,16 @@ struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI } SPELL_FIREBOMB_Timer = 2000; }else SPELL_FIREBOMB_Timer -=diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_magus_telestra(Creature* pCreature) { return new boss_magus_telestraAI (pCreature); } - void AddSC_boss_magus_telestra() { Script *newscript; - newscript = new Script; newscript->Name = "boss_magus_telestra"; newscript->GetAI = &GetAI_boss_magus_telestra; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_ormorok.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_ormorok.cpp index 44c4a16401d..62d4ae008b3 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_ormorok.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_ormorok.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ormorok SD%Complete: SDComment: SDCategory: The Nexus, The Nexus EndScriptData */ - #include "precompiled.h" #include "def_nexus.h" - enum eEnums { //Spells @@ -42,7 +39,6 @@ enum eEnums SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, //summons npc 32665 MOB_CRYSTALLINE_TANGLER = 32665, SPELL_ROOTS = 28858, //proper spell id is unknown - //Yell SAY_AGGRO = -1576020, SAY_DEATH = -1576021, @@ -50,9 +46,7 @@ enum eEnums SAY_CRYSTAL_SPIKES = -1576023, SAY_KILL = -1576024 }; - #define SPIKE_DISTANCE 5.0f - struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI { boss_ormorokAI(Creature *c) : ScriptedAI(c) @@ -60,7 +54,6 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; bool Frenzy; @@ -71,14 +64,12 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI float BaseZ; float BaseO; float SpikeXY[4][2]; - uint32 SPELL_CRYSTAL_SPIKES_Timer; uint32 CRYSTAL_SPIKES_Timer; uint32 SPELL_TRAMPLE_Timer; uint32 SPELL_FRENZY_Timer; uint32 SPELL_SPELL_REFLECTION_Timer; uint32 SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer; - void Reset() { SPELL_CRYSTAL_SPIKES_Timer = 12000; @@ -87,32 +78,25 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer = 17000; Frenzy = false; CrystalSpikes = false; - if (pInstance) pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_ORMOROK_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -136,26 +120,22 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI CrystalSpikes = false; CRYSTAL_SPIKES_Timer = 200; }else CRYSTAL_SPIKES_Timer -= diff; - if (!Frenzy && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) { DoCast(m_creature, SPELL_FRENZY); Frenzy = true; } - if (SPELL_TRAMPLE_Timer < diff) { DoCast(m_creature, HEROIC(SPELL_TRAMPLE_N, SPELL_TRAMPLE_H)); SPELL_TRAMPLE_Timer = 10000; }else SPELL_TRAMPLE_Timer -= diff; - if (SPELL_SPELL_REFLECTION_Timer < diff) { DoScriptText(SAY_REFLECT, m_creature); DoCast(m_creature, SPELL_SPELL_REFLECTION); SPELL_SPELL_REFLECTION_Timer = 30000; }else SPELL_SPELL_REFLECTION_Timer -= diff; - if (SPELL_CRYSTAL_SPIKES_Timer < diff) { DoScriptText(SAY_CRYSTAL_SPIKES, m_creature); @@ -168,7 +148,6 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI BaseO = m_creature->GetOrientation(); SPELL_CRYSTAL_SPIKES_Timer = 20000; }else SPELL_CRYSTAL_SPIKES_Timer -=diff; - if (HeroicMode && (SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer < diff)) { Creature* Crystalline_Tangler = m_creature->SummonCreature(MOB_CRYSTALLINE_TANGLER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); @@ -208,23 +187,18 @@ struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI } SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer = 17000; }else SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer -=diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_crystal_spikeAI : public Scripted_NoMovementAI { mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 SPELL_CRYSTALL_SPIKE_DAMAGE_Timer; uint32 SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer; - void Reset() { SPELL_CRYSTALL_SPIKE_DAMAGE_Timer = 3700; @@ -234,7 +208,6 @@ struct TRINITY_DLL_DECL mob_crystal_spikeAI : public Scripted_NoMovementAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // } - void UpdateAI(const uint32 diff) { if (SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer < diff) @@ -242,7 +215,6 @@ struct TRINITY_DLL_DECL mob_crystal_spikeAI : public Scripted_NoMovementAI DoCast(m_creature, SPELL_CRYSTAL_SPIKE_PREVISUAL); SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer = 10000; }else SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer -=diff; - if (SPELL_CRYSTALL_SPIKE_DAMAGE_Timer < diff) { DoCast(m_creature, HEROIC(SPELL_CRYSTALL_SPIKE_DAMAGE_N, SPELL_CRYSTALL_SPIKE_DAMAGE_H)); @@ -250,18 +222,14 @@ struct TRINITY_DLL_DECL mob_crystal_spikeAI : public Scripted_NoMovementAI }else SPELL_CRYSTALL_SPIKE_DAMAGE_Timer -=diff; } }; - struct TRINITY_DLL_DECL mob_crystalline_tanglerAI : public ScriptedAI { mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) {} - uint32 SPELL_ROOTS_Timer; - void Reset() { SPELL_ROOTS_Timer = 1000; } - void UpdateAI(const uint32 diff) { if (SPELL_ROOTS_Timer < diff) @@ -274,36 +242,29 @@ struct TRINITY_DLL_DECL mob_crystalline_tanglerAI : public ScriptedAI }else SPELL_ROOTS_Timer -=diff; } }; - CreatureAI* GetAI_mob_crystal_spike(Creature* pCreature) { return new mob_crystal_spikeAI (pCreature); } - CreatureAI* GetAI_mob_crystalline_tangler(Creature* pCreature) { return new mob_crystalline_tanglerAI (pCreature); } - CreatureAI* GetAI_boss_ormorok(Creature* pCreature) { return new boss_ormorokAI (pCreature); } - void AddSC_boss_ormorok() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ormorok"; newscript->GetAI = &GetAI_boss_ormorok; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_crystal_spike"; newscript->GetAI = &GetAI_mob_crystal_spike; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_crystalline_tangler"; newscript->GetAI = &GetAI_mob_crystalline_tangler; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_kolurg.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_kolurg.cpp index 6fd8a7d4fe2..aaee8e8bd55 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_kolurg.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_kolurg.cpp @@ -5,28 +5,23 @@ SD%Complete: SDComment: Only Alliance Heroic SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_commander_kolurg' where entry = ''; *** SQL END ***/ #include "precompiled.h" - #define SPELL_BATTLE_SHOUT 31403 #define SPELL_CHARGE 60067 #define SPELL_FRIGHTENING_SHOUT 19134 #define SPELL_WHIRLWIND_1 38619 #define SPELL_WHIRLWIND_2 38618 - //not used //Yell #define SAY_AGGRO -1576024 #define SAY_KILL -1576025 #define SAY_DEATH -1576026 - struct TRINITY_DLL_DECL boss_commander_kolurgAI : public ScriptedAI { boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} @@ -36,21 +31,17 @@ struct TRINITY_DLL_DECL boss_commander_kolurgAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) {} }; - CreatureAI* GetAI_boss_commander_kolurg(Creature* pCreature) { return new boss_commander_kolurgAI (pCreature); } - void AddSC_boss_commander_kolurg() { Script *newscript; - newscript = new Script; newscript->Name = "boss_commander_kolurg"; newscript->GetAI = &GetAI_boss_commander_kolurg; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_stoutbeard.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_stoutbeard.cpp index def5fc92999..2a64bc3915b 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_stoutbeard.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/commander_stoutbeard.cpp @@ -5,28 +5,23 @@ SD%Complete: SDComment: Only Horde Heroic SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_commander_stoutbeard' where entry = ''; *** SQL END ***/ #include "precompiled.h" - #define SPELL_BATTLE_SHOUT 31403 #define SPELL_CHARGE 60067 #define SPELL_FRIGHTENING_SHOUT 19134 #define SPELL_WHIRLWIND_1 38619 #define SPELL_WHIRLWIND_2 38618 - //not used //Yell #define SAY_AGGRO -1576021 #define SAY_KILL -1576022 #define SAY_DEATH -1576023 - struct TRINITY_DLL_DECL boss_commander_stoutbeardAI : public ScriptedAI { boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) { @@ -39,7 +34,6 @@ struct TRINITY_DLL_DECL boss_commander_stoutbeardAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -47,16 +41,13 @@ struct TRINITY_DLL_DECL boss_commander_stoutbeardAI : public ScriptedAI DoScriptText(SAY_DEATH, m_creature); } }; - CreatureAI* GetAI_boss_commander_stoutbeard(Creature* pCreature) { return new boss_commander_stoutbeardAI (pCreature); } - void AddSC_boss_commander_stoutbeard() { Script *newscript; - newscript = new Script; newscript->Name = "boss_commander_stoutbeard"; newscript->GetAI = &GetAI_boss_commander_stoutbeard; diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/def_nexus.h b/src/bindings/scripts/scripts/northrend/nexus/nexus/def_nexus.h index de36fea4b93..2fd3a37bb16 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/def_nexus.h +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/def_nexus.h @@ -1,19 +1,15 @@ #ifndef DEF_NEXUS_H #define DEF_NEXUS_H - enum eTypes { DATA_MAGUS_TELESTRA_EVENT, DATA_ANOMALUS_EVENT, DATA_ORMOROK_EVENT, DATA_KERISTRASZA_EVENT, - DATA_ANOMALUS, DATA_KERISTRASZA, - ANOMALUS_CONTAINMET_SPHERE, ORMOROKS_CONTAINMET_SPHERE, TELESTRAS_CONTAINMET_SPHERE }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/instance_nexus.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/instance_nexus.cpp index c420cb1920d..6249d035c49 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/instance_nexus.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/instance_nexus.cpp @@ -13,46 +13,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Nexus SD%Complete: SDComment: SDCategory: The Nexus, The Nexus EndScriptData */ - #include "precompiled.h" #include "def_nexus.h" - #define NUMBER_OF_ENCOUNTERS 4 - struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance { instance_nexus(Map* pMap) : ScriptedInstance(pMap) { Initialize(); } - uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; - uint64 Anomalus; uint64 Keristrasza; - uint64 AnomalusContainmentSphere; uint64 OrmoroksContainmentSphere; uint64 TelestrasContainmentSphere; - std::string strInstData; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Anomalus = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { Map::PlayerList const& players = instance->GetPlayers(); uint32 TeamInInstance = 0; - if (!players.isEmpty()) { if (Player* pPlayer = players.begin()->getSource()) @@ -106,7 +94,6 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance } } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -134,7 +121,6 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance } } } - uint32 GetData(uint32 identifier) { switch(identifier) @@ -146,7 +132,6 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance } return 0; } - void SetData(uint32 identifier, uint32 data) { switch(identifier) @@ -186,22 +171,17 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance } case DATA_KERISTRASZA_EVENT: m_auiEncounter[3] = data; break; } - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - strInstData = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint64 GetData64(uint32 uiIdentifier) { switch(uiIdentifier) @@ -214,12 +194,10 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance } return 0; } - std::string GetSaveData() { return strInstData; } - void Load(const char* chrIn) { if (!chrIn) @@ -227,27 +205,21 @@ struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(chrIn); - std::istringstream loadStream(chrIn); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - - for(uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) + for (uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) { if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; } - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_nexus(Map* pMap) { return new instance_nexus(pMap); } - void AddSC_instance_nexus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_drakos.cpp b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_drakos.cpp index 3ef2fa93fa3..107753764e4 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_drakos.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_drakos.cpp @@ -5,17 +5,14 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_MAGIC_PULL 51336 #define SPELL_THUNDERING_STOMP 50774 #define SPELL_THUNDERING_STOMP_2 59370 - //not in db //Yell #define SAY_AGGRO -1578000 @@ -30,11 +27,9 @@ update creature_template set scriptname = '' where entry = ''; #define SAY_STOMP_1 -1578009 #define SAY_STOMP_2 -1578010 #define SAY_STOMP_3 -1578011 - struct TRINITY_DLL_DECL boss_drakosAI : public ScriptedAI { boss_drakosAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) { @@ -47,7 +42,6 @@ struct TRINITY_DLL_DECL boss_drakosAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -61,16 +55,13 @@ struct TRINITY_DLL_DECL boss_drakosAI : public ScriptedAI DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), m_creature); } }; - CreatureAI* GetAI_boss_drakos(Creature* pCreature) { return new boss_drakosAI (pCreature); } - void AddSC_boss_drakos() { Script *newscript; - newscript = new Script; newscript->Name = "boss_drakos"; newscript->GetAI = &GetAI_boss_drakos; diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_eregos.cpp b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_eregos.cpp index a0837ac0634..e1640628cae 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_eregos.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_eregos.cpp @@ -5,26 +5,21 @@ SD%Complete: SDComment: Encounter is done entirely on drake vehicles SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer) //Two Repeating phases - //Spells #define SPELL_ARCANE_BARRAGE 50804 #define SPELL_ARCANE_VOLLEY 51153 #define SPELL_ENRAGED_ASSAULT 51170 #define SPELL_PLANAR_ANOMALIES 57959 #define SPELL_PLANAR_SHIFT 51162 - //Heroic #define SPELL_ARCANE_BARRAGE_H 59381 #define SPELL_ARCANE_VOLLEY_H 59382 - /*Ruby Drake , (npc 27756) (item 37860) (summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) @@ -32,13 +27,11 @@ update creature_template set scriptname = '' where entry = ''; #define NPC_RUBY_DRAKE_VEHICLE 27756 #define SPELL_RIDE_RUBY_DRAKE_QUE 49463 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464 #define SPELL_RUBY_DRAKE_SADDLE 49464 //Allows you to ride on the back of an Amber Drake. ---> Dummy - #define SPELL_RUBY_SEARING_WRATH 50232 //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets #define SPELL_RUBY_EVASIVE_AURA 50248 //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. #define SPELL_RUBY_EVASIVE_MANEUVERS 50240 //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. //you do not have acces to until you kill Mage-Lord Urom #define SPELL_RUBY_MARTYR 50253 //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. - /*Amber Drake, (npc 27755) (item 37859) (summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755) @@ -46,12 +39,10 @@ update creature_template set scriptname = '' where entry = ''; #define NPC_AMBER_DRAKE_VEHICLE 27755 #define SPELL_RIDE_AMBER_DRAKE_QUE 49459 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460 #define SPELL_AMBER_DRAKE_SADDLE 49460 //Allows you to ride on the back of an Amber Drake. ---> Dummy - #define SPELL_AMBER_SHOCK_LANCE 49840 //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. #define SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. //you do not have access to until you kill the Mage-Lord Urom. #define SPELL_AMBER_TEMPORAL_RIFT 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15,000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. - /*Emerald Drake, (npc 27692) (item 37815), (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) @@ -59,18 +50,14 @@ update creature_template set scriptname = '' where entry = ''; #define NPC_EMERALD_DRAKE_VEHICLE 27692 #define SPELL_RIDE_EMERALD_DRAKE_QUE 49427 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346 #define SPELL_EMERALD_DRAKE_SADDLE 49346 //Allows you to ride on the back of an Amber Drake. ---> Dummy - #define SPELL_EMERALD_LEECHING_POISON 50328 //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. #define SPELL_EMERALD_TOUCH_THE_NIGHTMARE 50341 //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25,000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. // you do not have access to until you kill the Mage-Lord Urom #define SPELL_EMERALD_DREAM_FUNNEL 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. - struct TRINITY_DLL_DECL boss_eregosAI : public ScriptedAI { boss_eregosAI(Creature *c) : ScriptedAI(c) {} - uint32 phase; - void Reset() {} void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} @@ -80,23 +67,18 @@ struct TRINITY_DLL_DECL boss_eregosAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - phase =1; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) {} }; - CreatureAI* GetAI_boss_eregos(Creature* pCreature) { return new boss_eregosAI (pCreature); } - void AddSC_boss_eregos() { Script *newscript; - newscript = new Script; newscript->Name = "boss_eregos"; newscript->GetAI = &GetAI_boss_eregos; diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_urom.cpp b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_urom.cpp index 0693b74b9f1..52670dc9bc9 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_urom.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_urom.cpp @@ -5,12 +5,10 @@ SD%Complete: 1% SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_ARCANE_SHIELD 53813 //Dummy --> Channeled, shields the caster from damage. #define SPELL_EMPOWERED_ARCANE_EXPLOSION 51110 @@ -22,7 +20,6 @@ update creature_template set scriptname = '' where entry = ''; #define SPELL_TELEPORT 51112 //Teleports to the center of Oculus #define SPELL_TIME_BOMB 51121 //Deals arcane damage to a random player, and after 6 seconds, deals zone damage to nearby equal to the health missing of the target afflicted by the debuff. #define SPELL_TIME_BOMB_2 59376 - //not in db //Yell #define SAY_AGGRO -1578012 @@ -35,11 +32,9 @@ update creature_template set scriptname = '' where entry = ''; #define SAY_SUMMON_1 -1578019 #define SAY_SUMMON_2 -1578020 #define SAY_SUMMON_3 -1578021 - struct TRINITY_DLL_DECL boss_uromAI : public ScriptedAI { boss_uromAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) { @@ -52,7 +47,6 @@ struct TRINITY_DLL_DECL boss_uromAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -66,16 +60,13 @@ struct TRINITY_DLL_DECL boss_uromAI : public ScriptedAI DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), m_creature); } }; - CreatureAI* GetAI_boss_urom(Creature* pCreature) { return new boss_uromAI (pCreature); } - void AddSC_boss_urom() { Script *newscript; - newscript = new Script; newscript->Name = "boss_urom"; newscript->GetAI = &GetAI_boss_urom; diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_varos.cpp b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_varos.cpp index 0ccd453e4d2..b2d4c201eba 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_varos.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/boss_varos.cpp @@ -5,12 +5,10 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" - //Spells #define SPELL_ENERGIZE_CORES 50785 //Damage 5938 to 6562, effec2 Triggers 54069, effect3 Triggers 56251 #define SPELL_ENERGIZE_CORES_TRIGGER_1 54069 @@ -22,7 +20,6 @@ update creature_template set scriptname = '' where entry = ''; #define SPELL_CALL_AZURE_RING_CAPTAIN_4 51008 //Effect Send Event (18455) #define SPELL_CALL_AMPLIFY_MAGIC 51054 #define SPELL_CALL_AMPLIFY_MAGIC_2 59371 - //not in db //Yell #define SAY_AGGRO -1578022 @@ -34,11 +31,9 @@ update creature_template set scriptname = '' where entry = ''; #define SAY_STRIKE_3 -1578028 #define SAY_SPAWN -1578029 - struct TRINITY_DLL_DECL boss_varosAI : public ScriptedAI { boss_varosAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit* who) { @@ -51,7 +46,6 @@ struct TRINITY_DLL_DECL boss_varosAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -65,16 +59,13 @@ struct TRINITY_DLL_DECL boss_varosAI : public ScriptedAI DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } }; - CreatureAI* GetAI_boss_varos(Creature* pCreature) { return new boss_varosAI (pCreature); } - void AddSC_boss_varos() { Script *newscript; - newscript = new Script; newscript->Name = "boss_varos"; newscript->GetAI = &GetAI_boss_varos; diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/def_oculus.h b/src/bindings/scripts/scripts/northrend/nexus/oculus/def_oculus.h index 0b63a52d866..d1924db70bc 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/def_oculus.h +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/def_oculus.h @@ -1,4 +1,3 @@ #ifndef DEF_OCULUS_H #define DEF_OCULUS_H - #endif diff --git a/src/bindings/scripts/scripts/northrend/nexus/oculus/instance_oculus.cpp b/src/bindings/scripts/scripts/northrend/nexus/oculus/instance_oculus.cpp index b5ceee9e5ed..834c222c895 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/oculus/instance_oculus.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/oculus/instance_oculus.cpp @@ -1,16 +1,13 @@ #include "precompiled.h" #include "def_oculus.h" - struct TRINITY_DLL_DECL instance_oculus : public ScriptedInstance { instance_oculus(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; }; - InstanceData* GetInstanceData_instance_oculus(Map* pMap) { return new instance_oculus(pMap); } - void AddSC_instance_oculus() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp index f13372af22d..b32ca88b337 100644 --- a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp +++ b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss Sartharion SD%Complete: 70% SDComment: Flame wave, achievement and portal events need to be implemented SDCategory: Obsidian Sanctum EndScriptData */ - #include "precompiled.h" #include "def_obsidian_sanctum.h" - enum eEnums { //Sartharion Yell @@ -41,14 +38,11 @@ enum eEnums SAY_SARTHARION_SLAY_1 = -1615029, SAY_SARTHARION_SLAY_2 = -1615030, SAY_SARTHARION_SLAY_3 = -1615031, - WHISPER_LAVA_CHURN = -1615032, - WHISPER_SHADRON_DICIPLE = -1615008, WHISPER_VESPERON_DICIPLE = -1615041, WHISPER_HATCH_EGGS = -1615017, WHISPER_OPEN_PORTAL = -1615042, // whisper, shared by two dragons - //Sartharion Spells SPELL_BERSERK = 61632, // Increases the caster's attack speed by 150% and all damage it deals by 500% for 5 min. SPELL_CLEAVE = 56909, // Inflicts 35% weapon damage to an enemy and its nearest allies, affecting up to 10 targets. @@ -59,92 +53,74 @@ enum eEnums SPELL_WILL_OF_SARTHARION = 61254, // Sartharion's presence bolsters the resolve of the Twilight Drakes, increasing their total health by 25%. This effect also increases Sartharion's health by 25%. SPELL_LAVA_STRIKE = 57571, // (Real spell casted should be 57578) 57571 then trigger visual missile, then summon Lava Blaze on impact(spell 57572) SPELL_TWILIGHT_REVENGE = 60639, - SPELL_PYROBUFFET = 56916, // currently used for hard enrage after 15 minutes SPELL_PYROBUFFET_RANGE = 58907, // possibly used when player get too far away from dummy creatures (2x Creature entry 30494) - SPELL_TWILIGHT_SHIFT_ENTER = 57620, // enter phase. Player get this when click GO SPELL_TWILIGHT_SHIFT_REMOVAL = 61187, // leave phase SPELL_TWILIGHT_SHIFT_REMOVAL_ALL = 61190, // leave phase (probably version to make all leave) - //Mini bosses common spells SPELL_TWILIGHT_RESIDUE = 61885, // makes immune to shadow damage, applied when leave phase - //Miniboses (Vesperon, Shadron, Tenebron) SPELL_SHADOW_BREATH_H = 59126, // Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster. SPELL_SHADOW_BREATH = 57570, // Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster. - SPELL_SHADOW_FISSURE_H = 59127, // Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec. SPELL_SHADOW_FISSURE = 57579, // Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec. - //Vesperon //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times NPC_ACOLYTE_OF_VESPERON = 31219, // Acolyte of Vesperon SPELL_POWER_OF_VESPERON = 61251, // Vesperon's presence decreases the maximum health of all enemies by 25%. SPELL_TWILIGHT_TORMENT_VESP = 57948, // (Shadow only) trigger 57935 then 57988 SPELL_TWILIGHT_TORMENT_VESP_ACO = 58853, // (Fire and Shadow) trigger 58835 then 57988 - //Shadron //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times NPC_ACOLYTE_OF_SHADRON = 31218, // Acolyte of Shadron SPELL_POWER_OF_SHADRON = 58105, // Shadron's presence increases Fire damage taken by all enemies by 100%. SPELL_GIFT_OF_TWILIGTH_SHA = 57835, // TARGET_SCRIPT shadron SPELL_GIFT_OF_TWILIGTH_SAR = 58766, // TARGET_SCRIPT sartharion - //Tenebron //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708 SPELL_POWER_OF_TENEBRON = 61248, // Tenebron's presence increases Shadow damage taken by all enemies by 100%. //Tenebron, dummy spell SPELL_SUMMON_TWILIGHT_WHELP = 58035, // doesn't work, will spawn NPC_TWILIGHT_WHELP SPELL_SUMMON_SARTHARION_TWILIGHT_WHELP = 58826, // doesn't work, will spawn NPC_SHARTHARION_TWILIGHT_WHELP - SPELL_HATCH_EGGS_H = 59189, SPELL_HATCH_EGGS = 58542, SPELL_HATCH_EGGS_EFFECT_H = 59190, SPELL_HATCH_EGGS_EFFECT = 58685, - //Whelps NPC_TWILIGHT_WHELP = 30890, NPC_SHARTHARION_TWILIGHT_WHELP = 31214, SPELL_FADE_ARMOR = 60708, // Reduces the armor of an enemy by 1500 for 15s - //flame tsunami SPELL_FLAME_TSUNAMI = 57494, // the visual dummy SPELL_FLAME_TSUNAMI_LEAP = 60241, // SPELL_EFFECT_138 some leap effect, causing caster to move in direction SPELL_FLAME_TSUNAMI_DMG_AURA = 57492, // periodic damage, npc has this aura - NPC_FLAME_TSUNAMI = 30616, // for the flame waves NPC_LAVA_BLAZE = 30643, // adds spawning from flame strike - //using these custom points for dragons start and end POINT_ID_INIT = 100, POINT_ID_LAND = 200 }; - struct Waypoint { float m_fX, m_fY, m_fZ; }; - //each dragons special points. First where fly to before connect to connon, second where land point is. Waypoint m_aTene[]= { {3212.854, 575.597, 109.856}, //init {3246.425, 565.367, 61.249} //end }; - Waypoint m_aShad[]= { {3293.238, 472.223, 106.968}, {3271.669, 526.907, 61.931} }; - Waypoint m_aVesp[]= { {3193.310, 472.861, 102.697}, {3227.268, 533.238, 59.995} }; - #define MAX_WAYPOINT 6 //points around raid "isle", counter clockwise. should probably be adjusted to be more alike Waypoint m_aDragonCommon[MAX_WAYPOINT]= @@ -156,11 +132,9 @@ Waypoint m_aDragonCommon[MAX_WAYPOINT]= {3250.479, 585.827, 98.652}, {3209.969, 566.523, 98.652} }; - /*###### ## Boss Sartharion ######*/ - struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI { boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature) @@ -168,143 +142,111 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; bool m_bIsHeroic; - bool m_bIsBerserk; bool m_bIsSoftEnraged; - uint32 m_uiEnrageTimer; bool m_bIsHardEnraged; - uint32 m_uiTenebronTimer; uint32 m_uiShadronTimer; uint32 m_uiVesperonTimer; - uint32 m_uiFlameTsunamiTimer; uint32 m_uiFlameBreathTimer; uint32 m_uiTailSweepTimer; uint32 m_uiCleaveTimer; uint32 m_uiLavaStrikeTimer; - bool m_bHasCalledTenebron; bool m_bHasCalledShadron; bool m_bHasCalledVesperon; - void Reset() { m_bIsBerserk = false; m_bIsSoftEnraged = false; - m_uiEnrageTimer = 15*MINUTE*IN_MILISECONDS; m_bIsHardEnraged = false; - m_uiTenebronTimer = 30000; m_uiShadronTimer = 75000; m_uiVesperonTimer = 120000; - m_uiFlameTsunamiTimer = 30000; m_uiFlameBreathTimer = 20000; m_uiTailSweepTimer = 20000; m_uiCleaveTimer = 7000; m_uiLavaStrikeTimer = 5000; - m_bHasCalledTenebron = false; m_bHasCalledShadron = false; m_bHasCalledVesperon = false; - if (m_creature->HasAura(SPELL_TWILIGHT_REVENGE)) m_creature->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); } - void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); } - void Aggro(Unit* pWho) { DoScriptText(SAY_SARTHARION_AGGRO,m_creature); DoZoneInCombat(); - if (m_pInstance) { m_pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); FetchDragons(); } } - void JustDied(Unit* pKiller) { DoScriptText(SAY_SARTHARION_DEATH,m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_SARTHARION_EVENT, DONE); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SARTHARION_SLAY_1,SAY_SARTHARION_SLAY_2,SAY_SARTHARION_SLAY_3), m_creature); } - void FetchDragons() { Unit* pTene = Unit::GetUnit(*m_creature, m_pInstance->GetData64(DATA_TENEBRON)); Unit* pShad = Unit::GetUnit(*m_creature, m_pInstance->GetData64(DATA_SHADRON)); Unit* pVesp = Unit::GetUnit(*m_creature, m_pInstance->GetData64(DATA_VESPERON)); - //if at least one of the dragons are alive and are being called bool bCanUseWill = false; - if (pTene && pTene->isAlive() && !pTene->getVictim()) { bCanUseWill = true; pTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); - if (!pTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) pTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - if (pShad && pShad->isAlive() && !pShad->getVictim()) { bCanUseWill = true; pShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); - if (!pShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) pShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - if (pVesp && pVesp->isAlive() && !pVesp->getVictim()) { bCanUseWill = true; pVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); - if (!pVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) pVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - if (bCanUseWill) DoCast(m_creature, SPELL_WILL_OF_SARTHARION); } - void CallDragon(uint32 uiDataId) { if (m_pInstance) { Creature* pTemp = Unit::GetCreature((*m_creature),m_pInstance->GetData64(uiDataId)); - if (pTemp && pTemp->isAlive() && !pTemp->getVictim()) { if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - int32 iTextId = 0; - switch(pTemp->GetEntry()) { case NPC_TENEBRON: @@ -320,20 +262,16 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); break; } - DoScriptText(iTextId, m_creature); } } } - void SendFlameTsunami() { Map* pMap = m_creature->GetMap(); - if (pMap && pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) @@ -344,17 +282,14 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - Unit* pTene = Unit::GetUnit(*m_creature, m_pInstance ? m_pInstance->GetData64(DATA_TENEBRON) : 0); Unit* pShad = Unit::GetUnit(*m_creature, m_pInstance ? m_pInstance->GetData64(DATA_SHADRON) : 0); Unit* pVesp = Unit::GetUnit(*m_creature, m_pInstance ? m_pInstance->GetData64(DATA_VESPERON) : 0); - //spell will target dragons, if they are still alive at 35% if (!m_bIsBerserk && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 35 && ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive()))) @@ -363,14 +298,12 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK); m_bIsBerserk = true; } - //soft enrage if (!m_bIsSoftEnraged && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 10) { // TODO m_bIsSoftEnraged = true; } - // hard enrage if (!m_bIsHardEnraged) { @@ -382,7 +315,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI else m_uiEnrageTimer -= uiDiff; } - // flame tsunami if (m_uiFlameTsunamiTimer < uiDiff) { @@ -391,7 +323,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiFlameTsunamiTimer -= uiDiff; - // flame breath if (m_uiFlameBreathTimer < uiDiff) { @@ -401,7 +332,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiFlameBreathTimer -= uiDiff; - // Tail Sweep if (m_uiTailSweepTimer < uiDiff) { @@ -410,7 +340,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiTailSweepTimer -= uiDiff; - // Cleave if (m_uiCleaveTimer < uiDiff) { @@ -419,14 +348,12 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiCleaveTimer -= uiDiff; - // Lavas Strike if (m_uiLavaStrikeTimer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoCast(pTarget, SPELL_LAVA_STRIKE); - if(urand(0,4) == 4) DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), m_creature); } @@ -434,7 +361,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiLavaStrikeTimer -= uiDiff; - // call tenebron if (!m_bHasCalledTenebron && m_uiTenebronTimer < uiDiff) { @@ -443,7 +369,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiTenebronTimer -= uiDiff; - // call shadron if (!m_bHasCalledShadron && m_uiShadronTimer < uiDiff) { @@ -452,7 +377,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiShadronTimer -= uiDiff; - // call vesperon if (!m_bHasCalledVesperon && m_uiVesperonTimer < uiDiff) { @@ -461,18 +385,14 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI } else m_uiVesperonTimer -= uiDiff; - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(uiDiff); } }; - CreatureAI* GetAI_boss_sartharion(Creature* pCreature) { return new boss_sartharionAI(pCreature); } - enum TeneText { SAY_TENEBRON_AGGRO = -1615009, @@ -484,7 +404,6 @@ enum TeneText SAY_TENEBRON_SPECIAL_1 = -1615015, SAY_TENEBRON_SPECIAL_2 = -1615016 }; - enum ShadText { SAY_SHADRON_AGGRO = -1615000, @@ -496,7 +415,6 @@ enum ShadText SAY_SHADRON_SPECIAL_1 = -1615006, SAY_SHADRON_SPECIAL_2 = -1615007 }; - enum VespText { SAY_VESPERON_AGGRO = -1615033, @@ -508,7 +426,6 @@ enum VespText SAY_VESPERON_SPECIAL_1 = -1615039, SAY_VESPERON_SPECIAL_2 = -1615040 }; - //to control each dragons common abilities struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI { @@ -517,40 +434,32 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; bool m_bIsHeroic; - uint32 m_uiWaypointId; uint32 m_uiMoveNextTimer; int32 m_iPortalRespawnTime; bool m_bCanMoveFree; - void Reset() { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_uiWaypointId = 0; m_uiMoveNextTimer = 500; m_iPortalRespawnTime = 30000; m_bCanMoveFree = false; } - void MovementInform(uint32 uiType, uint32 uiPointId) { if (!m_pInstance || uiType != POINT_MOTION_TYPE) return; - debug_log("dummy_dragonAI: %s reached point %u", m_creature->GetName(), uiPointId); - //if healers messed up the raid and we was already initialized if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) { EnterEvadeMode(); return; } - //this is end, if we reach this, don't do much if (uiPointId == POINT_ID_LAND) { @@ -558,34 +467,26 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI m_bCanMoveFree = false; return; } - //get amount of common points uint32 uiCommonWPCount = sizeof(m_aDragonCommon)/sizeof(Waypoint); - //increase m_uiWaypointId = uiPointId+1; - //if we have reached a point bigger or equal to count, it mean we must reset to point 0 if (m_uiWaypointId >= uiCommonWPCount) { if (!m_bCanMoveFree) m_bCanMoveFree = true; - m_uiWaypointId = 0; } - m_uiMoveNextTimer = 500; } - //used when open portal and spawn mobs in phase void DoRaidWhisper(int32 iTextId) { Map* pMap = m_creature->GetMap(); - if (pMap && pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) @@ -593,18 +494,14 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI } } } - //"opens" the portal and does the "opening" whisper void OpenPortal() { int32 iTextId = 0; - //there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database - //using a grid search here seem to be more efficient than caching all four guids //in instance script and calculate range to each. GameObject* pPortal = m_creature->FindNearestGameObject(GO_TWILIGHT_PORTAL,50.0f); - switch(m_creature->GetEntry()) { case NPC_TENEBRON: @@ -615,30 +512,23 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI iTextId = WHISPER_OPEN_PORTAL; break; } - DoRaidWhisper(iTextId); - //By using SetRespawnTime() we will actually "spawn" the object with our defined time. //Once time is up, portal will disappear again. if (pPortal && !pPortal->isSpawned()) pPortal->SetRespawnTime(m_iPortalRespawnTime); - //Unclear what are expected to happen if one drake has a portal open already //Refresh respawnTime so time again are set to 30secs? } - //Removes each drakes unique debuff from players void RemoveDebuff(uint32 uiSpellId) { Map* pMap = m_creature->GetMap(); - if (pMap && pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive() && i->getSource()->HasAura(uiSpellId)) @@ -646,12 +536,10 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI } } } - void JustDied(Unit* pKiller) { int32 iTextId = 0; uint32 uiSpellId = 0; - switch(m_creature->GetEntry()) { case NPC_TENEBRON: @@ -667,24 +555,19 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI uiSpellId = SPELL_POWER_OF_VESPERON; break; } - DoScriptText(iTextId, m_creature); - RemoveDebuff(uiSpellId); - if (m_pInstance) { // not if solo mini-boss fight if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) return; - // Twilight Revenge to main boss if (Unit* pSartharion = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_SARTHARION))) if (pSartharion->isAlive()) m_creature->CastSpell(pSartharion,SPELL_TWILIGHT_REVENGE,true); } } - void UpdateAI(const uint32 uiDiff) { if (m_bCanMoveFree && m_uiMoveNextTimer) @@ -694,7 +577,6 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI if(m_uiWaypointId < MAX_WAYPOINT) m_creature->GetMotionMaster()->MovePoint(m_uiWaypointId, m_aDragonCommon[m_uiWaypointId].m_fX, m_aDragonCommon[m_uiWaypointId].m_fY, m_aDragonCommon[m_uiWaypointId].m_fZ); - debug_log("dummy_dragonAI: %s moving to point %u", m_creature->GetName(), m_uiWaypointId); m_uiMoveNextTimer = 0; } @@ -703,38 +585,31 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI } } }; - /*###### ## Mob Tenebron ######*/ - struct TRINITY_DLL_DECL mob_tenebronAI : public dummy_dragonAI { mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } - uint32 m_uiShadowBreathTimer; uint32 m_uiShadowFissureTimer; uint32 m_uiHatchEggTimer; - void Reset() { m_uiShadowBreathTimer = 20000; m_uiShadowFissureTimer = 5000; m_uiHatchEggTimer = 30000; } - void Aggro(Unit* pWho) { DoScriptText(SAY_TENEBRON_AGGRO, m_creature); DoZoneInCombat(); DoCast(m_creature, SPELL_POWER_OF_TENEBRON); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_TENEBRON_SLAY_1,SAY_TENEBRON_SLAY_2), m_creature); } - void UpdateAI(const uint32 uiDiff) { //if no target, update dummy and return @@ -743,18 +618,15 @@ struct TRINITY_DLL_DECL mob_tenebronAI : public dummy_dragonAI dummy_dragonAI::UpdateAI(uiDiff); return; } - // shadow fissure if (m_uiShadowFissureTimer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE); - m_uiShadowFissureTimer = urand(15000,20000); } else m_uiShadowFissureTimer -= uiDiff; - // shadow breath if (m_uiShadowBreathTimer < uiDiff) { @@ -764,53 +636,42 @@ struct TRINITY_DLL_DECL mob_tenebronAI : public dummy_dragonAI } else m_uiShadowBreathTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_tenebron(Creature* pCreature) { return new mob_tenebronAI(pCreature); } - /*###### ## Mob Shadron ######*/ - struct TRINITY_DLL_DECL mob_shadronAI : public dummy_dragonAI { mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } - uint32 m_uiShadowBreathTimer; uint32 m_uiShadowFissureTimer; uint32 m_uiAcolyteShadronTimer; - void Reset() { m_uiShadowBreathTimer = 20000; m_uiShadowFissureTimer = 5000; m_uiAcolyteShadronTimer = 60000; - if (m_creature->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) m_creature->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - if (m_creature->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) m_creature->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); } - void Aggro(Unit* pWho) { DoScriptText(SAY_SHADRON_AGGRO,m_creature); DoZoneInCombat(); DoCast(m_creature, SPELL_POWER_OF_SHADRON); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SHADRON_SLAY_1,SAY_SHADRON_SLAY_2), m_creature); } - void UpdateAI(const uint32 uiDiff) { //if no target, update dummy and return @@ -819,18 +680,15 @@ struct TRINITY_DLL_DECL mob_shadronAI : public dummy_dragonAI dummy_dragonAI::UpdateAI(uiDiff); return; } - // shadow fissure if (m_uiShadowFissureTimer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE); - m_uiShadowFissureTimer = urand(15000,20000); } else m_uiShadowFissureTimer -= uiDiff; - // shadow breath if (m_uiShadowBreathTimer < uiDiff) { @@ -840,47 +698,38 @@ struct TRINITY_DLL_DECL mob_shadronAI : public dummy_dragonAI } else m_uiShadowBreathTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_shadron(Creature* pCreature) { return new mob_shadronAI(pCreature); } - /*###### ## Mob Vesperon ######*/ - struct TRINITY_DLL_DECL mob_vesperonAI : public dummy_dragonAI { mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } - uint32 m_uiShadowBreathTimer; uint32 m_uiShadowFissureTimer; uint32 m_uiAcolyteVesperonTimer; - void Reset() { m_uiShadowBreathTimer = 20000; m_uiShadowFissureTimer = 5000; m_uiAcolyteVesperonTimer = 60000; } - void Aggro(Unit* pWho) { DoScriptText(SAY_VESPERON_AGGRO,m_creature); DoZoneInCombat(); DoCast(m_creature, SPELL_POWER_OF_VESPERON); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_VESPERON_SLAY_1,SAY_VESPERON_SLAY_2), m_creature); } - void UpdateAI(const uint32 uiDiff) { //if no target, update dummy and return @@ -889,18 +738,15 @@ struct TRINITY_DLL_DECL mob_vesperonAI : public dummy_dragonAI dummy_dragonAI::UpdateAI(uiDiff); return; } - // shadow fissure if (m_uiShadowFissureTimer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE); - m_uiShadowFissureTimer = urand(15000,20000); } else m_uiShadowFissureTimer -= uiDiff; - // shadow breath if (m_uiShadowBreathTimer < uiDiff) { @@ -910,29 +756,23 @@ struct TRINITY_DLL_DECL mob_vesperonAI : public dummy_dragonAI } else m_uiShadowBreathTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_vesperon(Creature* pCreature) { return new mob_vesperonAI(pCreature); } - /*###### ## Mob Acolyte of Shadron ######*/ - struct TRINITY_DLL_DECL mob_acolyte_of_shadronAI : public ScriptedAI { mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - void Reset() { if (m_pInstance) @@ -944,18 +784,15 @@ struct TRINITY_DLL_DECL mob_acolyte_of_shadronAI : public ScriptedAI DoCast(m_creature, SPELL_GIFT_OF_TWILIGTH_SHA); } } - void JustDied(Unit* killer) { if (m_pInstance) { Creature* pDebuffTarget = NULL; - if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) { //not solo fight, so main boss has deduff pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SARTHARION)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); } @@ -963,116 +800,91 @@ struct TRINITY_DLL_DECL mob_acolyte_of_shadronAI : public ScriptedAI { //event not in progress, then solo fight and must remove debuff mini-boss pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SHADRON)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); } } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_acolyte_of_shadron(Creature* pCreature) { return new mob_acolyte_of_shadronAI(pCreature); } - /*###### ## Mob Acolyte of Vesperon ######*/ - struct TRINITY_DLL_DECL mob_acolyte_of_vesperonAI : public ScriptedAI { mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - void Reset() { DoCast(m_creature, SPELL_TWILIGHT_TORMENT_VESP_ACO); } - void JustDied(Unit* pKiller) { // remove twilight torment on Vesperon if (m_pInstance) { Creature* pVesperon = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_VESPERON)); - if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_acolyte_of_vesperon(Creature* pCreature) { return new mob_acolyte_of_vesperonAI(pCreature); } - /*###### ## Mob Twilight Eggs ######*/ - struct TRINITY_DLL_DECL mob_twilight_eggsAI : public ScriptedAI { mob_twilight_eggsAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 m_uiFadeArmorTimer; - void Reset() { m_uiFadeArmorTimer = 1000; } - void AttackStart(Unit* pWho) { } void MoveInLineOfSight(Unit* pWho) { } }; - CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature) { return new mob_twilight_eggsAI(pCreature); } - /*###### ## Mob Twilight Whelps ######*/ - struct TRINITY_DLL_DECL mob_twilight_whelpAI : public ScriptedAI { mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 m_uiFadeArmorTimer; - void Reset() { m_uiFadeArmorTimer = 1000; } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - // twilight torment if (m_uiFadeArmorTimer < uiDiff) { @@ -1081,55 +893,44 @@ struct TRINITY_DLL_DECL mob_twilight_whelpAI : public ScriptedAI } else m_uiFadeArmorTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_twilight_whelp(Creature* pCreature) { return new mob_twilight_whelpAI(pCreature); } - void AddSC_boss_sartharion() { Script *newscript; - newscript = new Script; newscript->Name = "boss_sartharion"; newscript->GetAI = &GetAI_boss_sartharion; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_vesperon"; newscript->GetAI = &GetAI_mob_vesperon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadron"; newscript->GetAI = &GetAI_mob_shadron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_tenebron"; newscript->GetAI = &GetAI_mob_tenebron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_acolyte_of_shadron"; newscript->GetAI = &GetAI_mob_acolyte_of_shadron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_acolyte_of_vesperon"; newscript->GetAI = &GetAI_mob_acolyte_of_vesperon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_twilight_eggs"; newscript->GetAI = &GetAI_mob_twilight_eggs; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_twilight_whelp"; newscript->GetAI = &GetAI_mob_twilight_whelp; diff --git a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/def_obsidian_sanctum.h b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/def_obsidian_sanctum.h index 59013174795..053ca56c8cb 100644 --- a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/def_obsidian_sanctum.h +++ b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/def_obsidian_sanctum.h @@ -1,20 +1,16 @@ #ifndef DEF_OBSIDIAN_SANCTUM_H #define DEF_OBSIDIAN_SANCTUM_H - enum eTypes { TYPE_SARTHARION_EVENT = 1, - DATA_SARTHARION = 10, DATA_TENEBRON = 11, DATA_SHADRON = 12, DATA_VESPERON = 13, - NPC_SARTHARION = 28860, NPC_TENEBRON = 30452, NPC_SHADRON = 30451, NPC_VESPERON = 30449, GO_TWILIGHT_PORTAL = 193988 }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/instance_obsidian_sanctum.cpp b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/instance_obsidian_sanctum.cpp index 5dd3e06e585..95ec22db002 100644 --- a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/instance_obsidian_sanctum.cpp +++ b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/instance_obsidian_sanctum.cpp @@ -1,32 +1,25 @@ #include "precompiled.h" #include "def_obsidian_sanctum.h" - #define MAX_ENCOUNTER 1 - /* Obsidian Sanctum encounters: 0 - Sartharion */ - struct TRINITY_DLL_DECL instance_obsidian_sanctum : public ScriptedInstance { instance_obsidian_sanctum(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint64 m_uiSartharionGUID; uint64 m_uiTenebronGUID; uint64 m_uiShadronGUID; uint64 m_uiVesperonGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiSartharionGUID = 0; m_uiTenebronGUID = 0; m_uiShadronGUID = 0; m_uiVesperonGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -50,21 +43,17 @@ struct TRINITY_DLL_DECL instance_obsidian_sanctum : public ScriptedInstance break; } } - void SetData(uint32 uiType, uint32 uiData) { if (uiType == TYPE_SARTHARION_EVENT) m_auiEncounter[0] = uiData; } - uint32 GetData(uint32 uiType) { if (uiType == TYPE_SARTHARION_EVENT) return m_auiEncounter[0]; - return 0; } - uint64 GetData64(uint32 uiData) { switch(uiData) @@ -81,12 +70,10 @@ struct TRINITY_DLL_DECL instance_obsidian_sanctum : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_obsidian_sanctum(Map* pMap) { return new instance_obsidian_sanctum(pMap); } - void AddSC_instance_obsidian_sanctum() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp index 0a4421683a3..c715f2e4a11 100644 --- a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp +++ b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp @@ -14,46 +14,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Sholazar_Basin SD%Complete: 100 SDComment: Quest support: 12570, 12573, 12621. SDCategory: Sholazar_Basin EndScriptData */ - /* ContentData npc_injured_rainspeaker_oracle npc_vekjik avatar_of_freya EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_injured_rainspeaker_oracle ######*/ - #define GOSSIP_ITEM1 "I am ready to travel to your village now." - enum eRainspeaker { SAY_START_IRO = -1571000, SAY_QUEST_ACCEPT_IRO = -1571001, SAY_END_IRO = -1571002, - QUEST_FORTUNATE_MISUNDERSTANDINGS = 12570, FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI { npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); } - uint64 c_guid; - void Reset() { me->RestoreFaction(); @@ -64,14 +54,11 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 1: SetRun(); break; @@ -101,12 +88,10 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI break; } } - void JustDied(Unit* killer) { if (!HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) @@ -115,20 +100,15 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI } }; - bool GossipHello_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -137,7 +117,6 @@ bool GossipSelect_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCre CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(35.0f); pCreature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); DoScriptText(SAY_START_IRO, pCreature); - switch (pPlayer->GetTeam()){ case ALLIANCE: pCreature->setFaction(FACTION_ESCORTEE_A); @@ -149,53 +128,41 @@ bool GossipSelect_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCre } return true; } - bool QuestAccept_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCreature, Quest const *_Quest) { DoScriptText(SAY_QUEST_ACCEPT_IRO, pCreature); return false; } - CreatureAI* GetAI_npc_injured_rainspeaker_oracle(Creature* pCreature) { return new npc_injured_rainspeaker_oracleAI(pCreature); } - /*###### ## npc_vekjik ######*/ - #define GOSSIP_VEKJIK_ITEM1 "Shaman Vekjik, I have spoken with the big-tongues and they desire peace. I have brought this offering on their behalf." #define GOSSIP_VEKJIK_ITEM2 "No no... I had no intentions of betraying your people. I was only defending myself. it was all a misunderstanding." - enum eVekjik { GOSSIP_TEXTID_VEKJIK1 = 13137, GOSSIP_TEXTID_VEKJIK2 = 13138, - SAY_TEXTID_VEKJIK1 = -1000208, - SPELL_FREANZYHEARTS_FURY = 51469, - QUEST_MAKING_PEACE = 12573 }; - bool GossipHello_npc_vekjik(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_MAKING_PEACE) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VEKJIK1, pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_vekjik(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -211,43 +178,33 @@ bool GossipSelect_npc_vekjik(Player* pPlayer, Creature* pCreature, uint32 uiSend pCreature->CastSpell(pPlayer, SPELL_FREANZYHEARTS_FURY, false); break; } - return true; } - /*###### ## avatar_of_freya ######*/ - #define GOSSIP_ITEM_AOF1 "I want to stop the Scourge as much as you do. How can I help?" #define GOSSIP_ITEM_AOF2 "You can trust me. I am no friend of the Lich King." #define GOSSIP_ITEM_AOF3 "I will not fail." - enum eFreya { QUEST_FREYA_PACT = 12621, - SPELL_FREYA_CONVERSATION = 52045, - GOSSIP_TEXTID_AVATAR1 = 13303, GOSSIP_TEXTID_AVATAR2 = 13304, GOSSIP_TEXTID_AVATAR3 = 13305 }; - bool GossipHello_npc_avatar_of_freya(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_FREYA_PACT) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR1, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_avatar_of_freya(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -267,7 +224,6 @@ bool GossipSelect_npc_avatar_of_freya(Player* pPlayer, Creature* pCreature, uint } return true; } - void AddSC_sholazar_basin() { Script *newscript; @@ -278,13 +234,11 @@ void AddSC_sholazar_basin() newscript->pGossipSelect = &GossipSelect_npc_injured_rainspeaker_oracle; newscript->pQuestAccept = &QuestAccept_npc_injured_rainspeaker_oracle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_vekjik"; newscript->pGossipHello = &GossipHello_npc_vekjik; newscript->pGossipSelect = &GossipSelect_npc_vekjik; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_avatar_of_freya"; newscript->pGossipHello = &GossipHello_npc_avatar_of_freya; diff --git a/src/bindings/scripts/scripts/northrend/storm_peaks.cpp b/src/bindings/scripts/scripts/northrend/storm_peaks.cpp index 473fca5aa71..39b9a599d83 100644 --- a/src/bindings/scripts/scripts/northrend/storm_peaks.cpp +++ b/src/bindings/scripts/scripts/northrend/storm_peaks.cpp @@ -14,47 +14,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" - /*###### ## npc_agnetta_tyrsdottar ######*/ - #define SAY_AGGRO -1571003 #define GOSSIP_AGNETTA "Skip the warmup, sister... or are you too scared to face soemeone your own size?" - enum eAgnetta { QUEST_ITS_THAT_YOUR_GOBLIN = 12969, FACTION_HOSTILE_AT1 = 45 }; - struct TRINITY_DLL_DECL npc_agnetta_tyrsdottarAI : public ScriptedAI { npc_agnetta_tyrsdottarAI(Creature* pCreature) : ScriptedAI(pCreature) { } - void Reset() { me->RestoreFaction(); } }; - CreatureAI* GetAI_npc_agnetta_tyrsdottar(Creature* pCreature) { return new npc_agnetta_tyrsdottarAI(pCreature); } - bool GossipHello_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_ITS_THAT_YOUR_GOBLIN) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AGNETTA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(13691, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction ) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -64,36 +54,28 @@ bool GossipSelect_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature, u pCreature->setFaction(FACTION_HOSTILE_AT1); pCreature->AI()->AttackStart(pPlayer); } - return true; } - /*###### ## npc_frostborn_scout ######*/ - #define GOSSIP_ITEM1 "Are you okay? I've come to take you back to Frosthold if you can stand." #define GOSSIP_ITEM2 "I'm sorry that I didn't get here sooner. What happened?" #define GOSSIP_ITEM3 "I'll go get some help. Hang in there." - enum eFrostbornScout { QUEST_MISSING_SCOUTS = 12864 }; - bool GossipHello_npc_frostborn_scout(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestStatus(QUEST_MISSING_SCOUTS) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->PlayerTalkClass->SendGossipMenu(13611, pCreature->GetGUID()); } - return true; } - bool GossipSelect_npc_frostborn_scout(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -111,19 +93,15 @@ bool GossipSelect_npc_frostborn_scout(Player* pPlayer, Creature* pCreature, uint pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_SCOUTS); break; } - return true; } - /*###### ## npc_thorim ######*/ - #define GOSSIP_HN "Thorim?" #define GOSSIP_SN1 "Can you tell me what became of Sif?" #define GOSSIP_SN2 "He did more than that, Thorim. He controls Ulduar now." #define GOSSIP_SN3 "It needn't end this way." - enum eThorim { QUEST_SIBLING_RIVALRY = 13064, @@ -133,12 +111,10 @@ enum eThorim GOSSIP_TEXTID_THORIM3 = 13802, GOSSIP_TEXTID_THORIM4 = 13803 }; - bool GossipHello_npc_thorim(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, pCreature->GetGUID()); @@ -146,7 +122,6 @@ bool GossipHello_npc_thorim(Player* pPlayer, Creature* pCreature) } return false; } - bool GossipSelect_npc_thorim(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -170,24 +145,20 @@ bool GossipSelect_npc_thorim(Player* pPlayer, Creature* pCreature, uint32 uiSend } return true; } - void AddSC_storm_peaks() { Script* newscript; - newscript = new Script; newscript->Name = "npc_agnetta_tyrsdottar"; newscript->GetAI = &GetAI_npc_agnetta_tyrsdottar; newscript->pGossipHello = &GossipHello_npc_agnetta_tyrsdottar; newscript->pGossipSelect = &GossipSelect_npc_agnetta_tyrsdottar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_frostborn_scout"; newscript->pGossipHello = &GossipHello_npc_frostborn_scout; newscript->pGossipSelect = &GossipSelect_npc_frostborn_scout; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_thorim"; newscript->pGossipHello = &GossipHello_npc_thorim; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_bjarngrim.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_bjarngrim.cpp index d2630dc2175..10c636d62ea 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_bjarngrim.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_bjarngrim.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss General Bjarngrim SD%Complete: 70% SDComment: Waypoint needed, we expect boss to always have 2x Stormforged Lieutenant following SDCategory: Halls of Lightning EndScriptData */ - #include "precompiled.h" #include "def_halls_of_lightning.h" - enum eEnums { //Yell @@ -38,47 +35,38 @@ enum eEnums EMOTE_BERSEKER_STANCE = -1602008, SAY_DEFENSIVE_STANCE = -1602009, EMOTE_DEFENSIVE_STANCE = -1602010, - SPELL_DEFENSIVE_STANCE = 53790, //SPELL_DEFENSIVE_AURA = 41105, SPELL_SPELL_REFLECTION = 36096, SPELL_PUMMEL = 12555, SPELL_KNOCK_AWAY = 52029, SPELL_IRONFORM = 52022, - SPELL_BERSEKER_STANCE = 53791, //SPELL_BERSEKER_AURA = 41107, SPELL_INTERCEPT = 58769, SPELL_WHIRLWIND = 52027, SPELL_CLEAVE = 15284, - SPELL_BATTLE_STANCE = 53792, //SPELL_BATTLE_AURA = 41106, SPELL_MORTAL_STRIKE = 16856, SPELL_SLAM = 52026, - //OTHER SPELLS //SPELL_CHARGE_UP = 52098, // only used when starting walk from one platform to the other //SPELL_TEMPORARY_ELECTRICAL_CHARGE = 52092, // triggered part of above - NPC_STORMFORGED_LIEUTENANT = 29240, SPELL_ARC_WELD = 59085, SPELL_RENEW_STEEL_N = 52774, SPELL_RENEW_STEEL_H = 59160, - EQUIP_SWORD = 37871, EQUIP_SHIELD = 35642, EQUIP_MACE = 43623, - STANCE_DEFENSIVE = 0, STANCE_BERSERKER = 1, STANCE_BATTLE = 2 }; - /*###### ## boss_bjarngrim ######*/ - struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI { boss_bjarngrimAI(Creature *pCreature) : ScriptedAI(pCreature) @@ -88,54 +76,39 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI m_uiStance = STANCE_DEFENSIVE; memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); } - ScriptedInstance* m_pInstance; - bool m_bIsHeroic; bool m_bIsChangingStance; - uint8 m_uiChargingStatus; uint8 m_uiStance; - uint32 m_uiCharge_Timer; uint32 m_uiChangeStance_Timer; - uint32 m_uiReflection_Timer; uint32 m_uiKnockAway_Timer; uint32 m_uiPummel_Timer; uint32 m_uiIronform_Timer; - uint32 m_uiIntercept_Timer; uint32 m_uiWhirlwind_Timer; uint32 m_uiCleave_Timer; - uint32 m_uiMortalStrike_Timer; uint32 m_uiSlam_Timer; - uint64 m_auiStormforgedLieutenantGUID[2]; - void Reset() { m_bIsChangingStance = false; - m_uiChargingStatus = 0; m_uiCharge_Timer = 1000; - m_uiChangeStance_Timer = 20000 + rand()%5000; - m_uiReflection_Timer = 8000; m_uiKnockAway_Timer = 20000; m_uiPummel_Timer = 10000; m_uiIronform_Timer = 25000; - m_uiIntercept_Timer = 5000; m_uiWhirlwind_Timer = 10000; m_uiCleave_Timer = 8000; - m_uiMortalStrike_Timer = 8000; m_uiSlam_Timer = 10000; - - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*m_creature), m_auiStormforgedLieutenantGUID[i]))) { @@ -143,44 +116,34 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI pStormforgedLieutenant->Respawn(); } } - if (m_uiStance != STANCE_DEFENSIVE) { DoRemoveStanceAura(m_uiStance); DoCast(m_creature, SPELL_DEFENSIVE_STANCE); m_uiStance = STANCE_DEFENSIVE; } - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - if (m_pInstance) m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); - //must get both lieutenants here and make sure they are with him m_creature->CallForHelp(30.0f); - if (m_pInstance) m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_BJARNGRIM, DONE); } - //TODO: remove when removal is done by mangos void DoRemoveStanceAura(uint8 uiStance) { @@ -197,29 +160,22 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI break; } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - // Change stance if (m_uiChangeStance_Timer < uiDiff) { //wait for current spell to finish before change stance if (m_creature->IsNonMeleeSpellCasted(false)) return; - DoRemoveStanceAura(m_uiStance); - int uiTempStance = rand()%(3-1); - if (uiTempStance >= m_uiStance) ++uiTempStance; - m_uiStance = uiTempStance; - switch(m_uiStance) { case STANCE_DEFENSIVE: @@ -241,13 +197,11 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); break; } - m_uiChangeStance_Timer = 20000 + rand()%5000; return; } else m_uiChangeStance_Timer -= uiDiff; - switch(m_uiStance) { case STANCE_DEFENSIVE: @@ -259,7 +213,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiReflection_Timer -= uiDiff; - if (m_uiKnockAway_Timer < uiDiff) { DoCast(m_creature, SPELL_KNOCK_AWAY); @@ -267,7 +220,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiKnockAway_Timer -= uiDiff; - if (m_uiPummel_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_PUMMEL); @@ -275,7 +227,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiPummel_Timer -= uiDiff; - if (m_uiIronform_Timer < uiDiff) { DoCast(m_creature, SPELL_IRONFORM); @@ -283,7 +234,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiIronform_Timer -= uiDiff; - break; } case STANCE_BERSERKER: @@ -296,7 +246,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiIntercept_Timer -= uiDiff; - if (m_uiWhirlwind_Timer < uiDiff) { DoCast(m_creature, SPELL_WHIRLWIND); @@ -304,7 +253,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiWhirlwind_Timer -= uiDiff; - if (m_uiCleave_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); @@ -312,7 +260,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiCleave_Timer -= uiDiff; - break; } case STANCE_BATTLE: @@ -324,7 +271,6 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiMortalStrike_Timer -= uiDiff; - if (m_uiSlam_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_SLAM); @@ -332,19 +278,15 @@ struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI } else m_uiSlam_Timer -= uiDiff; - break; } } - DoMeleeAttackIfReady(); } }; - /*###### ## mob_stormforged_lieutenant ######*/ - struct TRINITY_DLL_DECL mob_stormforged_lieutenantAI : public ScriptedAI { mob_stormforged_lieutenantAI(Creature *pCreature) : ScriptedAI(pCreature) @@ -352,19 +294,15 @@ struct TRINITY_DLL_DECL mob_stormforged_lieutenantAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; bool m_bIsHeroic; - uint32 m_uiArcWeld_Timer; uint32 m_uiRenewSteel_Timer; - void Reset() { m_uiArcWeld_Timer = 20000 + rand()%1000; m_uiRenewSteel_Timer = 10000 + rand()%1000; } - void EnterCombat(Unit* pWho) { if (m_pInstance) @@ -376,13 +314,11 @@ struct TRINITY_DLL_DECL mob_stormforged_lieutenantAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - if (m_uiArcWeld_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_ARC_WELD); @@ -390,7 +326,6 @@ struct TRINITY_DLL_DECL mob_stormforged_lieutenantAI : public ScriptedAI } else m_uiArcWeld_Timer -= uiDiff; - if (m_uiRenewSteel_Timer < uiDiff) { if (m_pInstance) @@ -405,30 +340,24 @@ struct TRINITY_DLL_DECL mob_stormforged_lieutenantAI : public ScriptedAI } else m_uiRenewSteel_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_bjarngrim(Creature* pCreature) { return new boss_bjarngrimAI(pCreature); } - CreatureAI* GetAI_mob_stormforged_lieutenant(Creature* pCreature) { return new mob_stormforged_lieutenantAI(pCreature); } - void AddSC_boss_bjarngrim() { Script *newscript; - newscript = new Script; newscript->Name = "boss_bjarngrim"; newscript->GetAI = &GetAI_boss_bjarngrim; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_stormforged_lieutenant"; newscript->GetAI = &GetAI_mob_stormforged_lieutenant; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp index 96e49343b39..ccaf46303c7 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss Ionar SD%Complete: 80% SDComment: Timer check SDCategory: Halls of Lightning EndScriptData */ - #include "precompiled.h" #include "def_halls_of_lightning.h" - enum eEnums { SAY_AGGRO = -1602011, @@ -33,30 +30,23 @@ enum eEnums SAY_DEATH = -1602015, SAY_SPLIT_1 = -1602016, SAY_SPLIT_2 = -1602017, - SPELL_BALL_LIGHTNING_N = 52780, SPELL_BALL_LIGHTNING_H = 59800, SPELL_STATIC_OVERLOAD_N = 52658, SPELL_STATIC_OVERLOAD_H = 59795, - SPELL_DISPERSE = 52770, SPELL_SUMMON_SPARK = 52746, SPELL_SPARK_DESPAWN = 52776, - //Spark of Ionar SPELL_SPARK_VISUAL_TRIGGER_N = 52667, SPELL_SPARK_VISUAL_TRIGGER_H = 59833, - NPC_SPARK_OF_IONAR = 28926, - MAX_SPARKS = 5, POINT_CALLBACK = 0 }; - /*###### ## Boss Ionar ######*/ - struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI { boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) @@ -64,64 +54,46 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; - std::list m_lSparkGUIDList; - bool m_bIsHeroic; - bool m_bIsSplitPhase; uint32 m_uiSplit_Timer; uint32 m_uiSparkAtHomeCount; - uint32 m_uiStaticOverload_Timer; uint32 m_uiBallLightning_Timer; - uint32 m_uiHealthAmountModifier; - void Reset() { m_lSparkGUIDList.clear(); - m_bIsSplitPhase = true; m_uiSplit_Timer = 25000; m_uiSparkAtHomeCount = 0; - m_uiStaticOverload_Timer = 5000 + rand()%1000; m_uiBallLightning_Timer = 10000 + rand()%1000; - m_uiHealthAmountModifier = 1; - if (m_creature->GetVisibility() == VISIBILITY_OFF) m_creature->SetVisibility(VISIBILITY_ON); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->GetVisibility() == VISIBILITY_OFF) return; - AttackStart(pAttacker); } - void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_IONAR, IN_PROGRESS); } - void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_IONAR, NOT_STARTED); } - void AttackStart(Unit* pWho) { if (m_creature->Attack(pWho, true)) @@ -129,32 +101,26 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - if (m_creature->GetVisibility() != VISIBILITY_OFF) m_creature->GetMotionMaster()->MoveChase(pWho); } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); DespawnSpark(); - if (m_pInstance) m_pInstance->SetData(TYPE_IONAR, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void DespawnSpark() { if (m_lSparkGUIDList.empty()) return; - - for(std::list::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) + for (std::list::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) { if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) { @@ -162,18 +128,15 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI pTemp->ForcedDespawn(); } } - m_lSparkGUIDList.clear(); } - //make sparks come back void CallBackSparks() { //should never be empty here, but check if (m_lSparkGUIDList.empty()) return; - - for(std::list::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) + for (std::list::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) { if (Creature* pSpark = Unit::GetCreature(*m_creature, *itr)) { @@ -181,34 +144,27 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI { if (pSpark->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) pSpark->GetMotionMaster()->MovementExpired(); - pSpark->SetSpeed(MOVE_RUN, pSpark->GetCreatureInfo()->speed * 2); pSpark->GetMotionMaster()->MovePoint(POINT_CALLBACK, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); } } } } - void RegisterSparkAtHome() { ++m_uiSparkAtHomeCount; } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) { pSummoned->CastSpell(pSummoned, m_bIsHeroic ? SPELL_SPARK_VISUAL_TRIGGER_H : SPELL_SPARK_VISUAL_TRIGGER_N, true); - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (m_creature->getVictim()) pSummoned->AI()->AttackStart(pTarget ? pTarget : m_creature->getVictim()); - m_lSparkGUIDList.push_back(pSummoned->GetGUID()); } } - void UpdateAI(const uint32 uiDiff) { // Splitted @@ -219,11 +175,9 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI Reset(); return; }*/ - if (m_uiSplit_Timer < uiDiff) { m_uiSplit_Timer = 2500; - // Return sparks to where Ionar splitted if (m_bIsSplitPhase) { @@ -235,13 +189,10 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI { m_creature->SetVisibility(VISIBILITY_ON); m_creature->CastSpell(m_creature, SPELL_SPARK_DESPAWN, false); - DespawnSpark(); - m_uiSparkAtHomeCount = 0; m_uiSplit_Timer = 25000; m_bIsSplitPhase = true; - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) { if (m_creature->getVictim()) @@ -251,24 +202,19 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI } else m_uiSplit_Timer -= uiDiff; - return; } - //Return since we have no target if (!UpdateVictim()) return; - if (m_uiStaticOverload_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsHeroic ? SPELL_STATIC_OVERLOAD_H : SPELL_STATIC_OVERLOAD_N); - m_uiStaticOverload_Timer = 5000 + rand()%1000; } else m_uiStaticOverload_Timer -= uiDiff; - if (m_uiBallLightning_Timer < uiDiff) { DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_BALL_LIGHTNING_H : SPELL_BALL_LIGHTNING_N); @@ -276,29 +222,22 @@ struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI } else m_uiBallLightning_Timer -= uiDiff; - // Health check if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) { ++m_uiHealthAmountModifier; - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), m_creature); - if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature, SPELL_DISPERSE); } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ionar(Creature* pCreature) { return new boss_ionarAI(pCreature); } - bool EffectDummyCreature_boss_ionar(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { //always check spellid and effectindex @@ -306,42 +245,32 @@ bool EffectDummyCreature_boss_ionar(Unit* pCaster, uint32 uiSpellId, uint32 uiEf { if (pCreatureTarget->GetEntry() != NPC_IONAR) return true; - for (uint8 i = 0; i < MAX_SPARKS; ++i) pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true); - pCreatureTarget->AttackStop(); pCreatureTarget->SetVisibility(VISIBILITY_OFF); - if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) pCreatureTarget->GetMotionMaster()->MovementExpired(); - //always return true when we are handling this spell and effect return true; } return false; } - /*###### ## mob_spark_of_ionar ######*/ - struct TRINITY_DLL_DECL mob_spark_of_ionarAI : public ScriptedAI { mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - void Reset() { } - void MovementInform(uint32 uiType, uint32 uiPointId) { if (uiType != POINT_MOTION_TYPE || !m_pInstance) return; - if (uiPointId == POINT_CALLBACK) { if (Creature* pIonar = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_IONAR))) @@ -351,7 +280,6 @@ struct TRINITY_DLL_DECL mob_spark_of_ionarAI : public ScriptedAI m_creature->ForcedDespawn(); return; } - if (boss_ionarAI* pIonarAI = dynamic_cast(pIonar->AI())) pIonarAI->RegisterSparkAtHome(); } @@ -360,22 +288,18 @@ struct TRINITY_DLL_DECL mob_spark_of_ionarAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_spark_of_ionar(Creature* pCreature) { return new mob_spark_of_ionarAI(pCreature); } - void AddSC_boss_ionar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ionar"; newscript->GetAI = &GetAI_boss_ionar; newscript->pEffectDummyCreature = &EffectDummyCreature_boss_ionar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_spark_of_ionar"; newscript->GetAI = &GetAI_mob_spark_of_ionar; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_loken.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_loken.cpp index 19d34eb383c..227b297e087 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_loken.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_loken.cpp @@ -13,23 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss Loken SD%Complete: 60% SDComment: Missing intro. Remove hack of Pulsing Shockwave when core supports. Aura is not working (59414) SDCategory: Halls of Lightning EndScriptData */ - #include "precompiled.h" #include "def_halls_of_lightning.h" - #define MAX_ENCOUNTER_TIME 2 * 60 * 1000 - enum eEnums { ACHIEVEMENT_TIMELY_DEATH = 1867, - SAY_AGGRO = -1602018, SAY_INTRO_1 = -1602019, SAY_INTRO_2 = -1602020, @@ -44,20 +39,16 @@ enum eEnums SAY_50HEALTH = -1602029, SAY_25HEALTH = -1602030, EMOTE_NOVA = -1602031, - SPELL_ARC_LIGHTNING = 52921, SPELL_LIGHTNING_NOVA_N = 52960, SPELL_LIGHTNING_NOVA_H = 59835, - SPELL_PULSING_SHOCKWAVE_N = 52961, SPELL_PULSING_SHOCKWAVE_H = 59836, SPELL_PULSING_SHOCKWAVE_AURA = 59414 }; - /*###### ## Boss Loken ######*/ - struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI { boss_lokenAI(Creature* pCreature) : ScriptedAI(pCreature) @@ -65,50 +56,36 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; - bool m_bIsHeroic; bool m_bIsAura; - uint32 m_uiArcLightning_Timer; uint32 m_uiLightningNova_Timer; uint32 m_uiPulsingShockwave_Timer; uint32 m_uiResumePulsingShockwave_Timer; - uint32 m_uiHealthAmountModifier; - uint32 EncounterTime; - void Reset() { m_bIsAura = false; - m_uiArcLightning_Timer = 15000; m_uiLightningNova_Timer = 20000; m_uiPulsingShockwave_Timer = 2000; m_uiResumePulsingShockwave_Timer = 15000; - m_uiHealthAmountModifier = 1; - if (m_pInstance) m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); - EncounterTime = 0; - if (m_pInstance) m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); } - void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); - if (m_bIsHeroic && EncounterTime <= MAX_ENCOUNTER_TIME) { AchievementEntry const *AchievTimelyDeath = GetAchievementStore()->LookupEntry(ACHIEVEMENT_TIMELY_DEATH); @@ -118,29 +95,24 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievTimelyDeath); } } } - if (m_pInstance) m_pInstance->SetData(TYPE_LOKEN, DONE); } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - EncounterTime += uiDiff; - if (m_bIsAura) { // workaround for PULSING_SHOCKWAVE @@ -150,21 +122,17 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI if (pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) { int32 dmg; float m_fDist = (m_creature->GetDistance(i->getSource()) - 7.8f); - if (m_fDist <= 1.0f) // Less than 1 yard dmg = (m_bIsHeroic ? 150 : 100); // need to correct damage else // Further from 1 yard dmg = ((m_bIsHeroic ? 150 : 100) * m_fDist) + (m_bIsHeroic ? 150 : 100); // need to correct damage - m_creature->CastCustomSpell(i->getSource(), (m_bIsHeroic ? 59837 : 52942), &dmg, 0, 0, false); } } @@ -177,7 +145,6 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI { //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? m_creature->CastSpell(m_creature, SPELL_PULSING_SHOCKWAVE_AURA, true); - DoCast(m_creature, m_bIsHeroic ? SPELL_PULSING_SHOCKWAVE_H : SPELL_PULSING_SHOCKWAVE_N); // need core support m_bIsAura = true; m_uiResumePulsingShockwave_Timer = 0; @@ -185,30 +152,25 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI else m_uiResumePulsingShockwave_Timer -= uiDiff; } - if (m_uiArcLightning_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_ARC_LIGHTNING); - m_uiArcLightning_Timer = 15000 + rand()%1000; } else m_uiArcLightning_Timer -= uiDiff; - if (m_uiLightningNova_Timer < uiDiff) { DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), m_creature); DoScriptText(EMOTE_NOVA, m_creature); DoCast(m_creature, m_bIsHeroic ? SPELL_LIGHTNING_NOVA_H : SPELL_LIGHTNING_NOVA_N); - m_bIsAura = false; m_uiResumePulsingShockwave_Timer = (m_bIsHeroic ? 4000 : 5000); // Pause Pulsing Shockwave aura m_uiLightningNova_Timer = 20000 + rand()%1000; } else m_uiLightningNova_Timer -= uiDiff; - // Health check if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier))) { @@ -218,23 +180,18 @@ struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI case 2: DoScriptText(SAY_50HEALTH, m_creature); break; case 3: DoScriptText(SAY_25HEALTH, m_creature); break; } - ++m_uiHealthAmountModifier; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_loken(Creature* pCreature) { return new boss_lokenAI(pCreature); } - void AddSC_boss_loken() { Script *newscript; - newscript = new Script; newscript->Name = "boss_loken"; newscript->GetAI = &GetAI_boss_loken; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_volkhan.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_volkhan.cpp index 1804d316f92..0446e653b2d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_volkhan.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/boss_volkhan.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss Volkhan SD%Complete: 60% SDComment: Not considered complete. Some events may fail and need further development SDCategory: Halls of Lightning EndScriptData */ - #include "precompiled.h" #include "def_halls_of_lightning.h" - enum eEnums { SAY_AGGRO = -1602032, @@ -37,41 +34,31 @@ enum eEnums SAY_FORGE_2 = -1602040, EMOTE_TO_ANVIL = -1602041, EMOTE_SHATTER = -1602042, - SPELL_HEAT_N = 52387, SPELL_HEAT_H = 59528, SPELL_SHATTERING_STOMP_N = 52237, SPELL_SHATTERING_STOMP_H = 59529, - //unclear how "directions" of spells must be. Last, summoning GO, what is it for? Script depend on: SPELL_TEMPER = 52238, //TARGET_SCRIPT boss->anvil SPELL_TEMPER_DUMMY = 52654, //TARGET_SCRIPT anvil->boss - //SPELL_TEMPER_VISUAL = 52661, //summons GO - SPELL_SUMMON_MOLTEN_GOLEM = 52405, - //Molten Golem SPELL_BLAST_WAVE = 23113, SPELL_IMMOLATION_STRIKE_N = 52433, SPELL_IMMOLATION_STRIKE_H = 59530, SPELL_SHATTER_N = 52429, SPELL_SHATTER_H = 59527, - NPC_VOLKHAN_ANVIL = 28823, NPC_MOLTEN_GOLEM = 28695, NPC_BRITTLE_GOLEM = 28681, - POINT_ID_ANVIL = 0, MAX_GOLEM = 2, - ACHIEVEMENT_SHATTER_RESISTANT = 2042 }; - /*###### ## Boss Volkhan ######*/ - struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI { boss_volkhanAI(Creature *pCreature) : ScriptedAI(pCreature) @@ -79,51 +66,38 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; - std::list m_lGolemGUIDList; - bool m_bIsHeroic; bool m_bHasTemper; bool m_bIsStriking; bool m_bCanShatterGolem; - uint8 GolemsShattered; uint32 m_uiPause_Timer; uint32 m_uiShatteringStomp_Timer; uint32 m_uiShatter_Timer; - uint32 m_uiHealthAmountModifier; - void Reset() { m_bIsStriking = false; m_bHasTemper = false; m_bCanShatterGolem = false; - m_uiPause_Timer = 3500; m_uiShatteringStomp_Timer = 0; m_uiShatter_Timer = 5000; GolemsShattered = 0; - m_uiHealthAmountModifier = 1; - DespawnGolem(); m_lGolemGUIDList.clear(); - if (m_pInstance) m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); } - void AttackStart(Unit* pWho) { if (m_creature->Attack(pWho, true)) @@ -131,20 +105,16 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - if (!m_bHasTemper) m_creature->GetMotionMaster()->MoveChase(pWho); } } - void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); DespawnGolem(); - if (m_pInstance) m_pInstance->SetData(TYPE_VOLKHAN, DONE); - if (HeroicMode && GolemsShattered < 5) { AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); @@ -154,24 +124,21 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievShatterResistant); } } } } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void DespawnGolem() { if (m_lGolemGUIDList.empty()) return; - - for(std::list::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + for (std::list::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) { @@ -179,16 +146,13 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI pTemp->ForcedDespawn(); } } - m_lGolemGUIDList.clear(); } - void ShatterGolem() { if (m_lGolemGUIDList.empty()) return; - - for(std::list::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + for (std::list::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) { @@ -201,33 +165,27 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI } } } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { if (pSpell->Id == SPELL_TEMPER_DUMMY) m_bIsStriking = true; } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) { m_lGolemGUIDList.push_back(pSummoned->GetGUID()); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); - //why healing when just summoned? pSummoned->CastSpell(pSummoned, m_bIsHeroic ? SPELL_HEAT_H : SPELL_HEAT_N, false, NULL, NULL, m_creature->GetGUID()); } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - if (m_bIsStriking) { if (m_uiPause_Timer < uiDiff) @@ -237,37 +195,29 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI if (m_creature->getVictim()) m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } - m_bHasTemper = false; m_bIsStriking = false; m_uiPause_Timer = 3500; } else m_uiPause_Timer -= uiDiff; - return; } - // When to start shatter? After 60, 40 or 20% hp? if (!m_bHasTemper && m_uiHealthAmountModifier >= 3) { if (m_uiShatteringStomp_Timer < uiDiff) { //should he stomp even if he has no brittle golem to shatter? - DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2), m_creature); - DoCast(m_creature, m_bIsHeroic ? SPELL_SHATTERING_STOMP_H : SPELL_SHATTERING_STOMP_N); - DoScriptText(EMOTE_SHATTER, m_creature); - m_uiShatteringStomp_Timer = 30000; m_bCanShatterGolem = true; } else m_uiShatteringStomp_Timer -= uiDiff; } - // Shatter Golems 3 seconds after Shattering Stomp if (m_bCanShatterGolem) { @@ -280,31 +230,23 @@ struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI else m_uiShatter_Timer -= uiDiff; } - // Health check if (!m_bCanShatterGolem && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) { ++m_uiHealthAmountModifier; - if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoScriptText(RAND(SAY_FORGE_1,SAY_FORGE_2), m_creature); - m_bHasTemper = true; - m_creature->CastSpell(m_creature, SPELL_TEMPER, false); } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_volkhan(Creature* pCreature) { return new boss_volkhanAI(pCreature); } - bool EffectDummyCreature_boss_volkhan(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { //always check spellid and effectindex @@ -312,23 +254,18 @@ bool EffectDummyCreature_boss_volkhan(Unit* pCaster, uint32 uiSpellId, uint32 ui { if (pCaster->GetEntry() != NPC_VOLKHAN_ANVIL || pCreatureTarget->GetEntry() != NPC_VOLKHAN) return true; - - for(uint8 i = 0; i < MAX_GOLEM; ++i) + for (uint8 i = 0; i < MAX_GOLEM; ++i) { pCreatureTarget->CastSpell(pCaster, SPELL_SUMMON_MOLTEN_GOLEM, true); } - //always return true when we are handling this spell and effect return true; } - return false; } - /*###### ## npc_volkhan_anvil ######*/ - bool EffectDummyCreature_npc_volkhan_anvil(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { //always check spellid and effectindex @@ -336,58 +273,42 @@ bool EffectDummyCreature_npc_volkhan_anvil(Unit* pCaster, uint32 uiSpellId, uint { if (pCaster->GetEntry() != NPC_VOLKHAN || pCreatureTarget->GetEntry() != NPC_VOLKHAN_ANVIL) return true; - Creature *cre = CAST_CRE(pCaster); - DoScriptText(EMOTE_TO_ANVIL, pCaster); - float fX, fY, fZ; pCreatureTarget->GetContactPoint(pCaster, fX, fY, fZ, INTERACTION_DISTANCE); - pCaster->AttackStop(); - if (pCaster->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) pCaster->GetMotionMaster()->MovementExpired(); - cre->GetMap()->CreatureRelocation(cre, fX, fY, fZ, pCreatureTarget->GetOrientation()); cre->SendMonsterMove(fX, fY, fZ, 0, cre->GetUnitMovementFlags(), 1); - pCreatureTarget->CastSpell(pCaster, SPELL_TEMPER_DUMMY, false); - //always return true when we are handling this spell and effect return true; } - return false; } - /*###### ## mob_molten_golem ######*/ - struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI { mob_molten_golemAI(Creature *pCreature) : ScriptedAI(pCreature) { m_bIsHeroic = pCreature->GetMap()->IsHeroic(); } - bool m_bIsHeroic; bool m_bIsFrozen; - uint32 m_uiBlast_Timer; uint32 m_uiDeathDelay_Timer; uint32 m_uiImmolation_Timer; - void Reset() { m_bIsFrozen = false; - m_uiBlast_Timer = 20000; m_uiDeathDelay_Timer = 0; m_uiImmolation_Timer = 5000; } - void AttackStart(Unit* pWho) { if (m_creature->Attack(pWho, true)) @@ -395,12 +316,10 @@ struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - if (!m_bIsFrozen) m_creature->GetMotionMaster()->MoveChase(pWho); } } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { if (uiDamage > m_creature->GetHealth()) @@ -418,7 +337,6 @@ struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI m_bIsFrozen = true; } } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { //this is the dummy effect of the spells @@ -428,13 +346,11 @@ struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI m_creature->ForcedDespawn(); } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target or if we are frozen if (!UpdateVictim() || m_bIsFrozen) return; - if (m_uiBlast_Timer < uiDiff) { DoCast(m_creature, SPELL_BLAST_WAVE); @@ -442,7 +358,6 @@ struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI } else m_uiBlast_Timer -= uiDiff; - if (m_uiImmolation_Timer < uiDiff) { DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_IMMOLATION_STRIKE_H : SPELL_IMMOLATION_STRIKE_N); @@ -450,31 +365,25 @@ struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI } else m_uiImmolation_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_molten_golem(Creature* pCreature) { return new mob_molten_golemAI(pCreature); } - void AddSC_boss_volkhan() { Script *newscript; - newscript = new Script; newscript->Name = "boss_volkhan"; newscript->GetAI = &GetAI_boss_volkhan; newscript->pEffectDummyCreature = &EffectDummyCreature_boss_volkhan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_volkhan_anvil"; newscript->pEffectDummyCreature = &EffectDummyCreature_npc_volkhan_anvil; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_molten_golem"; newscript->GetAI = &GetAI_mob_molten_golem; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/def_halls_of_lightning.h b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/def_halls_of_lightning.h index d9739fdf888..0eba059d387 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/def_halls_of_lightning.h +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/def_halls_of_lightning.h @@ -1,34 +1,27 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_HALLS_OF_LIGHTNING_H #define DEF_HALLS_OF_LIGHTNING_H - enum eTypes { MAX_ENCOUNTER = 4, - DATA_BJARNGRIM = 1, DATA_IONAR = 2, DATA_LOKEN = 3, DATA_VOLKHAN = 4, - TYPE_BJARNGRIM = 10, TYPE_IONAR = 11, TYPE_LOKEN = 12, TYPE_VOLKHAN = 13, - NPC_BJARNGRIM = 28586, NPC_VOLKHAN = 28587, NPC_IONAR = 28546, NPC_LOKEN = 28923, - GO_BJARNGRIM_DOOR = 191416, //_doors10 GO_VOLKHAN_DOOR = 191325, //_doors07 GO_IONAR_DOOR = 191326, //_doors05 GO_LOKEN_DOOR = 191324, //_doors02 GO_LOKEN_THRONE = 192654 }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp index e9d75fb8b6f..b22aa409f43 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp @@ -13,57 +13,46 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Halls_of_Lightning SD%Complete: 90% SDComment: All ready. SDCategory: Halls of Lightning EndScriptData */ - #include "precompiled.h" #include "def_halls_of_lightning.h" - /* Halls of Lightning encounters: 0 - General Bjarngrim 1 - Volkhan 2 - Ionar 3 - Loken */ - struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance { instance_halls_of_lightning(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiGeneralBjarngrimGUID; uint64 m_uiIonarGUID; uint64 m_uiLokenGUID; uint64 m_uiVolkhanGUID; - uint64 m_uiBjarngrimDoorGUID; uint64 m_uiVolkhanDoorGUID; uint64 m_uiIonarDoorGUID; uint64 m_uiLokenDoorGUID; uint64 m_uiLokenGlobeGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiGeneralBjarngrimGUID = 0; m_uiVolkhanGUID = 0; m_uiIonarGUID = 0; m_uiLokenGUID = 0; - m_uiBjarngrimDoorGUID = 0; m_uiVolkhanDoorGUID = 0; m_uiIonarDoorGUID = 0; m_uiLokenDoorGUID = 0; m_uiLokenGlobeGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -82,7 +71,6 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -112,7 +100,6 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance break; } } - void SetData(uint32 uiType, uint32 uiData) { switch(uiType) @@ -136,7 +123,6 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance if (uiData == DONE) { DoUseDoorOrButton(m_uiLokenDoorGUID); - //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) pGlobe->SetGoState(GO_STATE_ACTIVE); @@ -145,7 +131,6 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance break; } } - uint32 GetData(uint32 uiType) { switch(uiType) @@ -161,7 +146,6 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 uiData) { switch(uiData) @@ -178,12 +162,10 @@ struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_halls_of_lightning(Map* pMap) { return new instance_halls_of_lightning(pMap); } - void AddSC_instance_halls_of_lightning() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_krystallus.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_krystallus.cpp index ed5291a6887..4d6aef7c122 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_krystallus.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_krystallus.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_krystallus' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_halls_of_stone.h" - enum Spells { SPELL_BOULDER_TOSS = 50843, @@ -23,7 +21,6 @@ enum Spells SPELL_STOMP = 48131, H_SPELL_STOMP = 59744 }; - enum Yells { SAY_AGGRO = -1603007, @@ -31,71 +28,58 @@ enum Yells SAY_DEATH = -1603009, SAY_SHATTER = -1603010 }; - struct TRINITY_DLL_DECL boss_krystallusAI : public ScriptedAI { boss_krystallusAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiBoulderTossTimer; uint32 uiGroundSpikeTimer; uint32 uiGroundSlamTimer; uint32 uiShatterTimer; uint32 uiStompTimer; - bool bIsSlam; - ScriptedInstance* pInstance; - void Reset() { bIsSlam = false; - uiBoulderTossTimer = 3000 + rand()%6000; uiGroundSpikeTimer = 9000 + rand()%5000; uiGroundSlamTimer = 15000 + rand()%3000; uiStompTimer = 20000 + rand()%9000; uiShatterTimer = 0; - if (pInstance) pInstance->SetData(DATA_KRYSTALLUS_EVENT, NOT_STARTED); } void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiBoulderTossTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, HEROIC(SPELL_BOULDER_TOSS, H_SPELL_BOULDER_TOSS)); uiBoulderTossTimer = 9000 + rand()%6000; } else uiBoulderTossTimer -= diff; - if (uiGroundSpikeTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_GROUND_SPIKE); uiGroundSpikeTimer = 12000 + rand()%5000; } else uiGroundSpikeTimer -= diff; - if (uiStompTimer < diff) { DoCast(m_creature, HEROIC(SPELL_STOMP, H_SPELL_STOMP)); uiStompTimer = 20000 + rand()%9000; } else uiStompTimer -= diff; - if (uiGroundSlamTimer < diff) { DoCast(m_creature, SPELL_GROUND_SLAM); @@ -103,7 +87,6 @@ struct TRINITY_DLL_DECL boss_krystallusAI : public ScriptedAI uiShatterTimer = 10000; uiGroundSlamTimer = 15000 + rand()%3000; } else uiGroundSlamTimer -= diff; - if (bIsSlam) { if(uiShatterTimer < diff) @@ -112,18 +95,14 @@ struct TRINITY_DLL_DECL boss_krystallusAI : public ScriptedAI bIsSlam = false; } else uiShatterTimer -= diff; } - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_KRYSTALLUS_EVENT, DONE); } - void KilledUnit(Unit *victim) { if (victim == m_creature) @@ -131,16 +110,13 @@ struct TRINITY_DLL_DECL boss_krystallusAI : public ScriptedAI DoScriptText(SAY_KILL, m_creature); } }; - CreatureAI* GetAI_boss_krystallus(Creature* pCreature) { return new boss_krystallusAI (pCreature); } - void AddSC_boss_krystallus() { Script *newscript; - newscript = new Script; newscript->Name = "boss_krystallus"; newscript->GetAI = &GetAI_boss_krystallus; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp index f8fcd720dfa..2b8cceb14e8 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_maiden_of_grief' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_halls_of_stone.h" - enum Spells { SPELL_PARTING_SORROW = 59723, @@ -22,7 +20,6 @@ enum Spells SPELL_PILLAR_OF_WOE_N = 50761, SPELL_PILLAR_OF_WOE_H = 59727 }; - enum Yells { SAY_AGGRO = -1603000, @@ -33,12 +30,10 @@ enum Yells SAY_DEATH = -1603005, SAY_STUN = -1603006 }; - enum Achievements { ACHIEVEMENT_GOOD_GRIEF = 1866 }; - struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI { boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) @@ -46,16 +41,13 @@ struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI pInstance = m_creature->GetInstanceData(); IsHeroic = m_creature->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool IsHeroic; - uint32 PartingSorrowTimer; uint32 StormOfGriefTimer; uint32 ShockOfSorrowTimer; uint32 PillarOfWoeTimer; uint32 AchievTimer; - void Reset() { PartingSorrowTimer = 25000 + rand()%5000; @@ -63,49 +55,39 @@ struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI ShockOfSorrowTimer = 20000+rand()%5000; PillarOfWoeTimer = 5000 + rand()%10000; AchievTimer = 0; - if (pInstance) pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Achievement counter if (pInstance) if (pInstance->GetData(DATA_MAIDEN_OF_GRIEF_EVENT) == IN_PROGRESS) AchievTimer += diff; - if(IsHeroic) { if (PartingSorrowTimer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) DoCast(target,SPELL_PARTING_SORROW); - PartingSorrowTimer = 30000 + rand()%10000; }else PartingSorrowTimer -= diff; } - if (StormOfGriefTimer < diff) { DoCast(m_creature->getVictim(),IsHeroic ? SPELL_STORM_OF_GRIEF_H : SPELL_STORM_OF_GRIEF_N, true); StormOfGriefTimer = 15000 + rand()%5000; }else StormOfGriefTimer -= diff; - if (ShockOfSorrowTimer < diff) { DoResetThreat(); @@ -113,35 +95,28 @@ struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI DoCast(m_creature,IsHeroic ? SPELL_SHOCK_OF_SORROW_H : SPELL_SHOCK_OF_SORROW_N); ShockOfSorrowTimer = 20000 + rand()%10000; }else ShockOfSorrowTimer -= diff; - if (PillarOfWoeTimer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1); - if(target) DoCast(target,IsHeroic ? SPELL_PILLAR_OF_WOE_H : SPELL_PILLAR_OF_WOE_N); else DoCast(m_creature->getVictim(),IsHeroic ? SPELL_PILLAR_OF_WOE_H : SPELL_PILLAR_OF_WOE_N); - PillarOfWoeTimer = 5000 + rand()%20000; }else PillarOfWoeTimer -= diff; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); - AchievementEntry const *AchievGoodGrief = GetAchievementStore()->LookupEntry(ACHIEVEMENT_GOOD_GRIEF); Map* pMap = m_creature->GetMap(); - if (HeroicMode && AchievTimer < 60000 && pMap && pMap->IsDungeon() && AchievGoodGrief) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievGoodGrief); } } @@ -149,20 +124,16 @@ struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), m_creature); } }; - CreatureAI* GetAI_boss_maiden_of_grief(Creature* pCreature) { return new boss_maiden_of_griefAI (pCreature); } - void AddSC_boss_maiden_of_grief() { Script *newscript; - newscript = new Script; newscript->Name = "boss_maiden_of_grief"; newscript->GetAI = &GetAI_boss_maiden_of_grief; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp index 69061ad1d1f..c093da581c6 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_sjonnir' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_halls_of_stone.h" - enum Spells { SPELL_LIGHTING_RING = 51849, //Periodic Trigger (interval 2s) spell = 50841 @@ -26,7 +24,6 @@ enum Spells H_SPELL_LIGHTING_SHIELD = 59845, SPELL_FRENZY = 28747 }; - enum Yells { SAY_AGGRO = -1603011, @@ -35,9 +32,7 @@ enum Yells SAY_SLAY_3 = -1603014, SAY_DEATH = -1603015 }; - #define EMOTE_GENERIC_FRENZY -1000002 - enum Creatures { CREATURE_FORGED_IRON_TROGG = 27979, @@ -45,35 +40,28 @@ enum Creatures CREATURE_FORGED_IRON_DWARF = 27982, CREATURE_IRON_SLUDGE = 28165 }; - enum Misc { DATA_TIME_BEFORE_OOZE = 150000, //2min 30 secs ACHIEVEMENT_ABUSE_THE_OOZE = 2155 }; - struct Locations { float x, y, z; }; - static Locations PipeLocations[] = { {1295.44, 734.07, 200.3}, //left {1297.7, 595.6, 199.9} //right }; - static Locations CenterPoint = {1295.21, 667.157, 189.691}; - struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI { boss_sjonnirAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - bool bIsFrenzy; - uint32 uiChainLightningTimer; uint32 uiLightningShieldTimer; uint32 uiStaticChargeTimer; @@ -82,13 +70,10 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI uint32 uiFrenzyTimer; uint32 uiEncounterTimer; uint32 uiKilledIronSludges; - ScriptedInstance* pInstance; - void Reset() { bIsFrenzy = false; - uiEncounterTimer = 0; uiChainLightningTimer = 3000 + rand()%5000; uiLightningShieldTimer = 20000 + rand()%5000; @@ -97,46 +82,37 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI uiSummonTimer = 5000; uiFrenzyTimer = 300000; //5 minutes uiKilledIronSludges = 0; - if (pInstance) pInstance->SetData(DATA_SJONNIR_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - uiEncounterTimer = 0; - if (pInstance) pInstance->SetData(DATA_SJONNIR_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiChainLightningTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, HEROIC(SPELL_CHAIN_LIGHTING, H_SPELL_CHAIN_LIGHTING)); uiChainLightningTimer = 10000 + rand()%5000; } else uiChainLightningTimer -= diff; - if (uiLightningShieldTimer < diff) { DoCast(m_creature, HEROIC(SPELL_LIGHTING_SHIELD, H_SPELL_LIGHTING_SHIELD)); uiLightningShieldTimer -= diff; } - if (uiStaticChargeTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_STATIC_CHARGE, H_SPELL_STATIC_CHARGE)); uiStaticChargeTimer = 20000 + rand()%5000; } uiStaticChargeTimer -= diff; - if (uiLightningRingTimer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) @@ -144,7 +120,6 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI DoCast(m_creature, HEROIC(SPELL_LIGHTING_RING, H_SPELL_LIGHTING_RING)); uiLightningRingTimer = 30000 + rand()%5000; } else uiLightningRingTimer -= diff; - if (uiSummonTimer < diff) { uint32 uiSummonPipe = rand()%2; @@ -154,7 +129,6 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); uiSummonTimer = 20000; } else uiSummonTimer -= diff; - if (!bIsFrenzy) { if (uiFrenzyTimer < diff) @@ -164,23 +138,18 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI } else uiFrenzyTimer -= diff; } - uiEncounterTimer +=diff; - DoMeleeAttackIfReady(); } - void JustSummoned(Creature* summon) { summon->GetMotionMaster()->MovePoint(0, CenterPoint.x, CenterPoint.y, CenterPoint.z); /*if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) summon->AI()->AttackStart(pTarget);*/ } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (HeroicMode && uiKilledIronSludges > 4) { AchievementEntry const *AchievAbuseTheOoze = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ABUSE_THE_OOZE); @@ -190,12 +159,11 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievAbuseTheOoze); } } } - if (pInstance) pInstance->SetData(DATA_SJONNIR_EVENT, DONE); } @@ -205,31 +173,25 @@ struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI return; DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void KilledIronSludge() { ++uiKilledIronSludges; } }; - CreatureAI* GetAI_boss_sjonnir(Creature* pCreature) { return new boss_sjonnirAI (pCreature); } - struct TRINITY_DLL_DECL mob_malformed_oozeAI : public ScriptedAI { mob_malformed_oozeAI(Creature *c) : ScriptedAI(c) {} - uint32 uiMergeTimer; bool bIsMerging; - void Reset() { uiMergeTimer = 5000; bIsMerging = false; } - void UpdateAI(const uint32 diff) { if (bIsMerging) @@ -244,13 +206,10 @@ struct TRINITY_DLL_DECL mob_malformed_oozeAI : public ScriptedAI } else bIsMerging = false; } else uiMergeTimer -= diff; } - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void MovementInform(uint32 type, uint32 id) { if(type != POINT_MOTION_TYPE) @@ -258,21 +217,17 @@ struct TRINITY_DLL_DECL mob_malformed_oozeAI : public ScriptedAI bIsMerging = true; } }; - CreatureAI* GetAI_mob_malformed_ooze(Creature* pCreature) { return new mob_malformed_oozeAI(pCreature); } - struct TRINITY_DLL_DECL mob_iron_sludgeAI : public ScriptedAI { mob_iron_sludgeAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void JustDied(Unit* pKiller) { if (pInstance) @@ -280,26 +235,21 @@ struct TRINITY_DLL_DECL mob_iron_sludgeAI : public ScriptedAI CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); } }; - CreatureAI* GetAI_mob_iron_sludge(Creature* pCreature) { return new mob_iron_sludgeAI(pCreature); } - void AddSC_boss_sjonnir() { Script *newscript; - newscript = new Script; newscript->Name = "boss_sjonnir"; newscript->GetAI = &GetAI_boss_sjonnir; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_malformed_ooze"; newscript->GetAI = &GetAI_mob_malformed_ooze; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_iron_sludge"; newscript->GetAI = &GetAI_mob_iron_sludge; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp index 0681b376f4e..3501bc56e3b 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp @@ -1,7 +1,6 @@ #include "precompiled.h" #include "escort_ai.h" #include "def_halls_of_stone.h" - enum Texts { SAY_KILL_1 = -1603016, @@ -13,33 +12,26 @@ enum Texts SAY_PLAYER_DEATH_2 = -1603022, SAY_PLAYER_DEATH_3 = -1603023, SAY_ESCORT_START = -1603024, - SAY_SPAWN_DWARF = -1603025, SAY_SPAWN_TROGG = -1603026, SAY_SPAWN_OOZE = -1603027, SAY_SPAWN_EARTHEN = -1603028, - SAY_EVENT_INTRO_1 = -1603029, SAY_EVENT_INTRO_2 = -1603030, SAY_EVENT_INTRO_3_ABED = -1603031, - SAY_EVENT_A_1 = -1603032, SAY_EVENT_A_2_KADD = -1603033, SAY_EVENT_A_3 = -1603034, - SAY_EVENT_B_1 = -1603035, SAY_EVENT_B_2_MARN = -1603036, SAY_EVENT_B_3 = -1603037, - SAY_EVENT_C_1 = -1603038, SAY_EVENT_C_2_ABED = -1603039, SAY_EVENT_C_3 = -1603040, - SAY_EVENT_D_1 = -1603041, SAY_EVENT_D_2_ABED = -1603042, SAY_EVENT_D_3 = -1603043, SAY_EVENT_D_4_ABED = -1603044, - SAY_EVENT_END_01 = -1603045, SAY_EVENT_END_02 = -1603046, SAY_EVENT_END_03_ABED = -1603047, @@ -61,16 +53,12 @@ enum Texts SAY_EVENT_END_19_MARN = -1603063, SAY_EVENT_END_20 = -1603064, SAY_EVENT_END_21_ABED = -1603065, - SAY_VICTORY_SJONNIR_1 = -1603066, SAY_VICTORY_SJONNIR_2 = -1603067, - SAY_ENTRANCE_MEET = -1603068, - TEXT_ID_START = 13100, TEXT_ID_PROGRESS = 13101 }; - enum Creatures { CREATURE_TRIBUNAL_OF_THE_AGES = 28234, @@ -82,7 +70,6 @@ enum Creatures CREATURE_IRON_GOLEM_CUSTODIAN = 27985, CREATURE_KADDRAK = 30898 }; - enum Spells { SPELL_STEALTH = 58506, @@ -96,26 +83,21 @@ enum Spells SPELL_SEARING_GAZE = 51136, H_SPELL_SEARING_GAZE = 59867 }; - enum Quests { QUEST_HALLS_OF_STONE = 13207 }; - #define GOSSIP_ITEM_START "Brann, it would be our honor!" #define GOSSIP_ITEM_PROGRESS "Let's move Brann, enough of the history lessons!" - struct Locations { float x, y, z; }; - static Locations SpawnLocations[]= { {946.992, 397.016, 208.374}, {960.748, 382.944, 208.374}, }; - struct TRINITY_DLL_DECL mob_tribuna_controllerAI : public ScriptedAI { mob_tribuna_controllerAI(Creature *c) : ScriptedAI(c) @@ -123,39 +105,31 @@ struct TRINITY_DLL_DECL mob_tribuna_controllerAI : public ScriptedAI pInstance = c->GetInstanceData(); SetCombatMovement(false); } - ScriptedInstance* pInstance; - uint32 uiKaddrakEncounterTimer; uint32 uiMarnakEncounterTimer; uint32 uiAbedneumEncounterTimer; - bool bKaddrakActivated; bool bMarnakActivated; bool bAbedneumActivated; - std::list lKaddrakGUIDList; - void Reset() { uiKaddrakEncounterTimer = 1500; uiMarnakEncounterTimer = 10000; uiAbedneumEncounterTimer = 10000; - bKaddrakActivated = false; bMarnakActivated = false; bAbedneumActivated = false; - lKaddrakGUIDList.clear(); } - void UpdateFacesList() { /*GetCreatureListWithEntryInGrid(lKaddrakGUIDList, m_creature, CREATURE_KADDRAK, 50.0f); if (!lKaddrakGUIDList.empty()) { uint32 uiPositionCounter = 0; - for(std::list::iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) + for (std::list::iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) { if ((*itr)->isAlive()) { @@ -174,7 +148,6 @@ struct TRINITY_DLL_DECL mob_tribuna_controllerAI : public ScriptedAI } }*/ } - void UpdateAI(const uint32 diff) { if(bKaddrakActivated) @@ -223,25 +196,19 @@ struct TRINITY_DLL_DECL mob_tribuna_controllerAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI { npc_brann_hosAI(Creature *c) : npc_escortAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiStep; uint32 uiPhaseTimer; - uint64 uiControllerGUID; std::list lDwarfGUIDList; - ScriptedInstance* pInstance; - bool bIsBattle; bool bIsLowHP; - void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) @@ -251,14 +218,11 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI uiStep = 0; uiPhaseTimer = 0; uiControllerGUID = 0; - DespawnDwarf(); - if (pInstance) pInstance->SetData(DATA_BRANN_EVENT, NOT_STARTED); } } - void DespawnDwarf() { if (lDwarfGUIDList.empty()) @@ -271,7 +235,6 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI } lDwarfGUIDList.clear(); } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -304,7 +267,6 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI break; } } - void SpawnDwarf(uint32 uiType) { switch(uiType) @@ -326,20 +288,17 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI break; } } - void JustSummoned(Creature* pSummoned) { lDwarfGUIDList.push_back(pSummoned->GetGUID()); pSummoned->AddThreat(m_creature, 0.0f); pSummoned->AI()->AttackStart(m_creature); } - void JumpToNextStep(uint32 uiTimer) { uiPhaseTimer = uiTimer; uiStep++; } - void StartWP() { m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -347,7 +306,6 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI uiStep = 1; Start(); } - void UpdateEscortAI(const uint32 uiDiff) { if (uiPhaseTimer < uiDiff) @@ -626,7 +584,6 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI break; } } else uiPhaseTimer -= uiDiff; - if (!bIsLowHP && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 30) { DoScriptText(SAY_LOW_HEALTH, m_creature); @@ -635,18 +592,14 @@ struct TRINITY_DLL_DECL npc_brann_hosAI : public npc_escortAI bIsLowHP = false; } }; - bool GossipHello_npc_brann_hos(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_brann_hos(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) @@ -654,31 +607,25 @@ bool GossipSelect_npc_brann_hos(Player* pPlayer, Creature* pCreature, uint32 uiS pPlayer->CLOSE_GOSSIP_MENU(); ((npc_brann_hosAI*)pCreature->AI())->StartWP(); } - return true; } - CreatureAI* GetAI_mob_tribuna_controller(Creature* pCreature) { return new mob_tribuna_controllerAI(pCreature); } - CreatureAI* GetAI_npc_brann_hos(Creature* pCreature) { return new npc_brann_hosAI(pCreature); } - void AddSC_halls_of_stone() { Script *newscript; - newscript = new Script; newscript->Name = "npc_brann_hos"; newscript->GetAI = &GetAI_npc_brann_hos; newscript->pGossipHello = &GossipHello_npc_brann_hos; newscript->pGossipSelect = &GossipSelect_npc_brann_hos; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_tribuna_controller"; newscript->GetAI = &GetAI_mob_tribuna_controller; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/instance_halls_of_stone.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/instance_halls_of_stone.cpp index 85d9367ae1d..8e7bf896803 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/instance_halls_of_stone.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/instance_halls_of_stone.cpp @@ -1,28 +1,22 @@ #include "precompiled.h" #include "def_halls_of_stone.h" - #define MAX_ENCOUNTER 4 - /* Halls of Stone encounters: 0- Krystallus 1- Maiden of Grief 2- Escort Event 3- Sjonnir The Ironshaper */ - struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance { instance_halls_of_stone(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 uiMaidenOfGrief; uint64 uiKrystallus; uint64 uiSjonnir; - uint64 uiKaddrak; uint64 uiAbedneum; uint64 uiMarnak; uint64 uiBrann; - uint64 uiMaidenOfGriefDoor; uint64 uiSjonnirDoor; uint64 uiBrannDoor; @@ -32,22 +26,17 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance uint64 uiKaddrakGo; uint64 uiAbedneumGo; uint64 uiMarnakGo; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - void Initialize() { uiMaidenOfGrief = 0; uiKrystallus = 0; uiSjonnir = 0; - uiKaddrak = 0; uiMarnak = 0; uiAbedneum = 0; uiBrann = 0; - uiMaidenOfGriefDoor = 0; uiSjonnirDoor = 0; uiBrannDoor = 0; @@ -57,11 +46,9 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance uiTribunalConsole = 0; uiTribunalChest = 0; uiTribunalSkyFloor = 0; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) m_auiEncounter[i] = NOT_STARTED; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -75,7 +62,6 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance case 28070: uiBrann = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -121,7 +107,6 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -145,11 +130,9 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance HandleGameObject(uiSjonnirDoor,true); break; } - if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -159,10 +142,8 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance case DATA_SJONNIR_EVENT: return m_auiEncounter[2]; case DATA_BRANN_EVENT: return m_auiEncounter[3]; } - return 0; } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -179,23 +160,17 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance case DATA_GO_MARNAK: return uiMarnakGo; case DATA_GO_SKY_FLOOR: return uiTribunalSkyFloor; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -203,37 +178,28 @@ struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'H' && dataHead2 == 'S') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; m_auiEncounter[3] = data3; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_halls_of_stone(Map* pMap) { return new instance_halls_of_stone(pMap); } - void AddSC_instance_halls_of_stone() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_algalon.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_algalon.cpp index a736b2db12a..b28c71f645d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_algalon.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_algalon.cpp @@ -15,6 +15,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp index df03ff9eff7..9f529b04ebb 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp @@ -15,21 +15,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Assembly of Iron encounter SD%Complete: 60% SDComment: Runes need DB support, chain lightning won't cast, supercharge won't cast (target error?) - it worked before during debugging. SDCategory: Ulduar - Ulduar EndScriptData */ - #include "precompiled.h" #include "def_ulduar.h" - // Any boss #define SPELL_SUPERCHARGE 61920 #define SPELL_BERSERK 47008 // Hard enrage, don't know the correct ID. - // Steelbreaker #define SPELL_HIGH_VOLTAGE 61890 #define SPELL_HIGH_VOLTAGE_H 63498 @@ -40,7 +36,6 @@ EndScriptData */ #define SPELL_OVERWHELMING_POWER_H 61888 #define SPELL_OVERWHELMING_POWER 64637 #define SPELL_ELECTRICAL_CHARGE 61902 - // Runemaster Molgeim #define SPELL_SHIELD_OF_RUNES 62274 #define SPELL_SHIELD_OF_RUNES_H 63489 @@ -50,7 +45,6 @@ EndScriptData */ #define SPELL_LIGHTNING_BLAST 62054 #define SPELL_LIGHTNING_BLAST_H 63491 #define CREATURE_RUNE_OF_SUMMONING 33051 - // Stormcaller Brundir #define SPELL_CHAIN_LIGHTNING_N 61879 #define SPELL_CHAIN_LIGHTNING_H 63479 @@ -62,8 +56,6 @@ EndScriptData */ #define SPELL_LIGHTNING_TENDRILS_H 63486 #define SPELL_STORMSHIELD 64187 - - enum eEnums { EVENT_ENRAGE, @@ -84,27 +76,21 @@ enum eEnums EVENT_LIGHTNING_TENDRILS, EVENT_STORMSHIELD, MAX_EVENT - }; - - bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* m_creature) { if (!pInstance || !m_creature) return false; - - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { uint64 guid = pInstance->GetData64(DATA_STEELBREAKER+i); if(!guid) return false; - if(Creature *boss = (Unit::GetCreature((*m_creature), guid))) { if(boss->isAlive()) return false; - continue; } else @@ -112,14 +98,12 @@ bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* m_creature) } return true; } - struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI { boss_steelbreakerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - void Reset() { events.Reset(); @@ -128,11 +112,9 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI if(pInstance) pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); } - EventMap events; ScriptedInstance* pInstance; uint32 phase; - void EnterCombat(Unit *who) { DoZoneInCombat(); @@ -140,7 +122,6 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI events.ScheduleEvent(EVENT_ENRAGE, 900000); UpdatePhase(); } - void UpdatePhase() { ++phase; @@ -151,7 +132,6 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI if(phase >= 3) events.RescheduleEvent(EVENT_OVERWHELMING_POWER, rand()%5000); } - void DamageTaken(Unit* pKiller, uint32 &damage) { if(damage >= m_creature->GetHealth()) @@ -161,7 +141,6 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI { Brundir->SetHealth(Brundir->GetMaxHealth()); } - if(Creature* Molgeim = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) if(Molgeim->isAlive()) { @@ -170,32 +149,26 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI DoCast(SPELL_SUPERCHARGE); } } - void JustDied(Unit* Killer) { if(IsEncounterComplete(pInstance, m_creature) && pInstance) pInstance->SetData(TYPE_ASSEMBLY, DONE); } - void KilledUnit(Unit *who) { if(phase == 3) DoCast(m_creature, SPELL_ELECTRICAL_CHARGE); } - void SpellHit(Unit *from, const SpellEntry *spell) { if(spell->Id == SPELL_SUPERCHARGE) UpdatePhase(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -220,18 +193,15 @@ struct TRINITY_DLL_DECL boss_steelbreakerAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI { boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - void Reset() { if(pInstance) @@ -240,18 +210,15 @@ struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI m_creature->RemoveAllAuras(); phase = 0; } - ScriptedInstance* pInstance; EventMap events; uint32 phase; - void EnterCombat(Unit* who) { DoZoneInCombat(); events.ScheduleEvent(EVENT_ENRAGE, 900000); UpdatePhase(); } - void UpdatePhase() { ++phase; @@ -263,7 +230,6 @@ struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI if(phase >= 3) events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, 20000+(rand()%10)*1000); } - void DamageTaken(Unit* pKiller, uint32 &damage) { if(damage >= m_creature->GetHealth()) @@ -273,7 +239,6 @@ struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI { Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); } - if(Creature* Brundir = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) if(Brundir->isAlive()) { @@ -282,26 +247,21 @@ struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI DoCast(m_creature, SPELL_SUPERCHARGE); } } - void JustDied(Unit* Killer) { if(IsEncounterComplete(pInstance, m_creature) && pInstance) pInstance->SetData(TYPE_ASSEMBLY, DONE); } - void SpellHit(Unit *from, const SpellEntry *spell) { if(spell->Id == SPELL_SUPERCHARGE) UpdatePhase(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -338,64 +298,52 @@ struct TRINITY_DLL_DECL boss_runemaster_molgeimAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_lightning_elementalAI : public ScriptedAI { mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) { Charge(); } - Unit* Target; - void Charge() { Target = m_creature->SelectNearestTarget(); m_creature->AddThreat(Target, 5000000.0f); AttackStart(Target); } - void UpdateAI(const uint32 diff) { if(!m_creature->isInCombat()) return; - if(m_creature->IsWithinMeleeRange(Target)) { DoCast(Target, HEROIC(SPELL_LIGHTNING_BLAST, SPELL_LIGHTNING_BLAST_H)); m_creature->Kill(m_creature); // hack until spell works } - m_creature->GetMotionMaster()->MoveChase(Target); // needed at every update? } - }; - struct TRINITY_DLL_DECL mob_rune_of_summoningAI : public ScriptedAI { mob_rune_of_summoningAI(Creature *c) : ScriptedAI(c) { SummonLightningElemental(); } - void SummonLightningElemental() { m_creature->SummonCreature(CREATURE_RUNE_OF_SUMMONING, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN ); m_creature->DealDamage(m_creature, m_creature->GetHealth()); } }; - struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI { boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - void Reset() { if(pInstance) @@ -404,18 +352,15 @@ struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI events.Reset(); phase = 0; } - EventMap events; ScriptedInstance* pInstance; uint32 phase; - void EnterCombat(Unit* who) { DoZoneInCombat(); events.ScheduleEvent(EVENT_ENRAGE, 900000); UpdatePhase(); } - void UpdatePhase() { ++phase; @@ -429,9 +374,7 @@ struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI DoCast(m_creature, SPELL_STORMSHIELD); events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, 40000+ (rand()%40)*1000); } - } - void DamageTaken(Unit* pKiller, uint32 &damage) { if(damage >= m_creature->GetHealth()) @@ -441,23 +384,19 @@ struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI { Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); } - if(Creature* Molgeim = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) if(Molgeim->isAlive()) { Molgeim->SetHealth(Molgeim->GetMaxHealth()); } - DoCast(SPELL_SUPERCHARGE); } } - void JustDied(Unit* Killer) { if(IsEncounterComplete(pInstance, m_creature) && pInstance) pInstance->SetData(TYPE_ASSEMBLY, DONE); } - void SpellHit(Unit *from, const SpellEntry *spell) { if(spell->Id == SPELL_SUPERCHARGE) @@ -465,14 +404,11 @@ struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI UpdatePhase(); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -502,63 +438,50 @@ struct TRINITY_DLL_DECL boss_stormcaller_brundirAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_steelbreaker(Creature* pCreature) { return new boss_steelbreakerAI (pCreature); } - CreatureAI* GetAI_boss_runemaster_molgeim(Creature* pCreature) { return new boss_runemaster_molgeimAI (pCreature); } - CreatureAI* GetAI_boss_stormcaller_brundir(Creature* pCreature) { return new boss_stormcaller_brundirAI (pCreature); } - CreatureAI* GetAI_mob_lightning_elemental(Creature* pCreature) { return new mob_lightning_elementalAI (pCreature); } - CreatureAI* GetAI_mob_rune_of_summoning(Creature* pCreature) { return new mob_rune_of_summoningAI (pCreature); } - void AddSC_boss_assembly_of_iron() { Script *newscript; - newscript = new Script; newscript->Name = "boss_steelbreaker"; newscript->GetAI = &GetAI_boss_steelbreaker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_runemaster_molgeim"; newscript->GetAI = &GetAI_boss_runemaster_molgeim; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_stormcaller_brundir"; newscript->GetAI = &GetAI_boss_stormcaller_brundir; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_lightning_elemental"; newscript->GetAI = &GetAI_mob_lightning_elemental; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_rune_of_summoning"; newscript->GetAI = &GetAI_mob_rune_of_summoning; newscript->RegisterSelf(); - -} \ No newline at end of file +} diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_auriaya.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_auriaya.cpp index e4dedac54ac..8199a914e2f 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_auriaya.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_auriaya.cpp @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - //boss_auriaya #define SPELL_TERRIFYING_SCREECH 64386 #define SPELL_SONIC_BOOM 38897 @@ -26,25 +24,20 @@ //beetwen -2000000 and -2999999 are custom texts so wtf? #define SAY_AGGRO -2615016 #define SAY_SLAY_1 -2615017 - struct TRINITY_DLL_DECL boss_auriaya_AI : public BossAI { boss_auriaya_AI(Creature *pCreature) : BossAI(pCreature, TYPE_AURIAYA) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 TERRIFYING_SCREECH_Timer; uint32 SONIC_BOOM_Timer; - void Reset() { TERRIFYING_SCREECH_Timer = 0; SONIC_BOOM_Timer = 2000; } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO,m_creature); @@ -53,39 +46,31 @@ struct TRINITY_DLL_DECL boss_auriaya_AI : public BossAI { DoScriptText(SAY_SLAY_1, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_SLAY_1, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_AURIAYA, DONE); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (TERRIFYING_SCREECH_Timer < diff) { DoCast(m_creature,SPELL_TERRIFYING_SCREECH); DoScriptText(SAY_SLAY_1, m_creature); TERRIFYING_SCREECH_Timer = 360000; } else TERRIFYING_SCREECH_Timer -= diff; - if (SONIC_BOOM_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SONIC_BOOM); SONIC_BOOM_Timer = 20000; } else SONIC_BOOM_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_auriaya(Creature* pCreature) { return new boss_auriaya_AI (pCreature); @@ -93,7 +78,6 @@ CreatureAI* GetAI_boss_auriaya(Creature* pCreature) void AddSC_boss_auriaya() { Script *newscript; - newscript = new Script; newscript->Name = "boss_auriaya"; newscript->GetAI = &GetAI_boss_auriaya; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp index 1aa70290b69..e16045c1877 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp @@ -15,43 +15,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" #include "Vehicle.h" - #define SPELL_PURSUED 62374 #define SPELL_GATHERING_SPEED 62375 #define SPELL_BATTERING_RAM 62376 #define SPELL_FLAME_VENTS 62396 #define SPELL_MISSILE_BARRAGE 62400 #define SPELL_SYSTEMS_SHUTDOWN 62475 - #define SPELL_FLAME_CANNON 62395 //#define SPELL_FLAME_CANNON 64692 trigger the same spell - #define SPELL_OVERLOAD_CIRCUIT 62399 - #define SPELL_SEARING_FLAME 62402 - #define SPELL_BLAZE 62292 - #define SPELL_SMOKE_TRAIL 63575 - #define SPELL_MIMIRON_INFERNO 62910 - #define SPELL_HODIR_FURY 62297 - #define SPELL_ELECTROSHOCK 62522 - enum Mobs { MOB_MECHANOLIFT = 33214, MOB_LIQUID = 33189, MOB_CONTAINER = 33218, }; - enum Events { EVENT_PURSUE = 1, @@ -62,14 +50,12 @@ enum Events EVENT_MIMIRON_INFERNO, // Not Blizzlike EVENT_HODIR_FURY, // Not Blizzlike }; - enum Seats { SEAT_PLAYER = 0, SEAT_TURRET = 1, SEAT_DEVICE = 2, }; - struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI { boss_flame_leviathanAI(Creature *pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(me->GetVehicleKit()) @@ -77,17 +63,13 @@ struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI m_pInstance = pCreature->GetInstanceData(); assert(vehicle); } - ScriptedInstance* m_pInstance; - Vehicle *vehicle; - void Reset() { _Reset(); me->SetReactState(REACT_AGGRESSIVE); } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -102,20 +84,17 @@ struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI if (Creature *turret = CAST_CRE(vehicle->GetPassenger(7))) turret->AI()->DoZoneInCombat(); } - // TODO: effect 0 and effect 1 may be on different target void SpellHitTarget(Unit *target, const SpellEntry *spell) { if (spell->Id == SPELL_PURSUED) AttackStart(target); } - void JustDied(Unit *victim) { if (m_pInstance) m_pInstance->SetData(TYPE_LEVIATHAN, DONE); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if(spell->Id == 62472) @@ -123,27 +102,21 @@ struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI else if(spell->Id == SPELL_ELECTROSHOCK) me->InterruptSpell(CURRENT_CHANNELED_SPELL); } - void UpdateAI(const uint32 diff) { if (!me->isInCombat()) return; - if (me->getThreatManager().isThreatListEmpty()) { EnterEvadeMode(); return; } - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - uint32 eventId = events.GetEvent(); if (!me->getVictim()) eventId = EVENT_PURSUE; - switch(eventId) { case 0: break; // this is a must @@ -185,13 +158,10 @@ struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI events.PopEvent(); break; } - DoSpellAttackIfReady(SPELL_BATTERING_RAM); } }; - //#define BOSS_DEBUG - struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI { boss_flame_leviathan_seatAI(Creature *c) : PassiveAI(c), vehicle(c->GetVehicleKit()) @@ -201,9 +171,7 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI me->SetReactState(REACT_AGGRESSIVE); #endif } - Vehicle *vehicle; - #ifdef BOSS_DEBUG void MoveInLineOfSight(Unit *who) { @@ -212,17 +180,14 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI who->EnterVehicle(vehicle, SEAT_PLAYER); } #endif - void PassengerBoarded(Unit *who, int8 seatId, bool apply) { if(!me->GetVehicle()) return; - if(seatId == SEAT_PLAYER) { if(!apply) return; - if(Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) { turret->setFaction(me->GetVehicleBase()->getFaction()); @@ -239,7 +204,6 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI { if(apply) return; - if(Unit *device = vehicle->GetPassenger(SEAT_DEVICE)) { device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); @@ -248,17 +212,14 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI } } }; - struct TRINITY_DLL_DECL boss_flame_leviathan_defense_turretAI : public TurretAI { boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} - void DamageTaken(Unit *who, uint32 &damage) { if(!CanAIAttack(who)) damage = 0; } - bool CanAIAttack(const Unit *who) const { if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) @@ -266,11 +227,9 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_defense_turretAI : public TurretAI return true; } }; - struct TRINITY_DLL_DECL boss_flame_leviathan_overload_deviceAI : public PassiveAI { boss_flame_leviathan_overload_deviceAI(Creature *c) : PassiveAI(c) {} - void DoAction(const int32 param) { if(param == EVENT_SPELLCLICK) @@ -290,11 +249,9 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_overload_deviceAI : public PassiveA } } }; - struct TRINITY_DLL_DECL boss_flame_leviathan_safety_containerAI : public PassiveAI { boss_flame_leviathan_safety_containerAI(Creature *c) : PassiveAI(c) {} - void MovementInform(uint32 type, uint32 id) { if(id == me->GetEntry()) @@ -304,63 +261,52 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_safety_containerAI : public Passive me->DisappearAndDie(); // this will relocate creature to sky } } - void UpdateAI(const uint32 diff) { if(!me->GetVehicle() && me->isSummon() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) me->GetMotionMaster()->MoveFall(409.8f, me->GetEntry()); } }; - struct TRINITY_DLL_DECL spell_pool_of_tarAI : public TriggerAI { spell_pool_of_tarAI(Creature *c) : TriggerAI(c) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void DamageTaken(Unit *who, uint32 &damage) { damage = 0; } - void SpellHit(Unit* caster, const SpellEntry *spell) { if(spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) me->CastSpell(me, SPELL_BLAZE, true); } }; - CreatureAI* GetAI_boss_flame_leviathan(Creature* pCreature) { return new boss_flame_leviathanAI (pCreature); } - CreatureAI* GetAI_boss_flame_leviathan_seat(Creature* pCreature) { return new boss_flame_leviathan_seatAI (pCreature); } - CreatureAI* GetAI_boss_flame_leviathan_defense_turret(Creature* pCreature) { return new boss_flame_leviathan_defense_turretAI (pCreature); } - CreatureAI* GetAI_boss_flame_leviathan_overload_device(Creature* pCreature) { return new boss_flame_leviathan_overload_deviceAI (pCreature); } - CreatureAI* GetAI_boss_flame_leviathan_safety_containerAI(Creature* pCreature) { return new boss_flame_leviathan_safety_containerAI(pCreature); } - CreatureAI* GetAI_spell_pool_of_tar(Creature* pCreature) { return new spell_pool_of_tarAI (pCreature); } - void AddSC_boss_flame_leviathan() { Script *newscript; @@ -368,27 +314,22 @@ void AddSC_boss_flame_leviathan() newscript->Name = "boss_flame_leviathan"; newscript->GetAI = &GetAI_boss_flame_leviathan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_flame_leviathan_seat"; newscript->GetAI = &GetAI_boss_flame_leviathan_seat; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_flame_leviathan_defense_turret"; newscript->GetAI = &GetAI_boss_flame_leviathan_defense_turret; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_flame_leviathan_overload_device"; newscript->GetAI = &GetAI_boss_flame_leviathan_overload_device; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_flame_leviathan_safety_container"; newscript->GetAI = &GetAI_boss_flame_leviathan_safety_containerAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "spell_pool_of_tar"; newscript->GetAI = &GetAI_spell_pool_of_tar; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_freya.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_freya.cpp index ac0b23c1b7a..447a26ae7b3 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_freya.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_freya.cpp @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - /* #define SAY_AGGRO -1 #define SAY_SLAY -1 */ - struct TRINITY_DLL_DECL boss_freyaAI : public BossAI { boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) @@ -31,52 +28,39 @@ struct TRINITY_DLL_DECL boss_freyaAI : public BossAI m_pInstance = pCreature->GetInstanceData(); Reset(); } - ScriptedInstance* m_pInstance; - void Reset() { } - void KilledUnit(Unit *victim) { } - void JustDied(Unit *victim) { if (m_pInstance) m_pInstance->SetData(TYPE_FREYA, DONE); } - void Aggro(Unit* pWho) { // DoScriptText(SAY_AGGRO, m_creature); m_creature->SetInCombatWithZone(); - if (m_pInstance) m_pInstance->SetData(TYPE_FREYA, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //SPELLS TODO: - // DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(diff); - } - }; - CreatureAI* GetAI_boss_freya(Creature* pCreature) { return new boss_freyaAI(pCreature); } - void AddSC_boss_freya() { Script *newscript; @@ -84,5 +68,4 @@ void AddSC_boss_freya() newscript->Name = "boss_freya"; newscript->GetAI = &GetAI_boss_freya; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_general_vezax.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_general_vezax.cpp index a736b2db12a..b28c71f645d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_general_vezax.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_general_vezax.cpp @@ -15,6 +15,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_hodir.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_hodir.cpp index c05d30d83ba..1b84b927184 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_hodir.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_hodir.cpp @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - /* #define SAY_AGGRO -1 #define SAY_SLAY -1 */ - struct TRINITY_DLL_DECL boss_hodirAI : public BossAI { boss_hodirAI(Creature *pCreature) : BossAI(pCreature, TYPE_HODIR) @@ -31,52 +28,39 @@ struct TRINITY_DLL_DECL boss_hodirAI : public BossAI m_pInstance = pCreature->GetInstanceData(); Reset(); } - ScriptedInstance* m_pInstance; - void Reset() { } - void KilledUnit(Unit *victim) { } - void JustDied(Unit *victim) { if (m_pInstance) m_pInstance->SetData(TYPE_HODIR, DONE); } - void Aggro(Unit* pWho) { // DoScriptText(SAY_AGGRO, m_creature); m_creature->SetInCombatWithZone(); - if (m_pInstance) m_pInstance->SetData(TYPE_HODIR, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //SPELLS TODO: - // DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(diff); - } - }; - CreatureAI* GetAI_boss_hodir(Creature* pCreature) { return new boss_hodirAI(pCreature); } - void AddSC_boss_hodir() { Script *newscript; @@ -84,6 +68,5 @@ void AddSC_boss_hodir() newscript->Name = "boss_hodir"; newscript->GetAI = &GetAI_boss_hodir; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_ignis.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_ignis.cpp index 8dfda95a987..e4697b60412 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_ignis.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_ignis.cpp @@ -15,33 +15,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - #define SPELL_FLAME_JETS 62680 #define SPELL_SCORCH 62546 #define SPELL_SLAG_POT 62717 - //wrong ids. not in db #define SAY_AGGRO -10000002 #define SAY_SLAY -1000003 - struct TRINITY_DLL_DECL boss_ignis_AI : public BossAI { boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} - uint32 FLAME_JETS_Timer; uint32 SCORCH_Timer; uint32 SLAG_POT_Timer; - void Reset() { FLAME_JETS_Timer = 32000; SCORCH_Timer = 100; SLAG_POT_Timer = 100; } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO,m_creature); @@ -50,19 +43,15 @@ struct TRINITY_DLL_DECL boss_ignis_AI : public BossAI { DoScriptText(SAY_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_SLAY, m_creature); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(m_creature->GetPositionY() < 150 || m_creature->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { m_creature->RemoveAllAuras(); @@ -70,20 +59,17 @@ struct TRINITY_DLL_DECL boss_ignis_AI : public BossAI m_creature->CombatStop(false); m_creature->GetMotionMaster()->MoveTargetedHome(); } - if (FLAME_JETS_Timer < diff) { DoCast(m_creature,SPELL_FLAME_JETS); DoScriptText(SAY_SLAY, m_creature); FLAME_JETS_Timer = 25000; } else FLAME_JETS_Timer -= diff; - if (SCORCH_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SCORCH); SCORCH_Timer = 20000; } else SCORCH_Timer -= diff; - if (SLAG_POT_Timer < diff) { DoCast(m_creature,SPELL_SLAG_POT); @@ -91,11 +77,9 @@ struct TRINITY_DLL_DECL boss_ignis_AI : public BossAI SLAG_POT_Timer = 30000; } else SLAG_POT_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ignis(Creature* pCreature) { return new boss_ignis_AI (pCreature); @@ -103,7 +87,6 @@ CreatureAI* GetAI_boss_ignis(Creature* pCreature) void AddSC_boss_ignis() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ignis"; newscript->GetAI = &GetAI_boss_ignis; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp index b2dfbc08263..6e47e787ab1 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp @@ -15,20 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" #include "Vehicle.h" - #define SPELL_ARM_DEAD_DAMAGE HEROIC(63629,63979) #define SPELL_TWO_ARM_SMASH HEROIC(63356,64003) #define SPELL_ONE_ARM_SMASH HEROIC(63573,64006) #define SPELL_STONE_SHOUT HEROIC(63716,64005) #define SPELL_PETRIFY_BREATH HEROIC(62030,63980) - #define SPELL_STONE_GRIP HEROIC(62166,63981) #define SPELL_ARM_SWEEP HEROIC(63766,63983) - enum Events { EVENT_NONE = 0, @@ -36,7 +32,6 @@ enum Events EVENT_GRIP, EVENT_SWEEP, }; - struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI { boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(me->GetVehicleKit()), @@ -47,23 +42,18 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation } - ScriptedInstance* m_pInstance; - Vehicle *vehicle; bool left, right; - void AttackStart(Unit *who) { me->Attack(who, true); } - void JustDied(Unit *victim) { if (m_pInstance) m_pInstance->SetData(TYPE_KOLOGARN, DONE); } - void PassengerBoarded(Unit *who, int8 seatId, bool apply) { if(who->GetTypeId() == TYPEID_UNIT) @@ -76,7 +66,6 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI CAST_CRE(who)->SetReactState(REACT_PASSIVE); } } - void EnterCombat(Unit *who) { _EnterCombat(); @@ -84,17 +73,13 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI events.ScheduleEvent(EVENT_SWEEP, 10000); events.ScheduleEvent(EVENT_GRIP, 15000); } - void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - events.Update(diff); - if(me->hasUnitState(UNIT_STAT_CASTING)) return; - // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell switch(events.GetEvent()) { @@ -120,16 +105,13 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI events.PopEvent(); break; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_kologarn(Creature* pCreature) { return new boss_kologarnAI (pCreature); } - void AddSC_boss_kologarn() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_mimiron.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_mimiron.cpp index a736b2db12a..b28c71f645d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_mimiron.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_mimiron.cpp @@ -15,6 +15,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp index 92dd6ecacab..87df084972a 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp @@ -15,17 +15,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData Name: razorscale %Complete: 90 Comment: Made by Epsik from WoW Arthas wow.dsl.net.pk Category: EndScriptData */ - #include "precompiled.h" #include "def_ulduar.h" - //wrong text ids. correct are beetwen -1000000 AND -1999999 //beetwen -2000000 and -2999999 are custom texts so wtf? #define SAY_AGGRO -2000000 @@ -33,23 +30,17 @@ EndScriptData */ #define SAY_PHASE_2_TRANS -2000002 #define SAY_PHASE_3_TRANS -2000003 #define EMOTE_BREATH -2000004 - #define SPELL_FLAMEBUFFET 64016 #define SPELL_FIREBALL 62796 - #define SPELL_WINGBUFFET 62666 #define SPELL_FLAMEBREATH 63317 #define SPELL_FUSEARMOR 64771 #define SPELL_DEVOURINGFLAME 63014 #define SPELL_KNOCK_AWAY 19633 - #define SPELL_BELLOWINGROAR 18431 #define SPELL_HEATED_GROUND 22191 - #define SPELL_SUMMONADDS 17646 - #define CREATURE_ADDS 33846 - static float MovementLocations[4][3]= { {607.7, -281.9, 408.6}, @@ -57,7 +48,6 @@ static float MovementLocations[4][3]= {612.3, -230.8, 409.1}, {624.1, -251.8, 426.1} }; - static float SpawnLocations[4][3]= { {602.0, -248.1, 391.2}, @@ -65,13 +55,10 @@ static float SpawnLocations[4][3]= {643.3, -256.4, 391.4}, {626.6, -271.5, 391.4}, }; - struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI { boss_razorscaleAI(Creature *pCreature) : BossAI(pCreature, TYPE_RAZORSCALE) {} - uint32 Phase; - uint32 FlameBreathTimer; uint32 FUSEARMORTimer; uint32 DEVOURINGFLAMETimer; @@ -81,13 +68,10 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI uint32 WingBuffetTimer; uint32 KnockAwayTimer; uint32 FireballTimer; - bool InitialSpawn; - void Reset() { Phase = 1; - FlameBreathTimer = 20000; DEVOURINGFLAMETimer = 2000; FUSEARMORTimer = 15000; @@ -97,33 +81,26 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI WingBuffetTimer = 17000; KnockAwayTimer = 15000; FireballTimer = 18000; - InitialSpawn = true; - m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); } - void JustDied(Unit* Killer) { } - void KilledUnit(Unit *victim) { DoScriptText(SAY_KILL, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(m_creature->GetPositionY() > -60 || m_creature->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { m_creature->RemoveAllAuras(); @@ -131,7 +108,6 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI m_creature->CombatStop(false); m_creature->GetMotionMaster()->MoveTargetedHome(); } - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 99) && (Phase == 1)) { Phase = 2; @@ -141,7 +117,6 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI m_creature->GetMotionMaster()->MoveIdle(); DoScriptText(SAY_PHASE_2_TRANS, m_creature); } - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) && (Phase == 2)) { Phase = 3; @@ -153,7 +128,6 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI DoScriptText(SAY_PHASE_3_TRANS, m_creature); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } - if (Phase == 1 || Phase == 3) { if (FlameBreathTimer < diff) @@ -161,28 +135,23 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH); FlameBreathTimer = 15000; } else FlameBreathTimer -= diff; - if (DEVOURINGFLAMETimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (target && !m_creature->HasInArc(M_PI, target)) DoCast(target, SPELL_DEVOURINGFLAME); - DEVOURINGFLAMETimer = 10000; } else DEVOURINGFLAMETimer -= diff; - if (FUSEARMORTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FUSEARMOR); FUSEARMORTimer = 10000; } else FUSEARMORTimer -= diff; - if (WingBuffetTimer < diff) { DoCast(m_creature->getVictim(), SPELL_WINGBUFFET); WingBuffetTimer = 7000 + ((rand()%8)*1000); } else WingBuffetTimer -= diff; - if (KnockAwayTimer < diff) { if (rand()%100 <= 30) @@ -191,34 +160,27 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI } KnockAwayTimer = 15000; } else KnockAwayTimer -= diff; - if (Phase == 3) { if (BellowingRoarTimer < diff) { DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); - BellowingRoarTimer = 30000; } else BellowingRoarTimer -= diff; - if (SummonAddsTimer < diff) { SummonAdds(Phase); - SummonAddsTimer = 45000; } else SummonAddsTimer -= diff; } - DoMeleeAttackIfReady(); } - if (Phase == 2) { if (InitialSpawn) { InitialSpawn = false; - - for(uint32 i = 0; i < 4; ++i) + for (uint32 i = 0; i < 4; ++i) { uint32 random = rand()%4; Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -227,14 +189,11 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI } } - if (FireballTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); - FireballTimer = 18000; } else FireballTimer -= diff; - if (MovementTimer < diff) { if (rand()%100 <= 30) @@ -243,19 +202,15 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI DoCast(m_creature->getVictim(), SPELL_FLAMEBUFFET); } else ChangePosition(); - MovementTimer = 25000; } else MovementTimer -= diff; - if (SummonAddsTimer < diff) { SummonAdds(Phase); - SummonAddsTimer = 45000; } else SummonAddsTimer -= diff; } } - void ChangePosition() { /* Malfunctioning, Razorscale is flying around randomly, attacking players from hundreds of yards away. @@ -263,13 +218,12 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI if (random<4){ m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);} */ } - void SummonAdds(uint32 Phase) { if (Phase == 2) { uint32 max = rand()%10; - for(uint32 i = 0; i < 4; ++i) + for (uint32 i = 0; i < 4; ++i) { uint32 random = rand()%3; Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -277,13 +231,12 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI Add->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } - if (Phase == 3) { uint32 max = rand() % 10 +1; if (max < 1) { - for(uint32 i = 0; i < max; ++i) + for (uint32 i = 0; i < max; ++i) { uint32 random = rand()%4; Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); @@ -294,12 +247,10 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI } } }; - CreatureAI* GetAI_boss_razorscale(Creature* pCreature) { return new boss_razorscaleAI (pCreature); } - void AddSC_boss_razorscale() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_thorim.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_thorim.cpp index d0bd4c87c04..66cb95be254 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_thorim.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_thorim.cpp @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - /* #define SAY_AGGRO -1 #define SAY_SLAY -1 */ - struct TRINITY_DLL_DECL boss_thorimAI : public BossAI { boss_thorimAI(Creature* pCreature) : BossAI(pCreature, TYPE_THORIM) @@ -31,52 +28,39 @@ struct TRINITY_DLL_DECL boss_thorimAI : public BossAI m_pInstance = pCreature->GetInstanceData(); Reset(); } - ScriptedInstance* m_pInstance; - void Reset() { } - void KilledUnit(Unit *victim) { } - void JustDied(Unit *victim) { if (m_pInstance) m_pInstance->SetData(TYPE_THORIM, DONE); } - void Aggro(Unit* pWho) { // DoScriptText(SAY_AGGRO, m_creature); m_creature->SetInCombatWithZone(); - if (m_pInstance) m_pInstance->SetData(TYPE_THORIM, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //SPELLS TODO: - // DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(diff); - } - }; - CreatureAI* GetAI_boss_thorim(Creature* pCreature) { return new boss_thorimAI(pCreature); } - void AddSC_boss_thorim() { Script *newscript; @@ -84,5 +68,4 @@ void AddSC_boss_thorim() newscript->Name = "boss_thorim"; newscript->GetAI = &GetAI_boss_thorim; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_xt002.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_xt002.cpp index e5889969716..9b497333e6d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_xt002.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_xt002.cpp @@ -15,34 +15,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - #define SPELL_SEARING_LIGHT 63018 #define SPELL_SONIC_BOOM 38897 - #define SAY_AGGRO -1000000 #define SAY_SLAY -1000001 - struct TRINITY_DLL_DECL boss_xt002_AI : public BossAI { boss_xt002_AI(Creature *pCreature) : BossAI(pCreature, TYPE_XT002) { m_pInstance = pCreature->GetInstanceData(); } - ScriptedInstance* m_pInstance; - uint32 SEARING_LIGHT_Timer; uint32 SONIC_BOOM_Timer; - void Reset() { SEARING_LIGHT_Timer = 100; SONIC_BOOM_Timer = 20; } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO,m_creature); @@ -51,22 +43,17 @@ struct TRINITY_DLL_DECL boss_xt002_AI : public BossAI { DoScriptText(SAY_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_SLAY, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_XT002, DONE); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if(m_creature->GetPositionX() < 700) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { m_creature->RemoveAllAuras(); @@ -74,24 +61,20 @@ struct TRINITY_DLL_DECL boss_xt002_AI : public BossAI m_creature->CombatStop(false); m_creature->GetMotionMaster()->MoveTargetedHome(); } - if (SEARING_LIGHT_Timer < diff) { DoCast(m_creature,SPELL_SEARING_LIGHT); DoScriptText(SAY_SLAY, m_creature); SEARING_LIGHT_Timer = 50000; } else SEARING_LIGHT_Timer -= diff; - if (SONIC_BOOM_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SONIC_BOOM); SONIC_BOOM_Timer = 20000; } else SONIC_BOOM_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_xt002(Creature* pCreature) { return new boss_xt002_AI (pCreature); @@ -99,7 +82,6 @@ CreatureAI* GetAI_boss_xt002(Creature* pCreature) void AddSC_boss_xt002() { Script *newscript; - newscript = new Script; newscript->Name = "boss_xt002"; newscript->GetAI = &GetAI_boss_xt002; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_yoggsaron.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_yoggsaron.cpp index a736b2db12a..b28c71f645d 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_yoggsaron.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_yoggsaron.cpp @@ -15,6 +15,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/def_ulduar.h b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/def_ulduar.h index ed7686343fb..5f1667dbfee 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/def_ulduar.h +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/def_ulduar.h @@ -15,14 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_ULDUAR_H #define DEF_ULDUAR_H - enum eTypes { MAX_ENCOUNTER = 14, - TYPE_LEVIATHAN = 0, TYPE_IGNIS = 1, TYPE_RAZORSCALE = 2, @@ -37,13 +34,11 @@ enum eTypes TYPE_VEZAX = 11, TYPE_YOGGSARON = 12, TYPE_ALGALON = 13, - DATA_STEELBREAKER = 20, DATA_MOLGEIM = 21, DATA_BRUNDIR = 22, DATA_RUNEMASTER_MOLGEIM = 23, DATA_STORMCALLER_BRUNDIR = 24, - NPC_LEVIATHAN = 33113, NPC_IGNIS = 33118, NPC_RAZORSCALE = 33186, @@ -61,5 +56,4 @@ enum eTypes NPC_YOGGSARON = 33288, NPC_ALGALON = 32871 }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/instance_ulduar.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/instance_ulduar.cpp index 4a4c441fffc..23a1eba2d16 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/instance_ulduar.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/instance_ulduar.cpp @@ -15,10 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_ulduar.h" - enum eGameObjects { GO_Kologarn_CHEST_HERO = 195047, @@ -30,14 +28,11 @@ enum eGameObjects GO_Freya_CHEST_HERO = 194325, GO_Freya_CHEST = 194324, }; - struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance { instance_ulduar(Map* pMap) : ScriptedInstance(pMap), KologarnChest(NULL), ThorimChest(NULL), HodirChest(NULL), FreyaChest(NULL) { Initialize(); }; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string m_strInstData; - uint64 m_uiLeviathanGUID; uint64 m_uiIgnisGUID; uint64 m_uiRazorscaleGUID; @@ -52,9 +47,7 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance uint64 m_uiVezaxGUID; uint64 m_uiYoggSaronGUID; uint64 m_uiAlgalonGUID; - GameObject* KologarnChest, *ThorimChest, *HodirChest, *FreyaChest; - void Initialize() { m_uiLeviathanGUID = 0; @@ -74,22 +67,18 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance ThorimChest = 0; HodirChest = 0; FreyaChest = 0; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); memset(&m_auiAssemblyGUIDs, 0, sizeof(m_auiAssemblyGUIDs)); } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { if (m_auiEncounter[i] == IN_PROGRESS) return true; } - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -106,7 +95,6 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance case NPC_XT002: m_uiXT002GUID = pCreature->GetGUID(); break; - // Assembly of Iron case NPC_STEELBREAKER: m_auiAssemblyGUIDs[0] = pCreature->GetGUID(); @@ -117,7 +105,6 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance case NPC_BRUNDIR: m_auiAssemblyGUIDs[2] = pCreature->GetGUID(); break; - case NPC_KOLOGARN: m_uiKologarnGUID = pCreature->GetGUID(); break; @@ -146,9 +133,7 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance m_uiAlgalonGUID = pCreature->GetGUID(); break; } - } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -163,7 +148,6 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance case GO_Freya_CHEST: FreyaChest = add ? pGo : NULL; break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -197,23 +181,17 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance m_auiEncounter[type] = data; break; } - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) saveStream << m_auiEncounter[i] << " "; - m_strInstData = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint64 GetData64(uint32 data) { switch(data) @@ -244,7 +222,6 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance return m_uiYoggSaronGUID; case TYPE_ALGALON: return m_uiAlgalonGUID; - // Assembly of Iron case DATA_STEELBREAKER: return m_auiAssemblyGUIDs[0]; @@ -253,10 +230,8 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance case DATA_BRUNDIR: return m_auiAssemblyGUIDs[2]; } - return 0; } - uint32 GetData(uint32 type) { switch(type) @@ -277,15 +252,12 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance case TYPE_ALGALON: return m_auiEncounter[type]; } - return 0; } - const char* Save() { return m_strInstData.c_str(); } - void Load(const char* strIn) { if (!strIn) @@ -293,28 +265,21 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(strIn); - std::istringstream loadStream(strIn); - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { loadStream >> m_auiEncounter[i]; - if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; } - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_ulduar(Map* pMap) { return new instance_ulduar(pMap); } - void AddSC_instance_ulduar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp index 3ea183059da..fb0d149eb09 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" #include "def_ulduar.h" - /* The teleporter appears to be active and stable. - - Expedition Base Camp - Formation Grounds - Colossal Forge @@ -12,7 +10,6 @@ The teleporter appears to be active and stable. - Shattered Walkway - Conservatory of Life */ - #define BASE_CAMP 200 #define GROUNDS 201 #define FORGE 202 @@ -20,12 +17,10 @@ The teleporter appears to be active and stable. #define ANTECHAMBER 204 #define WALKWAY 205 #define CONSERVATORY 206 - bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO ) { ScriptedInstance *pInstance = (ScriptedInstance *) pGO->GetInstanceData(); if(!pInstance) return true; - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP); pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS); if(pInstance->GetData(TYPE_LEVIATHAN) == DONE) @@ -44,15 +39,12 @@ bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO ) } } pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pGO->GetGUID()); - return true; } - bool GOSelect_ulduar_teleporter( Player *pPlayer, GameObject *pGO, uint32 sender, uint32 action ) { if(sender != GOSSIP_SENDER_MAIN) return true; if(!pPlayer->getAttackers().empty()) return true; - switch(action) { case BASE_CAMP: @@ -77,10 +69,8 @@ bool GOSelect_ulduar_teleporter( Player *pPlayer, GameObject *pGO, uint32 sender pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0); pPlayer->CLOSE_GOSSIP_MENU(); break; } - return true; } - void AddSC_ulduar_teleporter() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp index 86523ef0bf6..4cc6163c83b 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp @@ -15,29 +15,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ingvar_The_Plunderer SD%Complete: 95 SDComment: Some Problems with Annhylde Movement, Blizzlike Timers SDCategory: Udgarde Keep EndScriptData */ - #include "precompiled.h" #include "def_utgarde_keep.h" - enum eEnums { //Yells Ingvar YELL_AGGRO_1 = -1574005, YELL_AGGRO_2 = -1574006, - YELL_DEAD_1 = -1574007, YELL_DEAD_2 = -1574008, - YELL_KILL_1 = -1574009, YELL_KILL_2 = -1574010, - //Ingvar Spells human form MOB_INGVAR_HUMAN = 23954, SPELL_CLEAVE = 42724, @@ -47,15 +41,12 @@ enum eEnums H_SPELL_STAGGERING_ROAR = 59708, SPELL_ENRAGE = 42705, H_SPELL_ENRAGE = 59707, - MOB_ANNHYLDE_THE_CALLER = 24068, SPELL_INGVAR_FEIGN_DEATH = 42795, SPELL_SUMMON_BANSHEE = 42912, SPELL_SCOURG_RESURRECTION_EFFEKTSPAWN = 42863, //Spawn resurrecteffekt around Ingvar - MODEL_INGVAR_UNDEAD = 26351, MODEL_INGVAR_HUMAN = 21953, - //Ingvar Spells undead form MOB_INGVAR_UNDEAD = 23980, SPELL_DARK_SMASH = 42723, @@ -63,11 +54,9 @@ enum eEnums H_SPELL_DREADFUL_ROAR = 59734, SPELL_WOE_STRIKE = 42730, H_SPELL_WOE_STRIKE = 59735, - ENTRY_THROW_TARGET = 23996, SPELL_SHADOW_AXE_SUMMON = 42749 }; - struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI { boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c) @@ -75,44 +64,33 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; - bool HeroicMode; bool undead; bool event_inProgress; - uint32 Cleave_Timer; uint32 Smash_Timer; uint32 Enrage_Timer; uint32 Roar_Timer; uint32 SpawnResTimer; uint32 wait_Timer; - void Reset() { if (undead) // Visual Hack m_creature->SetDisplayId(MODEL_INGVAR_HUMAN); - undead = false; event_inProgress = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->SetStandState(UNIT_STAND_STATE_STAND); - Cleave_Timer = 2000; Smash_Timer = 5000; Enrage_Timer = 10000; Roar_Timer = 15000; - SpawnResTimer = 3000; - wait_Timer = 0; - if (pInstance) pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth() && !undead) @@ -128,19 +106,15 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); // visuel hack end - event_inProgress = true; undead = true; - DoScriptText(YELL_DEAD_1,m_creature); } - if (event_inProgress) { damage = 0; } } - void StartZombiePhase() { undead = true; @@ -148,37 +122,29 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_creature->AI()->AttackStart(m_creature->getVictim()); - DoScriptText(YELL_AGGRO_2,m_creature); } - void EnterCombat(Unit *who) { DoScriptText(YELL_AGGRO_1,m_creature); - if (pInstance) pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { DoScriptText(YELL_DEAD_2,m_creature); - if (pInstance) pInstance->SetData(DATA_INGVAR_EVENT, DONE); } - void KilledUnit(Unit *victim) { if (undead) { DoScriptText(YELL_KILL_1,m_creature); } else { DoScriptText(YELL_KILL_2,m_creature); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (event_inProgress) { if (SpawnResTimer) @@ -188,17 +154,14 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI //DoCast(m_creature,SPELL_SCOURG_RESURRECTION_EFFEKTSPAWN); // Dont needet ? SpawnResTimer = 0; }else SpawnResTimer -= diff; - return; } - // This is used for a spell queue ... the spells should not castet if one spell is already casting if (wait_Timer) if (wait_Timer < diff) { wait_Timer = 0; }else wait_Timer -= diff; - if (Cleave_Timer < diff) { if (!wait_Timer) @@ -208,11 +171,9 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI else DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = rand()%5000 + 2000; - wait_Timer = 1000; } }else Cleave_Timer -= diff; - if (Smash_Timer < diff) { if (!wait_Timer) @@ -222,11 +183,9 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI else DoCast(m_creature->getVictim(),HEROIC(SPELL_SMASH, H_SPELL_SMASH)); Smash_Timer = 10000; - wait_Timer = 5000; } }else Smash_Timer -= diff; - if (!undead) { if (Enrage_Timer < diff) @@ -245,7 +204,6 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI if (target) { Creature* temp = m_creature->SummonCreature(ENTRY_THROW_TARGET,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); - DoCast(m_creature,SPELL_SHADOW_AXE_SUMMON); } Enrage_Timer = 30000; @@ -253,7 +211,6 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI }else Enrage_Timer -= diff; } - if (Roar_Timer < diff) { if (!wait_Timer) @@ -263,44 +220,36 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI else DoCast(m_creature,HEROIC(SPELL_STAGGERING_ROAR, H_SPELL_STAGGERING_ROAR)); Roar_Timer = 10000; - wait_Timer = 5000; } }else Roar_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ingvar_the_plunderer(Creature* pCreature) { return new boss_ingvar_the_plundererAI (pCreature); } - enum eSpells { //we don't have that text in db so comment it until we get this text // YELL_RESSURECT = -1574025, - //Spells for Annhylde SPELL_SCOURG_RESURRECTION_HEAL = 42704, //Heal Max + DummyAura SPELL_SCOURG_RESURRECTION_BEAM = 42857, //Channeling Beam of Annhylde SPELL_SCOURG_RESURRECTION_DUMMY = 42862, //Some Emote Dummy? SPELL_INGVAR_TRANSFORM = 42796 }; - struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI { mob_annhylde_the_callerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - float x,y,z; ScriptedInstance* pInstance; uint32 Resurect_Timer; uint32 Resurect_Phase; - void Reset() { m_creature->AddUnitMovementFlag(MOVEMENTFLAG_FLYING + MOVEMENTFLAG_HOVER); @@ -308,19 +257,15 @@ struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI m_creature->SetSpeed(MOVE_RUN , 1.0f); m_creature->SetSpeed(MOVE_WALK , 1.0f); //m_creature->SetSpeed(MOVE_FLIGHT , 1.0f); - m_creature->GetPosition(x,y,z); DoTeleportTo(x+1,y,z+30); - Unit* ingvar = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); if (ingvar) { m_creature->GetMotionMaster()->MovePoint(1,x,y,z+15); - // DoScriptText(YELL_RESSURECT,m_creature); } } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) @@ -344,7 +289,6 @@ struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI } } } - void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void EnterCombat(Unit *who) {} @@ -372,39 +316,31 @@ struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI //ingvar->CastSpell(ingvar,SPELL_INGVAR_TRANSFORM,false); //ingvar->SetDisplayId(MODEL_INGVAR_UNDEAD); // Visual Hack - when he dies he becomes human model -> wrong Creature* c_ingvar = ingvar; - CAST_AI(boss_ingvar_the_plundererAI, (c_ingvar->AI()))->StartZombiePhase(); - m_creature->GetMotionMaster()->MovePoint(2,x+1,y,z+30); Resurect_Phase++; } } - }else Resurect_Timer -= diff; } }; - CreatureAI* GetAI_mob_annhylde_the_caller(Creature* pCreature) { return new mob_annhylde_the_callerAI (pCreature); } - enum eShadowAxe { SPELL_SHADOW_AXE_DAMAGE = 42750, H_SPELL_SHADOW_AXE_DAMAGE = 59719 }; - struct TRINITY_DLL_DECL mob_ingvar_throw_dummyAI : public ScriptedAI { mob_ingvar_throw_dummyAI(Creature *c) : ScriptedAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 Despawn_Timer; - void Reset() { Unit* target = m_creature->FindNearestCreature(ENTRY_THROW_TARGET,50); @@ -430,26 +366,21 @@ struct TRINITY_DLL_DECL mob_ingvar_throw_dummyAI : public ScriptedAI }else Despawn_Timer -= diff; } }; - CreatureAI* GetAI_mob_ingvar_throw_dummy(Creature* pCreature) { return new mob_ingvar_throw_dummyAI (pCreature); } - void AddSC_boss_ingvar_the_plunderer() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ingvar_the_plunderer"; newscript->GetAI = &GetAI_boss_ingvar_the_plunderer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_annhylde_the_caller"; newscript->GetAI = &GetAI_mob_annhylde_the_caller; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ingvar_throw_dummy"; newscript->GetAI = &GetAI_mob_ingvar_throw_dummy; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_keleseth.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_keleseth.cpp index bff13c8b4cc..b3075e26688 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_keleseth.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_keleseth.cpp @@ -15,21 +15,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Prince_Keleseth SD%Complete: 90 SDComment: Needs Prince Movements, Needs adjustments to blizzlike timers, Needs Shadowbolt castbar, Needs right Ressurect Visual, Needs Some Heroic Spells SDCategory: Utgarde Keep EndScriptData */ - #include "precompiled.h" #include "def_utgarde_keep.h" - enum eEnums { ACHIEVEMENT_ON_THE_ROCKS = 1919, - SPELL_SHADOWBOLT = 43667, SPELL_SHADOWBOLT_HEROIC = 59389, SPELL_FROST_TOMB = 48400, @@ -38,16 +34,13 @@ enum eEnums SPELL_SCOURGE_RESSURRECTION = 42704, CREATURE_FROSTTOMB = 23965, CREATURE_SKELETON = 23970, - SAY_AGGRO = -1574000, SAY_FROST_TOMB = -1574001, SAY_SKELETONS = -1574002, SAY_KILL = -1574003, SAY_DEATH = -1574004 }; - #define SKELETONSPAWN_Z 42.8668 - float SkeletonSpawnPoint[5][5]= { {156.2559, 259.2093}, @@ -56,35 +49,27 @@ float SkeletonSpawnPoint[5][5]= {156.2559, 259.2093}, {156.2559, 259.2093}, }; - float AttackLoc[3]={197.636, 194.046, 40.8164}; - bool ShatterFrostTomb; // needed for achievement: On The Rocks(1919) - struct TRINITY_DLL_DECL mob_frost_tombAI : public ScriptedAI { mob_frost_tombAI(Creature *c) : ScriptedAI(c) { FrostTombGUID = 0; } - uint64 FrostTombGUID; - void SetPrisoner(Unit* uPrisoner) { FrostTombGUID = uPrisoner->GetGUID(); } - void Reset(){ FrostTombGUID = 0; } void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} - void JustDied(Unit *killer) { if (killer->GetGUID() != m_creature->GetGUID()) ShatterFrostTomb = true; - if (FrostTombGUID) { Unit* FrostTomb = Unit::GetUnit((*m_creature),FrostTombGUID); @@ -92,7 +77,6 @@ struct TRINITY_DLL_DECL mob_frost_tombAI : public ScriptedAI FrostTomb->RemoveAurasDueToSpell(SPELL_FROST_TOMB); } } - void UpdateAI(const uint32 diff) { Unit* temp = Unit::GetUnit((*m_creature),FrostTombGUID); @@ -100,7 +84,6 @@ struct TRINITY_DLL_DECL mob_frost_tombAI : public ScriptedAI m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } }; - struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI { boss_kelesethAI(Creature *c) : ScriptedAI(c) @@ -108,9 +91,7 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI pInstance = c->GetInstanceData(); Heroic = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; - uint32 FrostTombTimer; uint32 SummonSkeletonsTimer; uint32 RespawnSkeletonsTimer; @@ -119,32 +100,24 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI bool Skeletons; bool Heroic; bool RespawnSkeletons; - void Reset() { ShadowboltTimer = 0; Skeletons = false; - ShatterFrostTomb = false; - ResetTimer(); - if (pInstance) pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(SAY_KILL, m_creature); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (Heroic && !ShatterFrostTomb) { AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); @@ -154,36 +127,30 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievOnTheRocks); } } } - if (pInstance) pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); - if (pInstance) pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); } - void ResetTimer(uint32 inc = 0) { SummonSkeletonsTimer = 5000 + inc; FrostTombTimer = 28000 + inc; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ShadowboltTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); @@ -191,13 +158,12 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI m_creature->CastSpell(target, Heroic ? SPELL_SHADOWBOLT_HEROIC : SPELL_SHADOWBOLT, true); ShadowboltTimer = 10000; }else ShadowboltTimer -= diff; - if (!Skeletons) if ((SummonSkeletonsTimer < diff)) { Creature* Skeleton; DoScriptText(SAY_SKELETONS, m_creature); - for(uint8 i = 0; i < 5; ++i) + for (uint8 i = 0; i < 5; ++i) { Skeleton = m_creature->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); if (Skeleton) @@ -210,7 +176,6 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI } Skeletons = true; }else SummonSkeletonsTimer -= diff; - if (FrostTombTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); @@ -222,44 +187,36 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI { CAST_AI(mob_frost_tombAI, Chains->AI())->SetPrisoner(target); Chains->CastSpell(target, SPELL_FROST_TOMB, true); - DoScriptText(SAY_FROST_TOMB, m_creature); } } FrostTombTimer = 15000; }else FrostTombTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI { mob_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 Respawn_Time; uint64 Target_Guid; uint32 Decrepify_Timer; - bool isDead; - void Reset() { Respawn_Time = 12000; Decrepify_Timer = 10000 + rand()%20000; isDead = false; } - void EnterCombat(Unit *who){} void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetGUID() == m_creature->GetGUID()) return; - if (damage >= m_creature->GetHealth()) { PretendToDie(); @@ -267,7 +224,6 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI } } - void PretendToDie() { isDead = true; @@ -278,14 +234,12 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); }; - void Resurrect() { isDead = false; m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->CastSpell(m_creature,SPELL_SCOURGE_RESSURRECTION,true); - if (m_creature->getVictim()) { m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); @@ -294,7 +248,6 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI else m_creature->GetMotionMaster()->Initialize(); }; - void UpdateAI(const uint32 diff) { if (pInstance && pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS) @@ -311,13 +264,11 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI { if (!UpdateVictim()) return; - if (Decrepify_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DECREPIFY); Decrepify_Timer = 30000; }else Decrepify_Timer -= diff; - DoMeleeAttackIfReady(); } }else @@ -325,39 +276,31 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI if (m_creature->isAlive()) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - } }; - CreatureAI* GetAI_mob_frost_tomb(Creature* pCreature) { return new mob_frost_tombAI(pCreature); } - CreatureAI* GetAI_boss_keleseth(Creature* pCreature) { return new boss_kelesethAI (pCreature); } - CreatureAI* GetAI_mob_vrykul_skeleton(Creature* pCreature) { return new mob_vrykul_skeletonAI (pCreature); } - void AddSC_boss_keleseth() { Script *newscript; - newscript = new Script; newscript->Name = "boss_keleseth"; newscript->GetAI = &GetAI_boss_keleseth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_frost_tomb"; newscript->GetAI = &GetAI_mob_frost_tomb; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_vrykul_skeleton"; newscript->GetAI = &GetAI_mob_vrykul_skeleton; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp index 0770f9209e9..0102efe51af 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp @@ -15,17 +15,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Skarvald_Dalronn SD%Complete: 95 SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB SDCategory: Utgarde Keep EndScriptData */ - #include "precompiled.h" #include "def_utgarde_keep.h" - enum eEnums { //signed for 24200, but used by 24200,27390 @@ -34,14 +31,12 @@ enum eEnums YELL_SKARVALD_SKA_DIEDFIRST = -1574013, YELL_SKARVALD_KILL = -1574014, YELL_SKARVALD_DAL_DIEDFIRST = -1574015, - //signed for 24201, but used by 24201,27389 YELL_DALRONN_AGGRO = -1574016, YELL_DALRONN_SKA_DIED = -1574017, YELL_DALRONN_DAL_DIEDFIRST = -1574018, YELL_DALRONN_KILL = -1574019, YELL_DALRONN_SKA_DIEDFIRST = -1574020, - //Spells of Skarvald and his Ghost MOB_SKARVALD_THE_CONSTRUCTOR = 24200, SPELL_CHARGE = 43651, @@ -57,7 +52,6 @@ enum eEnums SPELL_SUMMON_DALRONN_GHOST = 48612, MOB_DALRONN_GHOST = 27389 }; - struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI { boss_skarvald_the_constructorAI(Creature *c) : ScriptedAI(c) @@ -65,9 +59,7 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; - bool ghost; bool HeroicMode; uint32 Charge_Timer; @@ -75,39 +67,32 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI uint32 Response_Timer; uint32 Check_Timer; bool Dalronn_isDead; - void Reset() { Charge_Timer = 5000; StoneStrike_Timer = 10000; Dalronn_isDead = false; Check_Timer = 5000; - ghost = (m_creature->GetEntry() == MOB_SKARVALD_GHOST); if (!ghost && pInstance) { Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN)); if (dalronn && dalronn->isDead()) CAST_CRE(dalronn)->Respawn(); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); } } - void EnterCombat(Unit *who) { if (!ghost && pInstance) { DoScriptText(YELL_SKARVALD_AGGRO,m_creature); - Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN)); if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) dalronn->getThreatManager().addThreat(who,0.0f); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (!ghost && pInstance) @@ -118,13 +103,11 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI if (dalronn->isDead()) { DoScriptText(YELL_SKARVALD_DAL_DIED,m_creature); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); } else { DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST,m_creature); - m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); //DoCast(m_creature,SPELL_SUMMON_SKARVALD_GHOST,true); Creature* temp = m_creature->SummonCreature(MOB_SKARVALD_GHOST,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); @@ -137,7 +120,6 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (!ghost) @@ -145,7 +127,6 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI DoScriptText(YELL_SKARVALD_KILL,m_creature); } } - void UpdateAI(const uint32 diff) { if (ghost) @@ -153,10 +134,8 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - if (!UpdateVictim()) return; - if (!ghost) { if (Check_Timer) @@ -171,38 +150,31 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI Check_Timer = 0; } }else Check_Timer -= diff; - if (Response_Timer) if (Dalronn_isDead) if (Response_Timer < diff) { DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST,m_creature); - Response_Timer = 0; }else Response_Timer -= diff; } - if (Charge_Timer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE); Charge_Timer = 5000+rand()%5000; }else Charge_Timer -= diff; - if (StoneStrike_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_STONE_STRIKE); StoneStrike_Timer = 5000+rand()%5000; }else StoneStrike_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_skarvald_the_constructor(Creature* pCreature) { return new boss_skarvald_the_constructorAI (pCreature); } - struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI { boss_dalronn_the_controllerAI(Creature *c) : ScriptedAI(c) @@ -210,21 +182,17 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; - bool ghost; bool HeroicMode; uint32 ShadowBolt_Timer; uint32 Debilitate_Timer; uint32 Summon_Timer; - uint32 Response_Timer; uint32 Check_Timer; uint32 AggroYell_Timer; bool Skarvald_isDead; - void Reset() { ShadowBolt_Timer = 1000; @@ -233,18 +201,15 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI Check_Timer = 5000; Skarvald_isDead = false; AggroYell_Timer = 0; - ghost = m_creature->GetEntry() == MOB_DALRONN_GHOST; if (!ghost && pInstance) { Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD)); if (skarvald && skarvald->isDead()) CAST_CRE(skarvald)->Respawn(); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); } } - void EnterCombat(Unit *who) { if (!ghost) @@ -252,14 +217,11 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD)); if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) skarvald->getThreatManager().addThreat(who,0.0f); - AggroYell_Timer = 5000; - if (pInstance) pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (!ghost) @@ -269,14 +231,12 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI if (skarvald->isDead()) { DoScriptText(YELL_DALRONN_SKA_DIED,m_creature); - if (pInstance) pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); } else { DoScriptText(YELL_DALRONN_DAL_DIEDFIRST,m_creature); - m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); //DoCast(m_creature,SPELL_SUMMON_DALRONN_GHOST,true); Creature* temp = m_creature->SummonCreature(MOB_DALRONN_GHOST,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); @@ -288,7 +248,6 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (!ghost) @@ -296,7 +255,6 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI DoScriptText(YELL_DALRONN_KILL,m_creature); } } - void UpdateAI(const uint32 diff) { if (ghost) @@ -304,18 +262,14 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - if (!UpdateVictim()) return; - if (AggroYell_Timer) if (AggroYell_Timer < diff) { DoScriptText(YELL_DALRONN_AGGRO,m_creature); - AggroYell_Timer = 0; }else AggroYell_Timer -= diff; - if (!ghost) { if (Check_Timer) @@ -330,17 +284,14 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI Check_Timer = 0; } }else Check_Timer -= diff; - if (Response_Timer) if (Skarvald_isDead) if (Response_Timer < diff) { DoScriptText(YELL_DALRONN_SKA_DIEDFIRST,m_creature); - Response_Timer = 0; }else Response_Timer -= diff; } - if (ShadowBolt_Timer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -349,7 +300,6 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI ShadowBolt_Timer = 1000; } }else ShadowBolt_Timer -= diff; - if (Debilitate_Timer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) @@ -358,32 +308,26 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI Debilitate_Timer = 5000+rand()%5000; } }else Debilitate_Timer -= diff; - if (HeroicMode) if (Summon_Timer < diff) { DoCast(m_creature,H_SPELL_SUMMON_SKELETONS); Summon_Timer = (rand()%10000) + 20000; }else Summon_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_dalronn_the_controller(Creature* pCreature) { return new boss_dalronn_the_controllerAI (pCreature); } - void AddSC_boss_skarvald_dalronn() { Script *newscript; - newscript = new Script; newscript->Name = "boss_skarvald_the_constructor"; newscript->GetAI = &GetAI_boss_skarvald_the_constructor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_dalronn_the_controller"; newscript->GetAI = &GetAI_boss_dalronn_the_controller; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/def_utgarde_keep.h b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/def_utgarde_keep.h index b630e156564..0f4beff5d44 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/def_utgarde_keep.h +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/def_utgarde_keep.h @@ -15,21 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DEF_UTGARDE_KEEP_H #define DEF_UTGARDE_KEEP_H - #define DATA_PRINCEKELESETH 1 #define DATA_SKARVALD 3 #define DATA_DALRONN 4 #define DATA_INGVAR 6 - #define DATA_PRINCEKELESETH_EVENT 2 #define DATA_SKARVALD_DALRONN_EVENT 5 #define DATA_INGVAR_EVENT 7 - #define EVENT_FORGE_1 8 #define EVENT_FORGE_2 9 #define EVENT_FORGE_3 10 - #endif diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp index 744891371a9..4b15767090a 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp @@ -15,104 +15,82 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Utgarde_Keep SD%Complete: 90 SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Utgarde Keep Scripts SDCategory: Utgarde Keep EndScriptData */ - #include "precompiled.h" #include "def_utgarde_keep.h" - #define MAX_ENCOUNTER 3 - #define ENTRY_BELLOW_1 186688 #define ENTRY_BELLOW_2 186689 #define ENTRY_BELLOW_3 186690 - #define ENTRY_FORGEFIRE_1 186692 #define ENTRY_FORGEFIRE_2 186693 #define ENTRY_FORGEFIRE_3 186691 - #define ENTRY_GLOWING_ANVIL_1 186609 #define ENTRY_GLOWING_ANVIL_2 186610 #define ENTRY_GLOWING_ANVIL_3 186611 - #define ENTRY_GIANT_PORTCULLIS_1 186756 #define ENTRY_GIANT_PORTCULLIS_2 186694 - /* Utgarde Keep encounters: 0 - Prince Keleseth 1 - Skarvald Dalronn 2 - Ingvar the Plunderer */ - struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance { instance_utgarde_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 Keleseth; uint64 Skarvald; uint64 Dalronn; uint64 Ingvar; - uint64 forge_bellow[3]; uint64 forge_fire[3]; uint64 forge_anvil[3]; uint64 portcullis[2]; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 forge_event[3]; std::string str_data; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Keleseth = 0; Skarvald = 0; Dalronn = 0; Ingvar = 0; - - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { forge_bellow[i] = 0; forge_fire[i] = 0; forge_anvil[i] = 0; forge_event[i] = NOT_STARTED; } - portcullis[0] = 0; portcullis[1] = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* plr = itr->getSource()) return plr; } } - debug_log("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); return NULL; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -123,7 +101,6 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance case 23954: Ingvar = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -153,7 +130,6 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -163,10 +139,8 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance case DATA_SKARVALD: return Skarvald; case DATA_INGVAR: return Ingvar; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -229,13 +203,11 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance break; } - if (data == DONE) { SaveToDB(); } } - uint32 GetData(uint32 type) { switch(type) @@ -244,24 +216,18 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; case DATA_INGVAR_EVENT: return m_auiEncounter[2]; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -269,40 +235,30 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0,data1,data2, data3, data4, data5; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - if (dataHead1 == 'U' && dataHead2 == 'K') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - forge_event[0] = data3; forge_event[1] = data4; forge_event[2] = data5; - }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_utgarde_keep(Map* pMap) { return new instance_utgarde_keep(pMap); } - void AddSC_instance_utgarde_keep() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.cpp index 6dd5b242517..0faf485eb98 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.cpp @@ -15,17 +15,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "def_utgarde_keep.h" - uint32 entry_search[3] = { 186609, 186610, 186611 }; - struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI { npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) @@ -33,16 +30,13 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI pInstance = c->GetInstanceData(); fm_Type = 0; } - ScriptedInstance* pInstance; uint8 fm_Type; - void Reset() { if (fm_Type == 0) fm_Type = GetForgeMasterType(); CheckForge(); } - void CheckForge() { if (pInstance) @@ -61,7 +55,6 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI } } } - void JustDied(Unit *killer) { if (fm_Type == 0) fm_Type = GetForgeMasterType(); @@ -81,7 +74,6 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { if (fm_Type == 0) fm_Type = GetForgeMasterType(); @@ -102,13 +94,11 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI } m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); } - uint8 GetForgeMasterType() { float diff = 30.0f; int near_f = 0; - - for(uint8 i = 0; i < 3 ; ++i) + for (uint8 i = 0; i < 3 ; ++i) { GameObject* temp; temp = m_creature->FindNearestGameObject(entry_search[i],30); @@ -118,11 +108,9 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI { near_f = i + 1; diff = m_creature->GetDistance2d(temp); - } } } - switch (near_f) { case 1: return 1; @@ -131,28 +119,22 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI default: return 0; } } - void UpdateAI(const uint32 diff) { if (fm_Type == 0) fm_Type = GetForgeMasterType(); - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_dragonflayer_forge_master(Creature* pCreature) { return new npc_dragonflayer_forge_masterAI(pCreature); } - void AddSC_utgarde_keep() { Script *newscript; - newscript = new Script; newscript->Name = "npc_dragonflayer_forge_master"; newscript->GetAI = &GetAI_npc_dragonflayer_forge_master; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp index db5394de8c3..cec37e66377 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp @@ -5,92 +5,73 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_palehoof' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_pinnacle.h" - //Spells #define SPELL_ARCING_SMASH 48260 #define SPELL_IMPALE 48261 #define H_SPELL_IMPALE 59268 #define SPELL_WITHERING_ROAR 48256 #define H_SPELL_WITHERING_ROAR 59267 - #define SPELL_FREEZE 16245 - //ravenous furbolg's spells #define SPELL_CHAIN_LIGHTING 48140 #define H_SPELL_CHAIN_LIGHTING 59273 #define SPELL_CRAZED 48139 #define SPELL_TERRIFYING_ROAR 48144 - //frenzied worgen's spells #define SPELL_MORTAL_WOUND 48137 #define H_SPELL_MORTAL_WOUND 59265 #define SPELL_ENRAGE_1 48138 #define SPELL_ENRAGE_2 48142 - //ferocious rhino's spells #define SPELL_GORE 48130 #define H_SPELL_GORE 59264 #define SPELL_GRIEVOUS_WOUND 48105 #define H_SPELL_GRIEVOUS_WOUND 59263 #define SPELL_STOMP 48131 - //massive jormungar's spells #define SPELL_ACID_SPIT 48132 #define SPELL_ACID_SPLATTER 48136 #define H_SPELL_ACID_SPLATTER 59272 #define SPELL_POISON_BREATH 48133 #define H_SPELL_POISON_BREATH 59271 - #define CREATURE_JORMUNGAR_WORM 27228 - //not in db //Yell #define SAY_AGGRO -1575000 #define SAY_SLAY_1 -1575001 #define SAY_SLAY_2 -1575002 #define SAY_DEATH -1575003 - struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI { boss_palehoofAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiArcingSmashTimer; uint32 uiImpaleTimer; uint32 uiWhiteringRoarTimer; uint32 uiWaitingTimer; - uint8 Phase; - bool bWaiting; - ScriptedInstance *pInstance; - void Reset() { uiArcingSmashTimer = 15000; uiImpaleTimer = 12000; uiWhiteringRoarTimer = 10000; - Phase = 0; bWaiting = false; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(m_creature, SPELL_FREEZE); - if (pInstance) { pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - Creature* pTemp; if ((pTemp = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN))) && !pTemp->isAlive()) pTemp->Respawn(); @@ -100,7 +81,6 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI pTemp->Respawn(); if ((pTemp = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG))) && !pTemp->isAlive()) pTemp->Respawn(); - if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE))) { pGo->SetGoState(GO_STATE_READY); @@ -108,12 +88,10 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI } } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { if (Phase == 6) @@ -121,26 +99,22 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if (uiArcingSmashTimer < diff) { DoCast(m_creature,SPELL_ARCING_SMASH); uiArcingSmashTimer = 13000 + rand()%4000; } else uiArcingSmashTimer -= diff; - if (uiImpaleTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, HEROIC(SPELL_IMPALE, H_SPELL_IMPALE)); uiImpaleTimer = 8000 + rand()%4000; } else uiImpaleTimer -= diff; - if (uiWhiteringRoarTimer < diff) { DoCast(m_creature, HEROIC(SPELL_WITHERING_ROAR, H_SPELL_WITHERING_ROAR)); uiWhiteringRoarTimer = 8000 + rand()%4000; } else uiWhiteringRoarTimer -= diff; - DoMeleeAttackIfReady(); } else if (Phase != 0 && bWaiting) @@ -156,7 +130,6 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI case 4: pNext = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; case 5: pNext = m_creature; ++Phase; break; } - if (pNext) { pNext->RemoveAurasDueToSpell(SPELL_FREEZE); @@ -165,24 +138,20 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI ((Unit*)pNext)->SetStandState(UNIT_STAND_STATE_STAND); pNext->SetInCombatWithZone(); } - bWaiting = false; } else uiWaitingTimer -= diff; } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); if (pInstance) pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void NextPhase() { ++Phase; @@ -190,66 +159,53 @@ struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI uiWaitingTimer = 1000; } }; - struct TRINITY_DLL_DECL mob_ravenous_furbolgAI : public ScriptedAI { mob_ravenous_furbolgAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiChainLightingTimer; uint32 uiCrazedTimer; uint32 uiTerrifyingRoarTimer; - ScriptedInstance *pInstance; - void Reset() { uiChainLightingTimer = 5000; uiCrazedTimer = 10000; uiTerrifyingRoarTimer = 15000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(m_creature, SPELL_FREEZE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiChainLightingTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_CHAIN_LIGHTING, H_SPELL_CHAIN_LIGHTING)); uiChainLightingTimer = 5000 + rand()%5000; } else uiChainLightingTimer -= diff; - if (uiCrazedTimer < diff) { DoCast(m_creature, SPELL_CRAZED); uiCrazedTimer = 8000 + rand()%4000; } else uiCrazedTimer -= diff; - if (uiTerrifyingRoarTimer < diff) { DoCast(m_creature, SPELL_TERRIFYING_ROAR); uiTerrifyingRoarTimer = 10000 + rand()%10000; } else uiTerrifyingRoarTimer -= diff; - DoMeleeAttackIfReady(); } - void AttackStart(Unit* who) { if (!who) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (m_creature->Attack(who, true)) { m_creature->AddThreat(who, 0.0f); @@ -258,7 +214,6 @@ struct TRINITY_DLL_DECL mob_ravenous_furbolgAI : public ScriptedAI DoStartMovement(who); } } - void JustDied(Unit* killer) { if (pInstance) @@ -269,66 +224,53 @@ struct TRINITY_DLL_DECL mob_ravenous_furbolgAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_frenzied_worgenAI : public ScriptedAI { mob_frenzied_worgenAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiMortalWoundTimer; uint32 uiEnrage1Timer; uint32 uiEnrage2Timer; - ScriptedInstance *pInstance; - void Reset() { uint32 uiMortalWoundTimer = 5000; uint32 uiEnrage1Timer = 15000; uint32 uiEnrage2Timer = 10000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(m_creature, SPELL_FREEZE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiMortalWoundTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_MORTAL_WOUND, H_SPELL_MORTAL_WOUND)); uiMortalWoundTimer = 3000 + rand()%4000; } else uiMortalWoundTimer -= diff; - if (uiEnrage1Timer < diff) { DoCast(m_creature, SPELL_ENRAGE_1); uiEnrage1Timer = 15000; } else uiEnrage1Timer -= diff; - if (uiEnrage2Timer < diff) { DoCast(m_creature, SPELL_ENRAGE_2); uiEnrage2Timer = 10000; } else uiEnrage2Timer -= diff; - DoMeleeAttackIfReady(); } - void AttackStart(Unit* who) { if (!who) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (m_creature->Attack(who, true)) { m_creature->AddThreat(who, 0.0f); @@ -339,7 +281,6 @@ struct TRINITY_DLL_DECL mob_frenzied_worgenAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); } - void JustDied(Unit* killer) { if (pInstance) @@ -350,67 +291,54 @@ struct TRINITY_DLL_DECL mob_frenzied_worgenAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_ferocious_rhinoAI : public ScriptedAI { mob_ferocious_rhinoAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiStompTimer; uint32 uiGoreTimer; uint32 uiGrievousWoundTimer; - ScriptedInstance *pInstance; - void Reset() { uiStompTimer = 10000; uiGoreTimer = 15000; uiGrievousWoundTimer = 20000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(m_creature, SPELL_FREEZE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiStompTimer < diff) { DoCast(m_creature->getVictim(), SPELL_STOMP); uiStompTimer = 8000 + rand()%4000; } else uiStompTimer -= diff; - if (uiGoreTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_GORE, H_SPELL_GORE)); uiGoreTimer = 13000 + rand()%4000; } else uiGoreTimer -= diff; - if (uiGrievousWoundTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, HEROIC(SPELL_GRIEVOUS_WOUND, H_SPELL_GRIEVOUS_WOUND)); uiGrievousWoundTimer = 18000 + rand()%4000; } else uiGrievousWoundTimer -= diff; - DoMeleeAttackIfReady(); } - void AttackStart(Unit* who) { if (!who) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (m_creature->Attack(who, true)) { m_creature->AddThreat(who, 0.0f); @@ -419,7 +347,6 @@ struct TRINITY_DLL_DECL mob_ferocious_rhinoAI : public ScriptedAI DoStartMovement(who); } } - void JustDied(Unit* killer) { if (pInstance) @@ -430,68 +357,55 @@ struct TRINITY_DLL_DECL mob_ferocious_rhinoAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_massive_jormungarAI : public ScriptedAI { mob_massive_jormungarAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiAcidSpitTimer; uint32 uiAcidSplatterTimer; uint32 uiPoisonBreathTimer; - ScriptedInstance *pInstance; - void Reset() { uiAcidSpitTimer = 3000; uiAcidSplatterTimer = 12000; uiPoisonBreathTimer = 10000; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(m_creature, SPELL_FREEZE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiAcidSpitTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_ACID_SPIT); uiAcidSpitTimer = 2000 + rand()%2000; } else uiAcidSpitTimer -= diff; - if (uiAcidSplatterTimer < diff) { DoCast(m_creature, HEROIC(SPELL_POISON_BREATH, H_SPELL_POISON_BREATH)); uiAcidSplatterTimer = 10000 + rand()%4000; } else uiAcidSplatterTimer -= diff; - if (uiPoisonBreathTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, HEROIC(SPELL_POISON_BREATH, H_SPELL_POISON_BREATH)); uiPoisonBreathTimer = 8000 + rand()%4000; } else uiPoisonBreathTimer -= diff; - DoMeleeAttackIfReady(); } - void AttackStart(Unit* who) { if (!who) return; - if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (m_creature->Attack(who, true)) { m_creature->AddThreat(who, 0.0f); @@ -500,7 +414,6 @@ struct TRINITY_DLL_DECL mob_massive_jormungarAI : public ScriptedAI DoStartMovement(who); } } - void JustDied(Unit* killer) { if (pInstance) @@ -511,77 +424,62 @@ struct TRINITY_DLL_DECL mob_massive_jormungarAI : public ScriptedAI } } }; - bool GOHello_palehoof_sphere(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); - Creature *pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); if (pPalehoof && pPalehoof->isAlive()) { // maybe these are hacks :( pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); pGO->SetGoState(GO_STATE_ACTIVE); - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); } return true; } - CreatureAI* GetAI_boss_palehoof(Creature* pCreature) { return new boss_palehoofAI (pCreature); } - CreatureAI* GetAI_mob_ravenous_furbolg(Creature* pCreature) { return new mob_ravenous_furbolgAI (pCreature); } - CreatureAI* GetAI_mob_frenzied_worgen(Creature* pCreature) { return new mob_frenzied_worgenAI (pCreature); } - CreatureAI* GetAI_mob_ferocious_rhino(Creature* pCreature) { return new mob_ferocious_rhinoAI (pCreature); } - CreatureAI* GetAI_mob_massive_jormungar(Creature* pCreature) { return new mob_massive_jormungarAI (pCreature); } - void AddSC_boss_palehoof() { Script *newscript; - newscript = new Script; newscript->Name = "boss_palehoof"; newscript->GetAI = &GetAI_boss_palehoof; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ravenous_furbolg"; newscript->GetAI = &GetAI_mob_ravenous_furbolg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_frenzied_worgen"; newscript->GetAI = &GetAI_mob_frenzied_worgen; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ferocious_rhino"; newscript->GetAI = &GetAI_mob_ferocious_rhino; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_massive_jormungar"; newscript->GetAI = &GetAI_mob_massive_jormungar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_palehoof_sphere"; newscript->pGOHello=&GOHello_palehoof_sphere; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp index 4710d8dec82..1b1fa225049 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp @@ -5,17 +5,14 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_skadi' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_pinnacle.h" - //Phase 0 "gauntlet even" Skadi on a flying mount, waves of adds charging to the group periodicaly carrying harpoons //Phase 1 Kill the Skadi drake mount with harppons launcher //Phase 2 Kill the Skadi - //Skadi Spells #define SPELL_CRUSH 50234 #define H_SPELL_CRUSH 59330 @@ -23,14 +20,11 @@ update creature_template set scriptname = 'boss_skadi' where entry = ''; #define H_SPELL_POISONED_SPEAR 59331 #define SPELL_WHIRLWIND 50228 //random target, but not the tank approx. every 20s #define H_SPELL_WHIRLWIND 59332 - //Spawned creatures #define CREATURE_YMIRJAR_WARRIOR 26690 #define CREATURE_YMIRJAR_WITCH_DOCTOR 26691 #define CREATURE_YMIRJAR_HARPOONER 26692 - #define DATA_MOUNT 27043 - //not in db //Yell #define SAY_AGGRO -1575004 @@ -44,14 +38,12 @@ update creature_template set scriptname = 'boss_skadi' where entry = ''; #define SAY_DRAKE_BREATH_1 -1575012 #define SAY_DRAKE_BREATH_2 -1575013 #define SAY_DRAKE_BREATH_3 -1575014 - //Spawn locations struct Locations { float x, y, z; uint32 id; }; - static Locations SpawnLoc[]= { {340.556, -511.493, 104.352}, @@ -60,65 +52,50 @@ static Locations SpawnLoc[]= {430.551, -514.320, 105.055}, {468.931, -513.555, 104.723} }; - enum CombatPhase { FLYING, SKADI }; - struct TRINITY_DLL_DECL boss_skadiAI : public ScriptedAI { boss_skadiAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiCrushTimer; uint32 uiPoisonedSpearTimer; uint32 uiWhirlwindTimer; uint32 uiMovementTimer; uint32 uiWaypointId; uint32 uiSpawnCounter; - CombatPhase Phase; - ScriptedInstance* pInstance; - void Reset() { uiCrushTimer = 8000; uiPoisonedSpearTimer = 10000; uiWhirlwindTimer = 20000; uiSpawnCounter = 0; - uiWaypointId = 0; - Phase = SKADI; - m_creature->Unmount(); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - m_creature->Mount(DATA_MOUNT); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->GetMotionMaster()->MovePoint(uiWaypointId, 340.259, -510.541, 120.869); - Phase = FLYING; - if (pInstance) pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { switch(Phase) @@ -146,49 +123,40 @@ struct TRINITY_DLL_DECL boss_skadiAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if (uiCrushTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_CRUSH, H_SPELL_CRUSH)); uiCrushTimer = 8000; } else uiCrushTimer -= diff; - if (uiPoisonedSpearTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(pTarget, HEROIC(SPELL_POISONED_SPEAR, H_SPELL_POISONED_SPEAR)); uiPoisonedSpearTimer = 10000; } else uiPoisonedSpearTimer -= diff; - if (uiWhirlwindTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) m_creature->CastSpell(pTarget, HEROIC(SPELL_WHIRLWIND, H_SPELL_WHIRLWIND), false); } else uiWhirlwindTimer = 20000; - DoMeleeAttackIfReady(); break; } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), m_creature); } - void MovementInform(uint32 type, uint32 id) { if(type != POINT_MOTION_TYPE) return; - if (HeroicMode ? (uiSpawnCounter >= 4) : (uiSpawnCounter >= 5)) { uiWaypointId = 200; @@ -213,11 +181,10 @@ struct TRINITY_DLL_DECL boss_skadiAI : public ScriptedAI } } } - void SpawnMobs(uint32 spot) { uint8 uiMaxSpawn = (HeroicMode ? 6 : 5); - for(uint8 i = 0; i < uiMaxSpawn; ++i) + for (uint8 i = 0; i < uiMaxSpawn; ++i) { Creature* pTemp; switch (rand()%3) @@ -235,16 +202,13 @@ struct TRINITY_DLL_DECL boss_skadiAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_skadi(Creature* pCreature) { return new boss_skadiAI (pCreature); } - void AddSC_boss_skadi() { Script *newscript; - newscript = new Script; newscript->Name = "boss_skadi"; newscript->GetAI = &GetAI_boss_skadi; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_svala.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_svala.cpp index 137b445e93a..ef2fc77b4c7 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_svala.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_svala.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_svala' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_pinnacle.h" - enum Spells { SPELL_CALL_FLAMES = 48258, @@ -75,35 +73,26 @@ static Locations RitualChannelerLocations[]= {302.36, -352.01, 90.54}, {291.39, -350.89, 90.54} }; - struct TRINITY_DLL_DECL boss_svalaAI : public ScriptedAI { boss_svalaAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiIntroTimer; - uint8 uiIntroPhase; - IntroPhase Phase; - Creature* pArthas; - ScriptedInstance* pInstance; - void Reset() { Phase = IDLE; uiIntroTimer = 1000; uiIntroPhase = 0; pArthas = NULL; - if (pInstance) pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); } - void MoveInLineOfSight(Unit* pWho) { if (!pWho) @@ -112,7 +101,6 @@ struct TRINITY_DLL_DECL boss_svalaAI : public ScriptedAI { Phase = INTRO; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pArthas = m_creature->SummonCreature(CREATURE_ARTHAS, 295.81, -366.16, 92.57, 1.58, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) { pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -121,19 +109,15 @@ struct TRINITY_DLL_DECL boss_svalaAI : public ScriptedAI } } } - void AttackStart(Unit* who) {} - void UpdateAI(const uint32 diff) { if (Phase != INTRO) return; - if (uiIntroTimer < diff) { if(!pArthas) return; - switch (uiIntroPhase) { case 0: @@ -182,21 +166,17 @@ struct TRINITY_DLL_DECL boss_svalaAI : public ScriptedAI } else uiIntroTimer -= diff; } }; - struct TRINITY_DLL_DECL mob_ritual_channelerAI : public ScriptedAI { mob_ritual_channelerAI(Creature *c) :ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void Reset() { DoCast(m_creature, SPELL_SHADOWS_IN_THE_DARK); } - void EnterCombat(Unit* who) { if (who && who->HasAura(SPELL_PARALYZE,0)) @@ -204,53 +184,40 @@ struct TRINITY_DLL_DECL mob_ritual_channelerAI : public ScriptedAI return; } }; - struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI { boss_svala_sorrowgraveAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiSinsterStrikeTimer; uint32 uiCallFlamesTimer; uint32 uiRitualOfSwordTimer; uint32 uiSacrificeTimer; - CombatPhase Phase; - Creature* pRitualChanneler[3]; Unit* pSacrificeTarget; - ScriptedInstance* pInstance; - void Reset() { uiSinsterStrikeTimer = 7000; uiCallFlamesTimer = 10000; uiRitualOfSwordTimer = 20000; uiSacrificeTimer = 8000; - Phase = NORMAL; - DoTeleportTo(296.632, -346.075, 90.6307); - for (uint8 i = 0; i < 3; ++i) pRitualChanneler[i] = NULL; pSacrificeTarget = NULL; - if (pInstance) pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (Phase == NORMAL) @@ -258,13 +225,11 @@ struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if (uiSinsterStrikeTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SINSTER_STRIKE, H_SPELL_SINSTER_STRIKE)); uiSinsterStrikeTimer = 5000 + rand()%4000; } else uiSinsterStrikeTimer -= diff; - if (uiCallFlamesTimer < diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -274,7 +239,6 @@ struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI uiCallFlamesTimer = 8000 + rand()%4000; } } else uiCallFlamesTimer -= diff; - if (uiRitualOfSwordTimer < diff) { pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); @@ -287,16 +251,13 @@ struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLY_MODE); DoTeleportTo(296.632, -346.075, 120.85); Phase = SACRIFICING; - for (uint8 i = 0; i < 3; ++i) if (pRitualChanneler[i] = m_creature->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerLocations[i].x, RitualChannelerLocations[i].y, RitualChannelerLocations[i].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) if (mob_ritual_channelerAI *pChannelerAI = CAST_AI(mob_ritual_channelerAI,pRitualChanneler[i]->AI())) pChannelerAI->AttackStartNoMove(pSacrificeTarget); - uiRitualOfSwordTimer = urand(18000,22000); } } else uiRitualOfSwordTimer -= diff; - DoMeleeAttackIfReady(); } else //SACRIFICING @@ -314,25 +275,21 @@ struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI } if (bSacrificed && pSacrificeTarget && pSacrificeTarget->isAlive()) m_creature->Kill(pSacrificeTarget, false); // durability damage? - //go down Phase = NORMAL; pSacrificeTarget = NULL; m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) m_creature->GetMotionMaster()->MoveChase(pTarget); - uiSacrificeTimer = 8000; } else uiSacrificeTimer -= diff; } } - void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void JustDied(Unit* pKiller) { if (pInstance) @@ -340,42 +297,34 @@ struct TRINITY_DLL_DECL boss_svala_sorrowgraveAI : public ScriptedAI Creature* pSvala = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_SVALA)); if (pSvala && pSvala->isAlive()) pKiller->Kill(pSvala); - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); } DoScriptText(SAY_DEATH, m_creature); } }; - CreatureAI* GetAI_boss_svala(Creature* pCreature) { return new boss_svalaAI (pCreature); } - CreatureAI* GetAI_mob_ritual_channeler(Creature* pCreature) { return new mob_ritual_channelerAI(pCreature); } - CreatureAI* GetAI_boss_svala_sorrowgrave(Creature* pCreature) { return new boss_svala_sorrowgraveAI(pCreature); } - void AddSC_boss_svala() { Script *newscript; - newscript = new Script; newscript->Name = "boss_svala"; newscript->GetAI = &GetAI_boss_svala; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ritual_channeler"; newscript->GetAI = &GetAI_mob_ritual_channeler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_svala_sorrowgrave"; newscript->GetAI = &GetAI_boss_svala_sorrowgrave; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp index df72278c684..0ac94a7f4f5 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = 'boss_ymiron' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_pinnacle.h" - enum Spells { SPELL_BANE = 48294, @@ -25,17 +23,13 @@ enum Spells SPELL_SPIRIT_STRIKE = 48423, H_SPELL_SPIRIT_STRIKE = 59304, SPELL_ANCESTORS_VENGEANCE = 16939, - SPELL_SUMMON_AVENGING_SPIRIT = 48592, SPELL_SUMMON_SPIRIT_FOUNT = 48386, - SPELL_CHANNEL_SPIRIT_TO_YMIRON = 48316, SPELL_CHANNEL_YMIRON_TO_SPIRIT = 48307, - SPELL_SPIRIT_FOUNT = 48380, H_SPELL_SPIRIT_FOUNT = 59320 }; - //not in db enum Yells { @@ -50,7 +44,6 @@ enum Yells SAY_SUMMON_RANULF = -1575036, SAY_SUMMON_TORGYN = -1575037 }; - enum Creatures { CREATURE_BJORN = 27303, @@ -64,14 +57,12 @@ enum Creatures CREATURE_SPIRIT_FOUNT = 27339, CREATURE_AVENGING_SPIRIT = 27386 }; - struct ActiveBoatStruct { uint32 npc; uint32 say; float MoveX,MoveY,MoveZ,SpawnX,SpawnY,SpawnZ,SpawnO; }; - static ActiveBoatStruct ActiveBot[4] = { {CREATURE_BJORN_VISUAL, SAY_SUMMON_BJORN, 404.379, -335.335, 104.756, 413.594, -335.408, 107.995, 3.157}, @@ -79,7 +70,6 @@ static ActiveBoatStruct ActiveBot[4] = {CREATURE_RANULF_VISUAL, SAY_SUMMON_RANULF, 381.546, -314.362, 104.756, 370.841, -314.426, 107.995, 6.232}, {CREATURE_TORGYN_VISUAL, SAY_SUMMON_TORGYN, 404.310, -314.761, 104.756, 413.992, -314.703, 107.995, 3.157} }; - struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI { boss_ymironAI(Creature *c) : ScriptedAI(c) @@ -96,36 +86,28 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI m_uiActiveOrder[r] = temp; } } - bool m_bIsWalking; bool m_bIsPause; bool m_bIsActiveWithBJORN; bool m_bIsActiveWithHALDOR; bool m_bIsActiveWithRANULF; bool m_bIsActiveWithTORGYN; - uint8 m_uiActiveOrder[4]; uint8 m_uiActivedNumber; - uint32 m_uiFetidRot_Timer; uint32 m_uiBane_Timer; uint32 m_uiDarkSlash_Timer; uint32 m_uiAncestors_Vengeance_Timer; - uint32 m_uiAbility_BJORN_Timer; uint32 m_uiAbility_HALDOR_Timer; uint32 m_uiAbility_RANULF_Timer; uint32 m_uiAbility_TORGYN_Timer; - uint32 m_uiPause_Timer; uint32 m_uiHealthAmountModifier; uint32 m_uiHealthAmountMultipler; - uint64 m_uiActivedCreatureGUID; uint64 m_uiOrbGUID; - ScriptedInstance *pInstance; - void Reset() { m_bIsPause = false; @@ -133,37 +115,29 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; - m_uiFetidRot_Timer = urand(8000,13000); m_uiBane_Timer = urand(18000,23000); m_uiDarkSlash_Timer = urand(28000,33000); m_uiAncestors_Vengeance_Timer = HEROIC(60000,45000); m_uiPause_Timer = 0; - m_uiAbility_BJORN_Timer = 0; m_uiAbility_HALDOR_Timer = 0; m_uiAbility_RANULF_Timer = 0; m_uiAbility_TORGYN_Timer = 0; - m_uiActivedNumber = 0; m_uiHealthAmountModifier = 1; m_uiHealthAmountMultipler = HEROIC(20,25); - DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); - if (pInstance) pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (m_bIsWalking) @@ -187,7 +161,6 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI case 3: m_bIsActiveWithTORGYN = true; break; } } - m_bIsPause = true; m_bIsWalking = false; m_uiPause_Timer = 3000; @@ -202,17 +175,14 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI m_uiAbility_HALDOR_Timer = 5000; m_uiAbility_RANULF_Timer = 5000; m_uiAbility_TORGYN_Timer = 5000; - m_bIsPause = false; m_uiPause_Timer = 0; } else m_uiPause_Timer -= diff; return; } - //Return since we have no target if (!UpdateVictim()) return; - if (!m_bIsPause) { // Normal spells ------------------------------------------------------------------------ @@ -221,25 +191,21 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI DoCast(m_creature, HEROIC(SPELL_BANE, H_SPELL_BANE)); m_uiBane_Timer = urand(20000,25000); } else m_uiBane_Timer -= diff; - if (m_uiFetidRot_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_FETID_ROT, H_SPELL_FETID_ROT)); m_uiFetidRot_Timer = urand(10000,15000); } else m_uiFetidRot_Timer -= diff; - if (m_uiDarkSlash_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_DARK_SLASH); m_uiDarkSlash_Timer = urand(30000,35000); } else m_uiDarkSlash_Timer -= diff; - if (m_uiAncestors_Vengeance_Timer < diff) { DoCast(m_creature, SPELL_ANCESTORS_VENGEANCE); m_uiAncestors_Vengeance_Timer = HEROIC(urand(60000,65000),urand(45000,50000)); } else m_uiAncestors_Vengeance_Timer -= diff; - // Abilities ------------------------------------------------------------------------------ if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer < diff) { @@ -256,26 +222,23 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI } m_bIsActiveWithBJORN = false; // only one orb } else m_uiAbility_BJORN_Timer -= diff; - if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SPIRIT_STRIKE, H_SPELL_SPIRIT_STRIKE)); m_uiAbility_HALDOR_Timer = 5000; // overtime } else m_uiAbility_HALDOR_Timer -= diff; - if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer < diff) { DoCast(m_creature, HEROIC(SPELL_SPIRIT_BURST, H_SPELL_SPIRIT_BURST)); m_uiAbility_RANULF_Timer = 10000; // overtime } else m_uiAbility_RANULF_Timer -= diff; - if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer < diff) { float x,y,z; x = m_creature->GetPositionX()-5; y = m_creature->GetPositionY()-5; z = m_creature->GetPositionZ(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { //DoCast(m_creature, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control if (Creature* pTemp = m_creature->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) @@ -289,33 +252,27 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI } m_uiAbility_TORGYN_Timer = 15000; // overtime } else m_uiAbility_TORGYN_Timer -= diff; - // Health check ----------------------------------------------------------------------------- if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier))) { uint8 m_uiOrder = m_uiHealthAmountModifier - 1; ++m_uiHealthAmountModifier; - m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature, SPELL_SCREAMS_OF_THE_DEAD); m_creature->GetMotionMaster()->Clear(); m_creature->StopMoving(); m_creature->AttackStop(); m_creature->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); - DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); - m_bIsActiveWithBJORN = false; m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; - m_uiBane_Timer += 8000; m_uiFetidRot_Timer += 8000; m_uiDarkSlash_Timer += 8000; m_uiAncestors_Vengeance_Timer += 8000; - m_uiActivedNumber = m_uiOrder; m_bIsWalking = true; m_uiPause_Timer = 2000; @@ -324,42 +281,33 @@ struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI DoMeleeAttackIfReady(); } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); - if (pInstance) pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), m_creature); } - void DespawnBoatGhosts(uint64& m_uiCreatureGUID) { if (m_uiCreatureGUID) if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, m_uiCreatureGUID)) pTemp->DisappearAndDie(); - m_uiCreatureGUID = 0; } }; - CreatureAI* GetAI_boss_ymiron(Creature* pCreature) { return new boss_ymironAI(pCreature); } - void AddSC_boss_ymiron() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ymiron"; newscript->GetAI = &GetAI_boss_ymiron; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/def_pinnacle.h b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/def_pinnacle.h index b446b441c17..fd1e0efa312 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/def_pinnacle.h +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/def_pinnacle.h @@ -1,21 +1,17 @@ #ifndef DEF_PINNACLE_H #define DEF_PINNACLE_H - #define DATA_SVALA 1 #define DATA_SVALA_SORROWGRAVE 2 #define DATA_GORTOK_PALEHOOF 3 #define DATA_SKADI_THE_RUTHLESS 4 #define DATA_KING_YMIRON 5 - #define DATA_SVALA_SORROWGRAVE_EVENT 6 #define DATA_GORTOK_PALEHOOF_EVENT 7 #define DATA_SKADI_THE_RUTHLESS_EVENT 8 #define DATA_KING_YMIRON_EVENT 9 - #define DATA_MOB_FRENZIED_WORGEN 10 #define DATA_MOB_RAVENOUS_FURBOLG 11 #define DATA_MOB_MASSIVE_JORMUNGAR 12 #define DATA_MOB_FEROCIOUS_RHINO 13 - #define DATA_GORTOK_PALEHOOF_SPHERE 14 #endif diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp index 7eb661668df..0aaa243e229 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp @@ -1,57 +1,43 @@ #include "precompiled.h" #include "def_pinnacle.h" - #define MAX_ENCOUNTER 4 - /* Utgarde Pinnacle encounters: 0 - Svala Sorrowgrave 1 - Gortok Palehoof 2 - Skadi the Ruthless 3 - King Ymiron */ - #define ENTRY_SKADI_THE_RUTHLESS_DOOR 192173 #define ENTRY_KING_YMIRON_DOOR 192174 #define ENTRY_GORK_PALEHOOF_SPHERE 188593 - struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance { instance_pinnacle(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 uiSvalaSorrowgrave; uint64 uiGortokPalehoof; uint64 uiSkadiTheRuthless; uint64 uiKingYmiron; - uint64 uiSkadiTheRuthlessDoor; uint64 uiKingYmironDoor; uint64 uiGortokPalehoofSphere; - uint64 uiFrenziedWorgen; uint64 uiRavenousFurbolg; uint64 uiFerociousRhino; uint64 uiMassiveJormungar; - uint64 uiSvala; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - void Initialize() { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) m_auiEncounter[i] = NOT_STARTED; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -67,7 +53,6 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance case 29281: uiSvala = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -90,7 +75,6 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -112,11 +96,9 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance m_auiEncounter[3] = data; break; } - if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -128,7 +110,6 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -144,24 +125,18 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance case DATA_SVALA: return uiSvala; case DATA_GORTOK_PALEHOOF_SPHERE: return uiGortokPalehoofSphere; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << "U P " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -169,37 +144,28 @@ struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'U' && dataHead2 == 'K') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; m_auiEncounter[3] = data3; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_utgarde_pinnacle(Map* pMap) { return new instance_pinnacle(pMap); } - void AddSC_instance_utgarde_pinnacle() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_archavon.cpp b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_archavon.cpp index 34e0cdc61b2..2c81d20a46d 100644 --- a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_archavon.cpp +++ b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_archavon.cpp @@ -4,12 +4,10 @@ UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`= *** SQL END ***/ #include "precompiled.h" #include "def_vault_of_archavon.h" - #define EMOTE_BERSERK -1590002 - //Spells Archavon #define SPELL_ROCK_SHARDS 58678 -#define SPELL_CRUSHING_LEAP HEROIC(58960,60894)//Instant (10-80yr range) -- Leaps at an enemy, inflicting 8000 Physical damage, knocking all nearby enemies away, and creating a cloud of choking debris. +#define SPELL_CRUSHING_LEAP HEROIC(58960,60894) //Instant (10-80yr range) -- Leaps at an enemy, inflicting 8000 Physical damage, knocking all nearby enemies away, and creating a cloud of choking debris. #define SPELL_STOMP HEROIC(58663,60880) #define SPELL_IMPALE HEROIC(58666,60882) //Lifts an enemy off the ground with a spiked fist, inflicting 47125 to 52875 Physical damage and 9425 to 10575 additional damage each second for 8 sec. #define SPELL_BERSERK 47008 @@ -17,50 +15,39 @@ UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`= #define SPELL_ROCK_SHOWER HEROIC(60919,60923) #define SPELL_SHIELD_CRUSH HEROIC(60897,60899) #define SPELL_WHIRL HEROIC(60902,60916) - //4 Warders spawned #define ARCHAVON_WARDER 32353 //npc 32353 - //Yell #define SAY_LEAP "Archavon the Stone Watcher lunges for $N!" //$N should be the target - #define EVENT_ROCK_SHARDS 1 //15s cd #define EVENT_CHOKING_CLOUD 2 //30s cd #define EVENT_STOMP 3 //45s cd #define EVENT_IMPALE 4 #define EVENT_BERSERK 5 //300s cd - //mob #define EVENT_ROCK_SHOWER 5 //set = 20s cd,unkown cd #define EVENT_SHIELD_CRUSH 6 //set = 30s cd #define EVENT_WHIRL 8 //set= 10s cd - struct TRINITY_DLL_DECL boss_archavonAI : public ScriptedAI { boss_archavonAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; EventMap events; - void Reset() { events.Reset(); - if (pInstance) pInstance->SetData(DATA_ARCHAVON_EVENT, NOT_STARTED); } - void KilledUnit(Unit* Victim){} - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_ARCHAVON_EVENT, DONE); } - void EnterCombat(Unit *who) { DoZoneInCombat(); @@ -68,23 +55,18 @@ struct TRINITY_DLL_DECL boss_archavonAI : public ScriptedAI events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); events.ScheduleEvent(EVENT_STOMP, 45000); events.ScheduleEvent(EVENT_BERSERK, 300000); - if (pInstance) pInstance->SetData(DATA_ARCHAVON_EVENT, IN_PROGRESS); } - // Below UpdateAI may need review/debug. void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) return; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -113,25 +95,20 @@ struct TRINITY_DLL_DECL boss_archavonAI : public ScriptedAI return; } } - DoMeleeAttackIfReady(); } }; - /*###### ## Mob Archavon Warder ######*/ struct TRINITY_DLL_DECL mob_warderAI : public ScriptedAI //npc 32353 { mob_warderAI(Creature *c) : ScriptedAI(c) {} - EventMap events; - void Reset() { events.Reset(); } - void EnterCombat(Unit *who) { DoZoneInCombat(); @@ -139,15 +116,12 @@ struct TRINITY_DLL_DECL mob_warderAI : public ScriptedAI //npc 32353 events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); events.ScheduleEvent(EVENT_WHIRL, 7500); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -172,26 +146,21 @@ struct TRINITY_DLL_DECL mob_warderAI : public ScriptedAI //npc 32353 DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_warder(Creature* pCreature) { return new mob_warderAI (pCreature); } - CreatureAI* GetAI_boss_archavon(Creature* pCreature) { return new boss_archavonAI (pCreature); } - void AddSC_boss_archavon() { Script *newscript; - newscript = new Script; newscript->Name = "boss_archavon"; newscript->GetAI = &GetAI_boss_archavon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_archavon_warder"; newscript->GetAI = &GetAI_mob_warder; diff --git a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp index 0f240bd8692..d7564ea7a6b 100644 --- a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp +++ b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp @@ -1,34 +1,27 @@ #include "precompiled.h" #include "def_vault_of_archavon.h" - //Emalon spells #define SPELL_CHAIN_LIGHTNING HEROIC(64213, 64215) #define SPELL_LIGHTNING_NOVA HEROIC(64216, 65279) #define SPELL_OVERCHARGE 64218 //Casted every 45 sec on a random Tempest Minion #define SPELL_BERSERK 26662 - //Tempest Minion spells #define SPELL_SHOCK 64363 #define SPELL_OVERCHARGED 64217 #define SPELL_OVERCHARGED_BLAST 64219 //Casted when Overcharged reaches 10 stacks. Mob dies after that - //Emotes #define EMOTE_OVERCHARGE -1590000 #define EMOTE_MINION_RESPAWN -1590001 #define EMOTE_BERSERK -1590002 - //Events #define EVENT_CHAIN_LIGHTNING 1 #define EVENT_LIGHTNING_NOVA 2 #define EVENT_OVERCHARGE 3 #define EVENT_BERSERK 4 #define EVENT_SHOCK 5 - //Creatures #define MOB_TEMPEST_MINION 33998 - #define MAX_TEMPEST_MINIONS 4 - float TempestMinions[4][4] = { {-203.980103, -281.287720, 91.650223, 1.598807}, @@ -36,7 +29,6 @@ float TempestMinions[4][4] = {-233.267578, -297.104645, 91.681915, 1.598807}, {-203.842529, -297.097015, 91.745163, 1.598807} }; - /*###### ## Emalon the Storm Watcher ######*/ @@ -46,31 +38,23 @@ struct TRINITY_DLL_DECL boss_emalonAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - EventMap events; - std::list MinionList; - void Reset() { events.Reset(); - DespawnAllMinions(); - for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) m_creature->SummonCreature(MOB_TEMPEST_MINION, TempestMinions[i][0], TempestMinions[i][1], TempestMinions[i][2], TempestMinions[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (pInstance) pInstance->SetData(DATA_EMALON_EVENT, NOT_STARTED); } - void DespawnAllMinions() { if(!MinionList.empty()) { - for(std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) + for (std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) { Creature *Minion = Unit::GetCreature(*m_creature, *itr); if(Minion && Minion->isAlive()) @@ -79,56 +63,45 @@ struct TRINITY_DLL_DECL boss_emalonAI : public ScriptedAI } MinionList.clear(); } - void JustSummoned(Creature *summoned) { MinionList.push_back(summoned->GetGUID()); - if(m_creature->getVictim()) summoned->AI()->AttackStart(m_creature->getVictim()); } - void JustDied(Unit* Killer) { DespawnAllMinions(); - if (pInstance) pInstance->SetData(DATA_EMALON_EVENT, DONE); } - void EnterCombat(Unit *who) { if(!MinionList.empty()) { - for(std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) + for (std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) { Creature *Minion = Unit::GetCreature(*m_creature, *itr); if(Minion && Minion->isAlive() && !Minion->getVictim()) Minion->AI()->AttackStart(who); } } - DoZoneInCombat(); events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000); events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); events.ScheduleEvent(EVENT_BERSERK, 360000); events.ScheduleEvent(EVENT_OVERCHARGE, 45000); - if (pInstance) pInstance->SetData(DATA_EMALON_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if(!UpdateVictim()) return; - events.Update(diff); - if(me->hasUnitState(UNIT_STAT_CASTING)) return; - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -163,11 +136,9 @@ struct TRINITY_DLL_DECL boss_emalonAI : public ScriptedAI return; } } - DoMeleeAttackIfReady(); } }; - /*###### ## Tempest Minion ######*/ @@ -179,23 +150,16 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI EmalonGUID = pInstance ? pInstance->GetData64(DATA_EMALON) : 0; Emalon = Unit::GetCreature(*m_creature, EmalonGUID); } - ScriptedInstance* pInstance; - EventMap events; - uint64 EmalonGUID; Creature* Emalon; - uint32 OverchargedTimer; - void Reset() { events.Reset(); - OverchargedTimer = 0; } - void JustDied(Unit* Killer) { if(Emalon && Emalon->isAlive()) @@ -204,27 +168,21 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI DoScriptText(EMOTE_MINION_RESPAWN, m_creature); } } - void EnterCombat(Unit *who) { DoZoneInCombat(); events.ScheduleEvent(EVENT_SHOCK, 20000); - if(Emalon && !Emalon->getVictim()) Emalon->AI()->AttackStart(who); } - void UpdateAI(const uint32 diff) { //Return since we have no target if(!UpdateVictim()) return; - events.Update(diff); - if(me->hasUnitState(UNIT_STAT_CASTING)) return; - if(Aura *OverchargedAura = m_creature->GetAura(SPELL_OVERCHARGED)) { if(OverchargedAura->GetStackAmount() < 10) @@ -245,7 +203,6 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI } } } - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -256,30 +213,24 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI return; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_tempest_minion(Creature *_Creature) { return new mob_tempest_minionAI (_Creature); } - CreatureAI* GetAI_boss_emalon(Creature *_Creature) { return new boss_emalonAI (_Creature); } - void AddSC_boss_emalon() { Script *newscript; - newscript = new Script; newscript->Name = "boss_emalon"; newscript->GetAI = &GetAI_boss_emalon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_tempest_minion"; newscript->GetAI = &GetAI_mob_tempest_minion; diff --git a/src/bindings/scripts/scripts/northrend/vault_of_archavon/def_vault_of_archavon.h b/src/bindings/scripts/scripts/northrend/vault_of_archavon/def_vault_of_archavon.h index 95c44035184..e61edf6776a 100644 --- a/src/bindings/scripts/scripts/northrend/vault_of_archavon/def_vault_of_archavon.h +++ b/src/bindings/scripts/scripts/northrend/vault_of_archavon/def_vault_of_archavon.h @@ -1,6 +1,5 @@ #ifndef DEF_ARCHAVON_H #define DEF_ARCHAVON_H - #define DATA_ARCHAVON_EVENT 1 #define DATA_EMALON_EVENT 2 #define DATA_EMALON 3 diff --git a/src/bindings/scripts/scripts/northrend/vault_of_archavon/instance_vault_of_archavon.cpp b/src/bindings/scripts/scripts/northrend/vault_of_archavon/instance_vault_of_archavon.cpp index 45d0a4be7ae..f2dc5b19a66 100644 --- a/src/bindings/scripts/scripts/northrend/vault_of_archavon/instance_vault_of_archavon.cpp +++ b/src/bindings/scripts/scripts/northrend/vault_of_archavon/instance_vault_of_archavon.cpp @@ -1,39 +1,29 @@ #include "precompiled.h" #include "def_vault_of_archavon.h" - #define ENCOUNTERS 2 - /* Vault of Archavon encounters: 1 - Archavon the Stone Watcher event 2 - Emalon the Storm Watcher event */ - struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance { instance_archavon(Map *Map) : ScriptedInstance(Map) {Initialize();}; - uint32 Encounters[ENCOUNTERS]; - uint64 Archavon; uint64 Emalon; - void Initialize() { Archavon = 0; Emalon = 0; - - for(uint8 i = 0; i < ENCOUNTERS; i++) + for (uint8 i = 0; i < ENCOUNTERS; i++) Encounters[i] = NOT_STARTED; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < ENCOUNTERS; i++) + for (uint8 i = 0; i < ENCOUNTERS; i++) if(Encounters[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature *creature, bool add) { switch(creature->GetEntry()) @@ -42,7 +32,6 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance case 33993: Emalon = creature->GetGUID(); break; } } - uint32 GetData(uint32 type) { switch(type) @@ -52,7 +41,6 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -62,7 +50,6 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -70,11 +57,9 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance case DATA_ARCHAVON_EVENT: Encounters[0] = data; break; case DATA_EMALON_EVENT: Encounters[1] = data; break; } - if(data == DONE) SaveToDB(); } - std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -87,10 +72,8 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance OUT_SAVE_INST_DATA_COMPLETE; return out; } - return NULL; } - void Load(const char* in) { if(!in) @@ -98,22 +81,19 @@ struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> Encounters[0] >> Encounters[1]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) + for (uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) Encounters[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_archavon(Map* map) { return new instance_archavon(map); } - void AddSC_instance_archavon() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp index 6d4822a01d9..50f2e0c7462 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_ARCANE_VACUM = 58694, @@ -23,7 +21,6 @@ enum Spells SPELL_UNCONTROLLABLE_ENERGY = 58688, H_SPELL_UNCONTROLLABLE_ENERGY = 59281 }; - enum Yells { SAY_AGGRO = -1608000, @@ -37,49 +34,39 @@ enum Yells SAY_SPECIAL_ATTACK_1 = -1608008, SAY_SPECIAL_ATTACK_2 = -1608009 }; - struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI { boss_cyanigosaAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiArcaneVacumTimer; uint32 uiBlizzardTimer; uint32 uiManaDestructionTimer; uint32 uiTailSweepTimer; uint32 uiUncontrollableEnergyTimer; - ScriptedInstance* pInstance; - void Reset() { if (pInstance) pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiArcaneVacumTimer < diff) { DoCast(m_creature, SPELL_ARCANE_VACUM); } else uiArcaneVacumTimer -= diff; - if (uiBlizzardTimer < diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -88,17 +75,14 @@ struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI if (pTarget) DoCast(pTarget, HeroicMode ? H_SPELL_BLIZZARD : SPELL_BLIZZARD); } else uiBlizzardTimer -= diff; - if (uiTailSweepTimer < diff) { DoCast(m_creature, HeroicMode ? H_SPELL_TAIL_SWEEP : SPELL_TAIL_SWEEP); } else uiTailSweepTimer -= diff; - if (uiUncontrollableEnergyTimer < diff) { DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_UNCONTROLLABLE_ENERGY : SPELL_UNCONTROLLABLE_ENERGY); } else uiUncontrollableEnergyTimer -= diff; - if (HeroicMode) if (uiManaDestructionTimer < diff) { @@ -108,18 +92,14 @@ struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI if (pTarget) DoCast(pTarget, SPELL_MANA_DESTRUCTION); } else uiManaDestructionTimer -= diff; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); } - void KilledUnit(Unit *victim) { if (victim == m_creature) @@ -127,16 +107,13 @@ struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_cyanigosa(Creature* pCreature) { return new boss_cyanigosaAI (pCreature); } - void AddSC_boss_cyanigosa() { Script *newscript; - newscript = new Script; newscript->Name = "boss_cyanigosa"; newscript->GetAI = &GetAI_boss_cyanigosa; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp index cf6686421d1..4855079fc06 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_BLOODLUST = 54516, @@ -24,7 +22,6 @@ enum Spells SPELL_LIGHTNING_BOLT = 53044, SPELL_STORMSTRIKE = 51876 }; - //not in db enum Yells { @@ -37,25 +34,20 @@ enum Yells SAY_ADD_KILLED = -1608016, SAY_BOTH_ADDS_KILLED = -1608017 }; - struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI { boss_erekemAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiBloodlustTimer; uint32 uiChainHealTimer; uint32 uiEarthShockTimer; uint32 uiLightningBoltTimer; uint32 uiEarthShieldTimer; - Creature* pGuard1; Creature* pGuard2; - ScriptedInstance* pInstance; - void Reset() { uiBloodlustTimer = 15000; @@ -71,12 +63,10 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoCast(m_creature, HEROIC(SPELL_EARTH_SHIELD, H_SPELL_EARTH_SHIELD)); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -85,15 +75,12 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //spam stormstrike in hc mode if spawns are dead if (HeroicMode) { @@ -102,13 +89,11 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_STORMSTRIKE); } } - if (uiEarthShieldTimer < diff) { DoCast(m_creature, HEROIC(SPELL_EARTH_SHIELD, H_SPELL_EARTH_SHIELD)); uiEarthShieldTimer = 20000; } else uiEarthShieldTimer -= diff; - if (uiChainHealTimer < diff) { if (Creature *pTarget = GetChainHealTarget()) @@ -118,20 +103,17 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; } } else uiChainHealTimer -= diff; - if (uiBloodlustTimer < diff) { DoCast(m_creature,SPELL_BLOODLUST); uiBloodlustTimer = urand(35000,45000); } else uiBloodlustTimer -= diff; - if (uiEarthShockTimer < diff) { DoCast(m_creature->getVictim(), SPELL_EARTH_SHOCK); uiEarthShockTimer = urand(8000,13000); } else uiEarthShockTimer -= diff; - if (uiLightningBoltTimer < diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); @@ -141,14 +123,11 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI DoCast(pTarget, SPELL_LIGHTNING_BOLT); uiLightningBoltTimer = urand(18000,24000); } else uiLightningBoltTimer -= diff; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -163,53 +142,43 @@ struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - Creature* GetChainHealTarget() { Creature* pTarget = NULL; return pTarget; } }; - CreatureAI* GetAI_boss_erekem(Creature* pCreature) { return new boss_erekemAI (pCreature); } - struct TRINITY_DLL_DECL mob_erekem_guardAI : public ScriptedAI { mob_erekem_guardAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiEarthShieldTimer; uint32 uiLightningBoltTimer; uint32 uiBloodlustTimer; - ScriptedInstance* pInstance; - void Reset() { uiEarthShieldTimer = 20000; uiLightningBoltTimer = urand(0,5000); uiBloodlustTimer = urand(8000,18000); } - void EnterCombat(Unit* who) { DoCast(m_creature, H_SPELL_EARTH_SHIELD); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (uiEarthShieldTimer < diff) @@ -217,14 +186,12 @@ struct TRINITY_DLL_DECL mob_erekem_guardAI : public ScriptedAI DoCast(m_creature, H_SPELL_EARTH_SHIELD); uiEarthShieldTimer = 20000; } else uiEarthShieldTimer -= diff; - if (uiLightningBoltTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_LIGHTNING_BOLT); uiLightningBoltTimer = urand(18000,24000); } else uiLightningBoltTimer -= diff; - if (uiBloodlustTimer < diff) { DoCast(m_creature,SPELL_BLOODLUST); @@ -232,22 +199,18 @@ struct TRINITY_DLL_DECL mob_erekem_guardAI : public ScriptedAI } else uiBloodlustTimer -= diff; } }; - CreatureAI* GetAI_mob_erekem_guard(Creature* pCreature) { return new mob_erekem_guardAI (pCreature); } - void AddSC_boss_erekem() { Script *newscript; - newscript = new Script; newscript->Name = "boss_erekem"; newscript->GetAI = &GetAI_boss_erekem; newscript->RegisterSelf(); - newscript->Name = "mob_erekem_guard"; newscript->GetAI = &GetAI_mob_erekem_guard; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp index 3d9f5bc659c..3b859c596df 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_DRAINED = 59820, @@ -23,7 +21,6 @@ enum Spells SPELL_WATER_BOLT_VOLLEY = 54241, H_SPELL_WATER_BOLT_VOLLEY = 59521 }; - //not in db enum Yells { @@ -37,31 +34,24 @@ enum Yells SAY_SHATTER = -1608025, SAY_BUBBLE = -1608026 }; - enum CombatPhase { BUBBLED, SUMMONS, DPS }; - struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI { boss_ichoronAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - CombatPhase Phase; - ScriptedInstance* pInstance; - void Reset() { Phase = BUBBLED; - DoCast(m_creature, SPELL_PROTECTIVE_BUBBLE); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -73,7 +63,6 @@ struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -82,20 +71,16 @@ struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -110,7 +95,6 @@ struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (victim == m_creature) @@ -118,16 +102,13 @@ struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_ichoron(Creature* pCreature) { return new boss_ichoronAI (pCreature); } - void AddSC_boss_ichoron() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ichoron"; newscript->GetAI = &GetAI_boss_ichoron; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp index fc493735a72..7316c004219 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_CAUTERIZING_FLAMES = 59466, //Only in heroic @@ -22,21 +20,17 @@ enum Spells SPELL_LAVA_BURN = 54249, H_SPELL_LAVA_BURN = 59594 }; - struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI { boss_lavanthorAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiFireboltTimer; uint32 uiFlameBreathTimer; uint32 uiLavaBurnTimer; uint32 uiCauterizingFlamesTimer; - ScriptedInstance* pInstance; - void Reset() { uiFireboltTimer = 1000; @@ -51,7 +45,6 @@ struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } } - void EnterCombat(Unit* who) { if (pInstance) @@ -62,33 +55,27 @@ struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiFireboltTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_FIREBOLT, H_SPELL_FIREBOLT)); uiFireboltTimer = urand(5000,13000); } else uiFireboltTimer -= diff; - if (uiFlameBreathTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_FLAME_BREATH, H_SPELL_FLAME_BREATH)); uiFlameBreathTimer = urand(10000,15000); } else uiFlameBreathTimer -= diff; - if (uiLavaBurnTimer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_LAVA_BURN, H_SPELL_LAVA_BURN)); uiLavaBurnTimer = urand(15000,23000); } - if (HeroicMode) { if (uiCauterizingFlamesTimer < diff) @@ -97,10 +84,8 @@ struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI uiCauterizingFlamesTimer = urand(10000,16000); } else uiCauterizingFlamesTimer -= diff; } - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { if (pInstance) @@ -118,16 +103,13 @@ struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_lavanthor(Creature* pCreature) { return new boss_lavanthorAI (pCreature); } - void AddSC_boss_lavanthor() { Script *newscript; - newscript = new Script; newscript->Name = "boss_lavanthor"; newscript->GetAI = &GetAI_boss_lavanthor; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp index 53501a6425a..00e136139fb 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp @@ -5,38 +5,31 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - //Spells enum Spells { SPELL_CORROSIVE_SALIVA = 54527, SPELL_OPTIC_LINK = 54396 }; - struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI { boss_moraggAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiOpticLinkTimer; uint32 uiCorrosiveSalivaTimer; - ScriptedInstance* pInstance; - void Reset() { uiOpticLinkTimer = 10000; uiCorrosiveSalivaTimer = 5000; - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -45,7 +38,6 @@ struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } } - void EnterCombat(Unit* who) { if (pInstance) @@ -56,28 +48,23 @@ struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (uiOpticLinkTimer < diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget,SPELL_OPTIC_LINK); uiOpticLinkTimer = 15000; } else uiOpticLinkTimer -= diff; - if (uiCorrosiveSalivaTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CORROSIVE_SALIVA); uiCorrosiveSalivaTimer = 10000; } else uiCorrosiveSalivaTimer -= diff; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) @@ -97,16 +84,13 @@ struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_moragg(Creature* pCreature) { return new boss_moraggAI (pCreature); } - void AddSC_boss_moragg() { Script *newscript; - newscript = new Script; newscript->Name = "boss_moragg"; newscript->GetAI = &GetAI_boss_moragg; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp index 3f607bcd3f3..9ad67768fcf 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_ARCANE_BARRAGE_VOLLEY = 54202, @@ -25,20 +23,17 @@ enum Spells SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, H_SPELL_SUMMON_ETHEREAL_SPHERE_3 = 61339 }; - enum Creatures { CREATURE_ETHEREAL_SPHERE = 29271, H_CREATURE_ETHEREAL_SPHERE = 32582 }; - enum CreatureSpells { SPELL_ARCANE_POWER = 54160, H_SPELL_ARCANE_POWER = 59474, SPELL_SUMMON_PLAYERS = 54164 }; - //not in db enum Yells { @@ -53,16 +48,13 @@ enum Yells SAY_REPEAT_SUMMON_2 = -1608035, SAY_SUMMON_ENERGY = -1608036 }; - struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI { boss_xevozzAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - void Reset() { if (pInstance) @@ -73,7 +65,6 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); @@ -85,18 +76,14 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); @@ -121,16 +108,13 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_xevozz(Creature* pCreature) { return new boss_xevozzAI (pCreature); } - void AddSC_boss_xevozz() { Script *newscript; - newscript = new Script; newscript->Name = "boss_xevozz"; newscript->GetAI = &GetAI_boss_xevozz; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp index d573060f50e..e9a7d5aef20 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp @@ -5,13 +5,11 @@ SD%Complete: SDComment: SDCategory: Script Data End */ - /*** SQL START *** update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" #include "def_violet_hold.h" - enum Spells { SPELL_SHROUD_OF_DARKNESS = 54524, @@ -20,12 +18,10 @@ enum Spells SPELL_VOID_SHIFT = 54361, H_SPELL_VOID_SHIFT = 59743 }; - enum Creatures { CREATURE_VOID_SENTRY = 29364 }; - //not in db enum Yells { @@ -38,18 +34,14 @@ enum Yells SAY_SHIELD = -1608043, SAY_WHISPER = -1608044 }; - struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI { boss_zuramatAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 void_shift; - ScriptedInstance* pInstance; - void Reset() { if (pInstance) @@ -60,7 +52,6 @@ struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } } - void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); @@ -72,21 +63,17 @@ struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -101,25 +88,20 @@ struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; - CreatureAI* GetAI_boss_zuramat(Creature* pCreature) { return new boss_zuramatAI (pCreature); } - void AddSC_boss_zuramat() { Script *newscript; - newscript = new Script; newscript->Name = "boss_zuramat"; newscript->GetAI = &GetAI_boss_zuramat; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h b/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h index 4e989ffb7bb..02ce2e251ae 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h +++ b/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h @@ -1,6 +1,5 @@ #ifndef DEF_VIOLET_HOLD_H #define DEF_VIOLET_HOLD_H - enum Data { DATA_1ST_BOSS_EVENT, @@ -8,7 +7,6 @@ enum Data DATA_CYANIGOSA_EVENT, DATA_WAVE_COUNT }; - enum Data64 { DATA_MORAGG, @@ -29,5 +27,4 @@ enum Data64 DATA_MAIN_DOOR, DATA_SINCLARI }; - #endif diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp index 60128f1b931..7a3f462d896 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp @@ -1,13 +1,10 @@ #include "precompiled.h" #include "def_violet_hold.h" - #define MAX_ENCOUNTER 3 - /* Violet Hold encounters: 0 - First boss 1 - Second boss 2 - Cyanigosa*/ - /* Violet hold bosses: 0 - Moragg 1 - Erekem @@ -41,7 +38,6 @@ const Location PortalLocation[] = struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance { instance_violet_hold(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 uiMoragg; uint64 uiErekem; uint64 uiIchoron; @@ -50,7 +46,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance uint64 uiZuramat; uint64 uiCyanigosa; uint64 uiSinclari; - uint64 uiMoraggCell; uint64 uiErekemCell; uint64 uiErekemRightGuardCell; @@ -60,18 +55,13 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance uint64 uiXevozzCell; uint64 uiZuramatCell; uint64 uiMainDoor; - uint8 uiWaveCount; uint8 uiLocation; uint8 uiFirstBoss; uint8 uiSecondBoss; - uint8 m_auiEncounter[MAX_ENCOUNTER]; - bool HeroicMode; - std::string str_data; - void Initialize() { uiMoragg = 0; @@ -82,7 +72,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance uiZuramat = 0; uiCyanigosa = 0; uiSinclari = 0; - uiMoraggCell = 0; uiErekemCell = 0; uiErekemRightGuardCell = 0; @@ -92,23 +81,18 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance uiXevozzCell = 0; uiZuramatCell = 0; uiMainDoor = 0; - uiWaveCount = 0; uiLocation = 0; uiFirstBoss = 0; uiSecondBoss = 0; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -139,7 +123,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -182,7 +165,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -248,7 +230,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance break; } } - uint32 GetData(uint32 type) { switch(type) @@ -258,10 +239,8 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2]; case DATA_WAVE_COUNT: return uiWaveCount; } - return 0; } - void StartBossEncounter(uint8 uiBoss) { Creature* pBoss = NULL; @@ -322,7 +301,6 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -345,24 +323,18 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance case DATA_MAIN_DOOR: return uiMainDoor; case DATA_SINCLARI: return uiSinclari; } - return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << "V H " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << uiFirstBoss << " " << uiSecondBoss; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; return str_data; } - void Load(const char* in) { if (!in) @@ -370,38 +342,29 @@ struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; uint16 data0, data1, data2, data3, data4; - std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - if (dataHead1 == 'V' && dataHead2 == 'H') { m_auiEncounter[0] = data0; m_auiEncounter[1] = data1; m_auiEncounter[2] = data2; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - uiFirstBoss = data3; uiSecondBoss = data4; }else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_violet_hold(Map* pMap) { return new instance_violet_hold(pMap); } - void AddSC_instance_violet_hold() { Script *newscript; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp index 900b0021336..1d11a31767d 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp @@ -1,10 +1,8 @@ #include "precompiled.h" #include "def_violet_hold.h" - #define GOSSIP_START_EVENT "[PH]: Start Event" #define NEXT_WAVE_TIME 90000 #define SPAWN_TIME 9000 - enum Creatures { CREATURE_AZURE_INVADER = 30661, @@ -13,7 +11,6 @@ enum Creatures CREATURE_AZURE_MAGE_SLAYER = 30664, CREATURE_AZURE_CAPTAIN = 30666 }; - bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); @@ -22,7 +19,6 @@ bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(1, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { pPlayer->CLOSE_GOSSIP_MENU(); @@ -31,28 +27,22 @@ bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 uiSe pInstance->SetData(DATA_WAVE_COUNT,1); return true; } - struct TRINITY_DLL_DECL npc_teleportation_portalAI : public ScriptedAI { npc_teleportation_portalAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - uint32 uiDespawnTimer; uint32 uiSpawnTimer; - ScriptedInstance *pInstance; - void reset() { uiDespawnTimer = NEXT_WAVE_TIME; uiSpawnTimer = 500; } - void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} - void UpdateAI(const uint32 diff) { if (uiSpawnTimer < diff) @@ -71,29 +61,24 @@ struct TRINITY_DLL_DECL npc_teleportation_portalAI : public ScriptedAI m_creature->DisappearAndDie(); } else uiDespawnTimer -= diff; } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); } }; - CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) { return new npc_teleportation_portalAI(pCreature); } - void AddSC_violet_hold() { Script *newscript; - newscript = new Script; newscript->Name = "npc_sinclari_vh"; newscript->pGossipHello = &GossipHello_npc_sinclari; newscript->pGossipSelect = &GossipSelect_npc_sinclari; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_teleportation_portal_vh"; newscript->GetAI = &GetAI_npc_teleportation_portal; diff --git a/src/bindings/scripts/scripts/northrend/wintergrasp.cpp b/src/bindings/scripts/scripts/northrend/wintergrasp.cpp index 53e6fca2af7..241d9202e9a 100644 --- a/src/bindings/scripts/scripts/northrend/wintergrasp.cpp +++ b/src/bindings/scripts/scripts/northrend/wintergrasp.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "Wintergrasp.h" - #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." #define GOSSIP_HELLO_DEMO3 "Build siege engine." #define GOSSIP_HELLO_DEMO4 "I cannot build more!" - struct TRINITY_DLL_DECL npc_demolisher_engineererAI : public ScriptedAI { npc_demolisher_engineererAI(Creature* pCreature) : ScriptedAI(pCreature) { me->SetReactState(REACT_PASSIVE); } - /* void JustDied(Unit *killer) { @@ -37,17 +33,14 @@ struct TRINITY_DLL_DECL npc_demolisher_engineererAI : public ScriptedAI } */ }; - CreatureAI* GetAI_npc_demolisher_engineerer(Creature* pCreature) { return new npc_demolisher_engineererAI (pCreature); } - bool GossipHello_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if(pPlayer->isGameMaster() || pCreature->GetZoneScript() && pCreature->GetZoneScript()->GetData(pCreature->GetDBTableGUIDLow())) { if (pPlayer->HasAura(SPELL_CORPORAL)) @@ -61,11 +54,9 @@ bool GossipHello_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature) } else pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { pPlayer->CLOSE_GOSSIP_MENU(); @@ -78,14 +69,11 @@ bool GossipSelect_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature case 2: pPlayer->CastSpell(pPlayer, pPlayer->GetTeamId() ? 61408 : 56661, false, NULL, NULL, pCreature->GetGUID()); break; } } - return true; } - void AddSC_wintergrasp() { Script *newscript; - newscript = new Script; newscript->Name = "npc_demolisher_engineerer"; newscript->GetAI = &GetAI_npc_demolisher_engineerer; diff --git a/src/bindings/scripts/scripts/northrend/zuldrak.cpp b/src/bindings/scripts/scripts/northrend/zuldrak.cpp index 90a047b4c44..6e187e0335b 100644 --- a/src/bindings/scripts/scripts/northrend/zuldrak.cpp +++ b/src/bindings/scripts/scripts/northrend/zuldrak.cpp @@ -15,29 +15,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" - /*#### ## npc_drakuru_shackles ####*/ - enum eDrakuruShackles { SPELL_LEFT_CHAIN = 59951, SPELL_RIGHT_CHAIN = 59952, SPELL_UNLOCK_SHACKLE = 55083, SPELL_FREE_RAGECLAW = 55223, - NPC_RAGECLAW = 29686 }; - struct TRINITY_DLL_DECL npc_drakuru_shacklesAI : public ScriptedAI { npc_drakuru_shacklesAI(Creature *c) : ScriptedAI(c) {} - Unit* Rageclaw; - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -47,21 +40,17 @@ struct TRINITY_DLL_DECL npc_drakuru_shacklesAI : public ScriptedAI if (Unit* summon = m_creature->SummonCreature(NPC_RAGECLAW,x,y,z,0,TEMPSUMMON_DEAD_DESPAWN,1000)) DoActionOnRageclaw(true,summon); } - void DoActionOnRageclaw(bool locking, Unit *who) { if (!who) return; - if (locking) { if (who) { Rageclaw = who; - m_creature->SetInFront(Rageclaw); Rageclaw->SetInFront(m_creature); - m_creature->CastSpell(Rageclaw, SPELL_LEFT_CHAIN, true); m_creature->CastSpell(Rageclaw, SPELL_RIGHT_CHAIN, true); } @@ -73,7 +62,6 @@ struct TRINITY_DLL_DECL npc_drakuru_shacklesAI : public ScriptedAI m_creature->setDeathState(DEAD); } } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_UNLOCK_SHACKLE) @@ -82,39 +70,31 @@ struct TRINITY_DLL_DECL npc_drakuru_shacklesAI : public ScriptedAI DoActionOnRageclaw(false,caster); else m_creature->setDeathState(JUST_DIED); - } } }; - CreatureAI* GetAI_npc_drakuru_shackles(Creature* pCreature) { return new npc_drakuru_shacklesAI (pCreature); } - /*#### ## npc_captured_rageclaw ####*/ - enum eRageclaw { SPELL_UNSHACKLED = 55085, SPELL_KNEEL = 39656 }; - const char * SAY_RAGECLAW_1 = "I poop on you, trollses!"; const char * SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!"; const char * SAY_RAGECLAW_3 = "No more mister nice wolvar!"; #define SAY_RAGECLAW RAND(SAY_RAGECLAW_1,SAY_RAGECLAW_2,SAY_RAGECLAW_3) - struct TRINITY_DLL_DECL npc_captured_rageclawAI : public ScriptedAI { npc_captured_rageclawAI(Creature *c) : ScriptedAI(c) {} - uint32 DespawnTimer; bool Despawn; - void Reset() { Despawn = false; @@ -122,30 +102,22 @@ struct TRINITY_DLL_DECL npc_captured_rageclawAI : public ScriptedAI m_creature->setFaction(35); m_creature->CastSpell(m_creature, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P } - void MoveInLineOfSight(Unit *who){} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_FREE_RAGECLAW) { m_creature->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN); - m_creature->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN); - m_creature->RemoveAurasDueToSpell(SPELL_KNEEL); - m_creature->setFaction(m_creature->GetCreatureInfo()->faction_H); - DoCast(m_creature, SPELL_UNSHACKLED, true); m_creature->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, NULL); m_creature->GetMotionMaster()->MoveRandom(10); - DespawnTimer = 10000; Despawn = true; } } - void UpdateAI(const uint32 diff) { if (m_creature->getVictim()) @@ -153,48 +125,38 @@ struct TRINITY_DLL_DECL npc_captured_rageclawAI : public ScriptedAI DoMeleeAttackIfReady(); return; } - if (!Despawn) return; - if (DespawnTimer < diff) m_creature->setDeathState(JUST_DIED); else DespawnTimer-=diff; } }; - CreatureAI* GetAI_npc_captured_rageclaw(Creature* pCreature) { return new npc_captured_rageclawAI (pCreature); } - /*#### ## npc_gymer ####*/ - #define GOSSIP_ITEM_G "I'm ready, Gymer. Let's go!" - enum eGymer { QUEST_STORM_KING_VENGEANCE = 12919, SPELL_GYMER = 55568 }; - bool GossipHello_npc_gymer(Player *pPlayer, Creature *pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_G, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(13640, pCreature->GetGUID()); } - return true; } - bool GossipSelect_npc_gymer(Player *pPlayer, Creature *pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -202,24 +164,19 @@ enum eGymer pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->CastSpell(pPlayer, SPELL_GYMER, true); } - return true; } - void AddSC_zuldrak() { Script *newscript; - newscript = new Script; newscript->Name = "npc_drakuru_shackles"; newscript->GetAI = &GetAI_npc_drakuru_shackles; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_captured_rageclaw"; newscript->GetAI = &GetAI_npc_captured_rageclaw; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_gymer"; newscript->pGossipHello = &GossipHello_npc_gymer; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp index 8b1c610e065..84a5179b7a3 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Exarch_Maladaar SD%Complete: 95 SDComment: Most of event implemented, some adjustments to timers remain and possibly make some better code for switching his dark side in to better "images" of player. SDCategory: Auchindoun, Auchenai Crypts EndScriptData */ - /* ContentData mob_stolen_soul boss_exarch_maladaar mob_avatar_of_martyred EndContentData */ - #include "precompiled.h" - #define SPELL_MOONFIRE 37328 #define SPELL_FIREBALL 37329 #define SPELL_MIND_FLAY 37330 @@ -38,32 +34,25 @@ EndContentData */ #define SPELL_MORTAL_STRIKE 37335 #define SPELL_FREEZING_TRAP 37368 #define SPELL_HAMMER_OF_JUSTICE 37369 - struct TRINITY_DLL_DECL mob_stolen_soulAI : public ScriptedAI { mob_stolen_soulAI(Creature *c) : ScriptedAI(c) {} - uint8 myClass; uint32 Class_Timer; - void Reset() { Class_Timer = 1000; } - void EnterCombat(Unit *who) { } - void SetMyClass(uint8 myclass) { myClass = myclass; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Class_Timer < diff) { switch (myClass) @@ -106,72 +95,53 @@ struct TRINITY_DLL_DECL mob_stolen_soulAI : public ScriptedAI break; } } else Class_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_stolen_soul(Creature* pCreature) { return new mob_stolen_soulAI (pCreature); } - #define SAY_INTRO -1558000 #define SAY_SUMMON -1558001 - #define SAY_AGGRO_1 -1558002 #define SAY_AGGRO_2 -1558003 #define SAY_AGGRO_3 -1558004 - #define SAY_ROAR -1558005 #define SAY_SOUL_CLEAVE -1558006 - #define SAY_SLAY_1 -1558007 #define SAY_SLAY_2 -1558008 - #define SAY_DEATH -1558009 - #define SPELL_RIBBON_OF_SOULS 32422 #define SPELL_SOUL_SCREAM 32421 - #define SPELL_STOLEN_SOUL 32346 #define SPELL_STOLEN_SOUL_VISUAL 32395 - #define SPELL_SUMMON_AVATAR 32424 - #define ENTRY_STOLEN_SOUL 18441 - struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI { boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) { HasTaunted = false; } - uint32 soulmodel; uint64 soulholder; uint8 soulclass; - uint32 Fear_timer; uint32 Ribbon_of_Souls_timer; uint32 StolenSoul_Timer; - bool HasTaunted; bool Avatar_summoned; - void Reset() { soulmodel = 0; soulholder = 0; soulclass = 0; - Fear_timer = 15000 + rand()% 5000; Ribbon_of_Souls_timer = 5000; StolenSoul_Timer = 25000 + rand()% 10000; - Avatar_summoned = false; } - void MoveInLineOfSight(Unit *who) { if (!HasTaunted && m_creature->IsWithinDistInMap(who, 150.0)) @@ -179,16 +149,13 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI DoScriptText(SAY_INTRO, m_creature); HasTaunted = true; } - ScriptedAI::MoveInLineOfSight(who); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == ENTRY_STOLEN_SOUL) @@ -197,48 +164,38 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); summoned->SetDisplayId(soulmodel); summoned->setFaction(m_creature->getFaction()); - if (Unit *target = Unit::GetUnit(*m_creature,soulholder)) { - CAST_AI(mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); summoned->AI()->AttackStart(target); } } } - void KilledUnit(Unit* victim) { if (rand()%2) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); //When Exarch Maladar is defeated D'ore appear. m_creature->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!Avatar_summoned && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 25)) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - DoScriptText(SAY_SUMMON, m_creature); - DoCast(m_creature, SPELL_SUMMON_AVATAR); Avatar_summoned = true; StolenSoul_Timer = 15000 + rand()% 15000; } - if (StolenSoul_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -247,100 +204,78 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - uint32 i = urand(1,2); if (i == 1) DoScriptText(SAY_ROAR, m_creature); else DoScriptText(SAY_SOUL_CLEAVE, m_creature); - soulmodel = target->GetDisplayId(); soulholder = target->GetGUID(); soulclass = target->getClass(); - DoCast(target,SPELL_STOLEN_SOUL); m_creature->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - StolenSoul_Timer = 20000 + rand()% 10000; } else StolenSoul_Timer = 1000; } }else StolenSoul_Timer -= diff; - if (Ribbon_of_Souls_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_RIBBON_OF_SOULS); - Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000); }else Ribbon_of_Souls_timer -= diff; - if (Fear_timer < diff) { DoCast(m_creature,SPELL_SOUL_SCREAM); Fear_timer = 15000 + rand()% 15000; }else Fear_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_exarch_maladaar(Creature* pCreature) { return new boss_exarch_maladaarAI (pCreature); } - #define SPELL_AV_MORTAL_STRIKE 16856 #define SPELL_AV_SUNDER_ARMOR 16145 - struct TRINITY_DLL_DECL mob_avatar_of_martyredAI : public ScriptedAI { mob_avatar_of_martyredAI(Creature *c) : ScriptedAI(c) {} - uint32 Mortal_Strike_timer; - void Reset() { Mortal_Strike_timer = 10000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Mortal_Strike_timer < diff) { DoCast(m_creature->getVictim(), SPELL_AV_MORTAL_STRIKE); Mortal_Strike_timer = 10000 + rand()%20 * 1000; } else Mortal_Strike_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_avatar_of_martyred(Creature* pCreature) { return new mob_avatar_of_martyredAI (pCreature); } - void AddSC_boss_exarch_maladaar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_exarch_maladaar"; newscript->GetAI = &GetAI_boss_exarch_maladaar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_avatar_of_martyred"; newscript->GetAI = &GetAI_mob_avatar_of_martyred; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_stolen_soul"; newscript->GetAI = &GetAI_mob_stolen_soul; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp index c8dabff9650..19e3664f62b 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp @@ -13,45 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData Name: Boss_Shirrak_the_dead_watcher %Complete: 80 Comment: InhibitMagic should stack slower far from the boss, proper Visual for Focus Fire, heroic implemented Category: Auchindoun, Auchenai Crypts EndScriptData */ - #include "precompiled.h" - #define SPELL_INHIBITMAGIC 32264 #define SPELL_ATTRACTMAGIC 32265 #define N_SPELL_CARNIVOROUSBITE 36383 #define H_SPELL_CARNIVOROUSBITE 39382 #define SPELL_CARNIVOROUSBITE (HeroicMode?H_SPELL_CARNIVOROUSBITE:N_SPELL_CARNIVOROUSBITE) - #define ENTRY_FOCUS_FIRE 18374 - #define N_SPELL_FIERY_BLAST 32302 #define H_SPELL_FIERY_BLAST 38382 #define SPELL_FIERY_BLAST (HeroicMode?H_SPELL_FIERY_BLAST:N_SPELL_FIERY_BLAST) #define SPELL_FOCUS_FIRE_VISUAL 42075 //need to find better visual - #define EMOTE_FOCUSES_ON "focuses on " - struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI { boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 Inhibitmagic_Timer; uint32 Attractmagic_Timer; uint32 Carnivorousbite_Timer; uint32 FocusFire_Timer; bool HeroicMode; Unit *focusedTarget; - void Reset() { Inhibitmagic_Timer = 0; @@ -60,10 +51,8 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI FocusFire_Timer = 17000; focusedTarget = NULL; } - void EnterCombat(Unit *who) { } - void JustSummoned(Creature *summoned) { if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) @@ -72,12 +61,10 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI summoned->setFaction(m_creature->getFaction()); summoned->SetLevel(m_creature->getLevel()); summoned->addUnitState(UNIT_STAT_ROOT); - if (focusedTarget) summoned->AI()->AttackStart(focusedTarget); } } - void UpdateAI(const uint32 diff) { //Inhibitmagic_Timer @@ -86,7 +73,7 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI float dist; Map* pMap = m_creature->GetMap(); Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + 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->IsWithinDist(m_creature, 45))) { @@ -101,11 +88,9 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI } Inhibitmagic_Timer = 3000+(rand()%1000); }else Inhibitmagic_Timer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - //Attractmagic_Timer if (Attractmagic_Timer < diff) { @@ -113,14 +98,12 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI Attractmagic_Timer = 30000; Carnivorousbite_Timer = 1500; }else Attractmagic_Timer -= diff; - //Carnivorousbite_Timer if (Carnivorousbite_Timer < diff) { DoCast(m_creature,SPELL_CARNIVOROUSBITE); Carnivorousbite_Timer = 10000; }else Carnivorousbite_Timer -= diff; - //FocusFire_Timer if (FocusFire_Timer < diff) { @@ -130,7 +113,6 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI { focusedTarget = target; m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); - // TODO: Find better way to handle emote // Emote std::string *emote = new std::string(EMOTE_FOCUSES_ON); @@ -142,62 +124,49 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI } FocusFire_Timer = 15000+(rand()%5000); }else FocusFire_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_shirrak_the_dead_watcher(Creature* pCreature) { return new boss_shirrak_the_dead_watcherAI (pCreature); } - struct TRINITY_DLL_DECL mob_focus_fireAI : public ScriptedAI { mob_focus_fireAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 FieryBlast_Timer; bool fiery1, fiery2; - void Reset() { FieryBlast_Timer = 3000+(rand()%1000); fiery1 = fiery2 = true; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //FieryBlast_Timer if (fiery2 && FieryBlast_Timer < diff) { DoCast(m_creature,SPELL_FIERY_BLAST); - if (fiery1) fiery1 = false; else if (fiery2) fiery2 = false; - FieryBlast_Timer = 1000; }else FieryBlast_Timer -= diff; - //DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_focus_fire(Creature* pCreature) { return new mob_focus_fireAI (pCreature); } - void AddSC_boss_shirrak_the_dead_watcher() { Script *newscript; @@ -205,7 +174,6 @@ void AddSC_boss_shirrak_the_dead_watcher() newscript->Name = "boss_shirrak_the_dead_watcher"; newscript->GetAI = &GetAI_boss_shirrak_the_dead_watcher; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_focus_fire"; newscript->GetAI = &GetAI_mob_focus_fire; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp index 9d19da0916f..c17a021cc27 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_NexusPrince_Shaffar SD%Complete: 80 SDComment: Need more tuning of spell timers, it should not be as linear fight as current. Also should possibly find a better way to deal with his three initial beacons to make sure all aggro. SDCategory: Auchindoun, Mana Tombs EndScriptData */ - /* ContentData boss_nexusprince_shaffar mob_ethereal_beacon EndContentData */ - #include "precompiled.h" - enum ePrince { SAY_INTRO = -1557000, @@ -38,36 +34,27 @@ enum ePrince SAY_SLAY_2 = -1557005, SAY_SUMMON = -1557006, SAY_DEAD = -1557007, - SPELL_BLINK = 34605, SPELL_FROSTBOLT = 32364, SPELL_FIREBALL = 32363, SPELL_FROSTNOVA = 32365, - SPELL_ETHEREAL_BEACON = 32371, // Summons NPC_BEACON SPELL_ETHEREAL_BEACON_VISUAL = 32368, - NPC_BEACON = 18431, NPC_SHAFFAR = 18344, - NR_INITIAL_BEACONS = 3 }; - struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI { boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; } - uint32 Blink_Timer; uint32 Beacon_Timer; uint32 FireBall_Timer; uint32 Frostbolt_Timer; uint32 FrostNova_Timer; - SummonList summons; - bool HasTaunted; bool CanBlink; - void Reset() { Blink_Timer = 1500; @@ -75,24 +62,19 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI FireBall_Timer = 8000; Frostbolt_Timer = 4000; FrostNova_Timer = 15000; - CanBlink = false; - float dist = 8.0f; float posX, posY, posZ, angle; m_creature->GetHomePosition(posX, posY, posZ, angle); - m_creature->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); m_creature->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); m_creature->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); } - void EnterEvadeMode() { summons.DespawnAll(); ScriptedAI::EnterEvadeMode(); } - void MoveInLineOfSight(Unit *who) { if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 100.0f)) @@ -101,141 +83,113 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI HasTaunted = true; } } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); - DoZoneInCombat(); summons.DoZoneInCombat(); } - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == NPC_BEACON) { summoned->CastSpell(summoned,SPELL_ETHEREAL_BEACON_VISUAL,false); - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) summoned->AI()->AttackStart(target); } - summons.Summon(summoned); } - void SummonedCreatureDespawn(Creature *summon) { summons.Despawn(summon); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEAD, m_creature); summons.DespawnAll(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (FrostNova_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - DoCast(m_creature,SPELL_FROSTNOVA); FrostNova_Timer = 17500 + rand()%7500; CanBlink = true; }else FrostNova_Timer -= diff; - if (Frostbolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); Frostbolt_Timer = 4500 + rand()%1500; }else Frostbolt_Timer -= diff; - if (FireBall_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIREBALL); FireBall_Timer = 4500 + rand()%1500; }else FireBall_Timer -= diff; - if (CanBlink) { if (Blink_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - //expire movement, will prevent from running right back to victim after cast //(but should MoveChase be used again at a certain time or should he not move?) if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) m_creature->GetMotionMaster()->MovementExpired(); - DoCast(m_creature,SPELL_BLINK); Blink_Timer = 1000 + rand()%1500; CanBlink = false; }else Blink_Timer -= diff; } - if (Beacon_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - if (!urand(0,3)) DoScriptText(SAY_SUMMON, m_creature); - DoCast(m_creature,SPELL_ETHEREAL_BEACON, true); - Beacon_Timer = 10000; }else Beacon_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_nexusprince_shaffar(Creature* pCreature) { return new boss_nexusprince_shaffarAI (pCreature); } - enum eEnums { SPELL_ARCANE_BOLT = 15254, SPELL_ETHEREAL_APPRENTICE = 32372 // Summon 18430 }; - struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI { mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 Apprentice_Timer; uint32 ArcaneBolt_Timer; uint32 Check_Timer; - void KillSelf() { m_creature->Kill(m_creature); } - void Reset() { Apprentice_Timer = (HeroicMode ? 10000 : 20000); ArcaneBolt_Timer = 1000; Check_Timer = 1000; } - void EnterCombat(Unit *who) { // Send Shaffar to fight @@ -248,17 +202,14 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI if (!Shaffar->isInCombat()) Shaffar->AI()->AttackStart(who); } - void JustSummoned(Creature *summoned) { summoned->AI()->AttackStart(m_creature->getVictim()); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Check_Timer < diff) { Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); @@ -269,62 +220,53 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI } Check_Timer = 1000; }else Check_Timer -= diff; - if (ArcaneBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); ArcaneBolt_Timer = 2000 + rand()%2500; }else ArcaneBolt_Timer -= diff; - if (Apprentice_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - m_creature->CastSpell(m_creature,SPELL_ETHEREAL_APPRENTICE,true); m_creature->ForcedDespawn(); return; }else Apprentice_Timer -= diff; } }; - CreatureAI* GetAI_mob_ethereal_beacon(Creature* pCreature) { return new mob_ethereal_beaconAI (pCreature); } - enum eEthereal { SPELL_ETHEREAL_APPRENTICE_FIREBOLT = 32369, SPELL_ETHEREAL_APPRENTICE_FROSTBOLT = 32370 }; - struct TRINITY_DLL_DECL mob_ethereal_apprenticeAI : public ScriptedAI { mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} - uint32 Cast_Timer; - bool isFireboltTurn; - void Reset() { Cast_Timer = 3000; isFireboltTurn = true; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Cast_Timer < diff) { if (isFireboltTurn) { m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); isFireboltTurn = false; - }else{ + } + else + { m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); isFireboltTurn = true; } @@ -332,26 +274,21 @@ struct TRINITY_DLL_DECL mob_ethereal_apprenticeAI : public ScriptedAI }else Cast_Timer -= diff; } }; - CreatureAI* GetAI_mob_ethereal_apprentice(Creature* pCreature) { return new mob_ethereal_apprenticeAI (pCreature); } - void AddSC_boss_nexusprince_shaffar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_nexusprince_shaffar"; newscript->GetAI = &GetAI_boss_nexusprince_shaffar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ethereal_beacon"; newscript->GetAI = &GetAI_mob_ethereal_beacon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ethereal_apprentice"; newscript->GetAI = &GetAI_mob_ethereal_apprentice; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp index 4f91a8a08df..c30109335d0 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp @@ -13,71 +13,56 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Pandemonius SD%Complete: 75 SDComment: Not known how void blast is done (amount of rapid cast seems to be related to players in party). All mobs remaining in surrounding area should aggro when engaged. SDCategory: Auchindoun, Mana Tombs EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO_1 -1557008 #define SAY_AGGRO_2 -1557009 #define SAY_AGGRO_3 -1557010 - #define SAY_KILL_1 -1557011 #define SAY_KILL_2 -1557012 - #define SAY_DEATH -1557013 - #define EMOTE_DARK_SHELL -1557014 - #define SPELL_VOID_BLAST 32325 #define H_SPELL_VOID_BLAST 38760 #define SPELL_DARK_SHELL 32358 #define H_SPELL_DARK_SHELL 38759 - struct TRINITY_DLL_DECL boss_pandemoniusAI : public ScriptedAI { boss_pandemoniusAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 VoidBlast_Timer; uint32 DarkShell_Timer; uint32 VoidBlast_Counter; - void Reset() { VoidBlast_Timer = 8000+rand()%15000; DarkShell_Timer = 20000; VoidBlast_Counter = 0; } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (VoidBlast_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -86,37 +71,30 @@ struct TRINITY_DLL_DECL boss_pandemoniusAI : public ScriptedAI VoidBlast_Timer = 500; ++VoidBlast_Counter; } - if (VoidBlast_Counter == 5) { VoidBlast_Timer = 15000+rand()%10000; VoidBlast_Counter = 0; } }else VoidBlast_Timer -= diff; - if (!VoidBlast_Counter) { if (DarkShell_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - DoScriptText(EMOTE_DARK_SHELL, m_creature); - DoCast(m_creature,HEROIC(SPELL_DARK_SHELL, H_SPELL_DARK_SHELL)); DarkShell_Timer = 20000; }else DarkShell_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_pandemonius(Creature* pCreature) { return new boss_pandemoniusAI (pCreature); } - void AddSC_boss_pandemonius() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp index 1d0092c2dfc..2d2e60e1e3c 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp @@ -13,63 +13,48 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Darkweaver_Syth SD%Complete: 85 SDComment: Shock spells/times need more work. Heroic partly implemented. SDCategory: Auchindoun, Sethekk Halls EndScriptData */ - #include "precompiled.h" - #define SAY_SUMMON -1556000 - #define SAY_AGGRO_1 -1556001 #define SAY_AGGRO_2 -1556002 #define SAY_AGGRO_3 -1556003 - #define SAY_SLAY_1 -1556004 #define SAY_SLAY_2 -1556005 - #define SAY_DEATH -1556006 - #define SPELL_FROST_SHOCK 21401 //37865 #define SPELL_FLAME_SHOCK 34354 #define SPELL_SHADOW_SHOCK 30138 #define SPELL_ARCANE_SHOCK 37132 - #define SPELL_CHAIN_LIGHTNING 15659 //15305 - #define SPELL_SUMMON_SYTH_FIRE 33537 // Spawns 19203 #define SPELL_SUMMON_SYTH_ARCANE 33538 // Spawns 19205 #define SPELL_SUMMON_SYTH_FROST 33539 // Spawns 19204 #define SPELL_SUMMON_SYTH_SHADOW 33540 // Spawns 19206 - #define SPELL_FLAME_BUFFET (HeroicMode?38141:33526) #define SPELL_ARCANE_BUFFET (HeroicMode?38138:33527) #define SPELL_FROST_BUFFET (HeroicMode?38142:33528) #define SPELL_SHADOW_BUFFET (HeroicMode?38143:33529) - struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI { boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) - { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 flameshock_timer; uint32 arcaneshock_timer; uint32 frostshock_timer; uint32 shadowshock_timer; uint32 chainlightning_timer; - bool summon90; bool summon50; bool summon10; bool HeroicMode; - void Reset() { flameshock_timer = 2000; @@ -77,327 +62,252 @@ struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI frostshock_timer = 6000; shadowshock_timer = 8000; chainlightning_timer = 15000; - summon90 = false; summon50 = false; summon10 = false; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void KilledUnit(Unit* victim) { if (rand()%2) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustSummoned(Creature *summoned) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) summoned->AI()->AttackStart(target); } - void SythSummoning() { DoScriptText(SAY_SUMMON, m_creature); - if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature,SPELL_SUMMON_SYTH_ARCANE,true); //front DoCast(m_creature,SPELL_SUMMON_SYTH_FIRE,true); //back DoCast(m_creature,SPELL_SUMMON_SYTH_FROST,true); //left DoCast(m_creature,SPELL_SUMMON_SYTH_SHADOW,true); //right } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 90) && !summon90) { SythSummoning(); summon90 = true; } - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 50) && !summon50) { SythSummoning(); summon50 = true; } - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 10) && !summon10) { SythSummoning(); summon10 = true; } - if (flameshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FLAME_SHOCK); - flameshock_timer = 10000 + rand()%5000; } else flameshock_timer -= diff; - if (arcaneshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_ARCANE_SHOCK); - arcaneshock_timer = 10000 + rand()%5000; } else arcaneshock_timer -= diff; - if (frostshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FROST_SHOCK); - frostshock_timer = 10000 + rand()%5000; } else frostshock_timer -= diff; - if (shadowshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_SHADOW_SHOCK); - shadowshock_timer = 10000 + rand()%5000; } else shadowshock_timer -= diff; - if (chainlightning_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_CHAIN_LIGHTNING); - chainlightning_timer = 25000; } else chainlightning_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_darkweaver_syth(Creature* pCreature) { return new boss_darkweaver_sythAI (pCreature); } - /* ELEMENTALS */ - struct TRINITY_DLL_DECL mob_syth_fireAI : public ScriptedAI { mob_syth_fireAI(Creature *c) : ScriptedAI(c) - { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 flameshock_timer; uint32 flamebuffet_timer; bool HeroicMode; - void Reset() { m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); flameshock_timer = 2500; flamebuffet_timer = 5000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (flameshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FLAME_SHOCK); - flameshock_timer = 5000; }else flameshock_timer -= diff; - if (flamebuffet_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FLAME_BUFFET); - flamebuffet_timer = 5000; }else flamebuffet_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_syth_fire(Creature* pCreature) { return new mob_syth_fireAI (pCreature); } - struct TRINITY_DLL_DECL mob_syth_arcaneAI : public ScriptedAI { mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) - { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 arcaneshock_timer; uint32 arcanebuffet_timer; bool HeroicMode; - void Reset() { m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ARCANE, true); arcaneshock_timer = 2500; arcanebuffet_timer = 5000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (arcaneshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_ARCANE_SHOCK); - arcaneshock_timer = 5000; }else arcaneshock_timer -= diff; - if (arcanebuffet_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_ARCANE_BUFFET); - arcanebuffet_timer = 5000; }else arcanebuffet_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_syth_arcane(Creature* pCreature) { return new mob_syth_arcaneAI (pCreature); } - struct TRINITY_DLL_DECL mob_syth_frostAI : public ScriptedAI { mob_syth_frostAI(Creature *c) : ScriptedAI(c) - { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 frostshock_timer; uint32 frostbuffet_timer; bool HeroicMode; - void Reset() { m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); frostshock_timer = 2500; frostbuffet_timer = 5000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (frostshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FROST_SHOCK); - frostshock_timer = 5000; }else frostshock_timer -= diff; - if (frostbuffet_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_FROST_BUFFET); - frostbuffet_timer = 5000; }else frostbuffet_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_syth_frost(Creature* pCreature) { return new mob_syth_frostAI (pCreature); } - struct TRINITY_DLL_DECL mob_syth_shadowAI : public ScriptedAI { mob_syth_shadowAI(Creature *c) : ScriptedAI(c) - { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 shadowshock_timer; uint32 shadowbuffet_timer; bool HeroicMode; - void Reset() { m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_SHADOW, true); shadowshock_timer = 2500; shadowbuffet_timer = 5000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (shadowshock_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_SHADOW_SHOCK); - shadowshock_timer = 5000; }else shadowshock_timer -= diff; - if (shadowbuffet_timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_SHADOW_BUFFET); - shadowbuffet_timer = 5000; }else shadowbuffet_timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_syth_shadow(Creature* pCreature) { return new mob_syth_shadowAI (pCreature); } - void AddSC_boss_darkweaver_syth() { Script *newscript; @@ -405,22 +315,18 @@ void AddSC_boss_darkweaver_syth() newscript->Name = "boss_darkweaver_syth"; newscript->GetAI = &GetAI_boss_darkweaver_syth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_syth_fire"; newscript->GetAI = &GetAI_mob_syth_arcane; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_syth_arcane"; newscript->GetAI = &GetAI_mob_syth_arcane; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_syth_frost"; newscript->GetAI = &GetAI_mob_syth_frost; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_syth_shadow"; newscript->GetAI = &GetAI_mob_syth_shadow; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp index eafd0b2d0fd..672fe5fec58 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp @@ -13,67 +13,51 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Talon_King_Ikiss SD%Complete: 80 SDComment: Heroic supported. Some details missing, but most are spell related. SDCategory: Auchindoun, Sethekk Halls EndScriptData */ - #include "precompiled.h" #include "def_sethekk_halls.h" - #define SAY_INTRO -1556007 - #define SAY_AGGRO_1 -1556008 #define SAY_AGGRO_2 -1556009 #define SAY_AGGRO_3 -1556010 - #define SAY_SLAY_1 -1556011 #define SAY_SLAY_2 -1556012 #define SAY_DEATH -1556013 #define EMOTE_ARCANE_EXP -1556015 - #define SPELL_BLINK 38194 #define SPELL_BLINK_TELEPORT 38203 #define SPELL_MANA_SHIELD 38151 #define SPELL_ARCANE_BUBBLE 9438 #define H_SPELL_SLOW 35032 - #define SPELL_POLYMORPH 38245 #define H_SPELL_POLYMORPH 43309 - #define SPELL_ARCANE_VOLLEY 35059 #define H_SPELL_ARCANE_VOLLEY 40424 - #define SPELL_ARCANE_EXPLOSION 38197 #define H_SPELL_ARCANE_EXPLOSION 40425 - struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI { boss_talon_king_ikissAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - bool HeroicMode; - uint32 ArcaneVolley_Timer; uint32 Sheep_Timer; uint32 Blink_Timer; uint32 Slow_Timer; - bool ManaShield; bool Blink; bool Intro; - void Reset() { HeroicMode = m_creature->GetMap()->IsHeroic(); - ArcaneVolley_Timer = 5000; Sheep_Timer = 8000; Blink_Timer = 35000; @@ -82,7 +66,6 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI Intro = false; ManaShield = false; } - void MoveInLineOfSight(Unit *who) { if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) @@ -92,10 +75,8 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI Intro = true; DoScriptText(SAY_INTRO, m_creature); } - if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) { @@ -104,43 +85,35 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_IKISSDOOREVENT, DONE); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Blink) { DoCast(m_creature,HEROIC(SPELL_ARCANE_EXPLOSION, H_SPELL_ARCANE_EXPLOSION)); m_creature->CastSpell(m_creature,SPELL_ARCANE_BUBBLE,true); Blink = false; } - if (ArcaneVolley_Timer < diff) { DoCast(m_creature,HEROIC(SPELL_ARCANE_VOLLEY, H_SPELL_ARCANE_VOLLEY)); ArcaneVolley_Timer = 7000+rand()%5000; }else ArcaneVolley_Timer -= diff; - if (Sheep_Timer < diff) { //second top aggro target in normal, random target in heroic correct? @@ -150,14 +123,12 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI DoCast(target,HEROIC(SPELL_POLYMORPH, H_SPELL_POLYMORPH)); Sheep_Timer = 15000+rand()%2500; }else Sheep_Timer -= diff; - //may not be correct time to cast if (!ManaShield && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20)) { DoCast(m_creature,SPELL_MANA_SHIELD); ManaShield = true; } - if (HeroicMode) { if (Slow_Timer < diff) @@ -166,41 +137,32 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI Slow_Timer = 15000+rand()%25000; }else Slow_Timer -= diff; } - if (Blink_Timer < diff) { DoScriptText(EMOTE_ARCANE_EXP, m_creature); - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - //Spell doesn't work, but we use for visual effect at least DoCast(target,SPELL_BLINK); - float X = target->GetPositionX(); float Y = target->GetPositionY(); float Z = target->GetPositionZ(); - DoTeleportTo(X,Y,Z); - DoCast(target,SPELL_BLINK_TELEPORT); Blink = true; } Blink_Timer = 35000+rand()%5000; }else Blink_Timer -= diff; - if (!Blink) DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_talon_king_ikiss(Creature* pCreature) { return new boss_talon_king_ikissAI (pCreature); } - void AddSC_boss_talon_king_ikiss() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h index 79a6cd4952d..e3e4f0c6656 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SETHEKK_HALLS_H #define DEF_SETHEKK_HALLS_H - enum eTypes { DATA_IKISSDOOREVENT = 1, diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp index 942325bd315..44fab706f58 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance - Sethekk Halls SD%Complete: 50 SDComment: Instance Data for Sethekk Halls instance SDCategory: Auchindoun, Sethekk Halls EndScriptData */ - #include "precompiled.h" #include "def_sethekk_halls.h" - enum eEnums { NPC_ANZU = 23035, IKISS_DOOR = 177203, }; - struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance { instance_sethekk_halls(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 AnzuEncounter; uint64 m_uiIkissDoorGUID; - void Initialize() { AnzuEncounter = NOT_STARTED; m_uiIkissDoorGUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { if (pCreature->GetEntry() == NPC_ANZU) @@ -53,13 +46,11 @@ struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance AnzuEncounter = IN_PROGRESS; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { if (pGo->GetEntry() == IKISS_DOOR) m_uiIkissDoorGUID = pGo->GetGUID(); } - void SetData(uint32 type, uint32 data) { switch(type) @@ -74,12 +65,10 @@ struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_sethekk_halls(Map* pMap) { return new instance_sethekk_halls(pMap); } - void AddSC_instance_sethekk_halls() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp index aeb9f15b8ba..d6d92da05b6 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Ambassador_Hellmaw SD%Complete: 80 SDComment: Enrage spell missing/not known SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ - #include "precompiled.h" #include "escort_ai.h" #include "def_shadow_labyrinth.h" - enum eEnums { SAY_INTRO = -1555000, @@ -35,13 +32,11 @@ enum eEnums SAY_SLAY1 = -1555005, SAY_SLAY2 = -1555006, SAY_DEATH = -1555007, - SPELL_BANISH = 30231, SPELL_CORROSIVE_ACID = 33551, SPELL_FEAR = 33547, SPELL_ENRAGE = 34970 }; - struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI { boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) @@ -49,10 +44,8 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI m_pInstance = pCreature->GetInstanceData(); HeroicMode = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* m_pInstance; bool HeroicMode; - uint32 EventCheck_Timer; uint32 CorrosiveAcid_Timer; uint32 Fear_Timer; @@ -60,7 +53,6 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI bool Intro; bool IsBanished; bool Enraged; - void Reset() { EventCheck_Timer = 5000; @@ -70,40 +62,32 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI Intro = false; IsBanished = true; Enraged = false; - if (m_pInstance && m_creature->isAlive()) { if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) m_creature->CastSpell(m_creature, SPELL_BANISH, true); } } - void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_HELLMAW, FAIL); } - void MoveInLineOfSight(Unit* pWho) { if (m_creature->HasAura(SPELL_BANISH)) return; - npc_escortAI::MoveInLineOfSight(pWho); } - void WaypointReached(uint32 i) { } - void DoIntro() { if (m_creature->HasAura(SPELL_BANISH)) m_creature->RemoveAurasDueToSpell(SPELL_BANISH); - IsBanished = false; Intro = true; - if (m_pInstance) { if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) @@ -111,29 +95,23 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI DoScriptText(SAY_INTRO, m_creature); Start(true, false, 0, NULL, false, true); } - m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); } } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (m_pInstance) m_pInstance->SetData(TYPE_HELLMAW, DONE); } - void UpdateAI(const uint32 diff) { if (!Intro && !HasEscortState(STATE_ESCORT_ESCORTING)) @@ -157,30 +135,24 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI return; } } - npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) return; - if (m_creature->HasAura(SPELL_BANISH, 0)) { EnterEvadeMode(); return; } - if (CorrosiveAcid_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CORROSIVE_ACID); CorrosiveAcid_Timer = 15000 + rand()%10000; }else CorrosiveAcid_Timer -= diff; - if (Fear_Timer < diff) { DoCast(m_creature,SPELL_FEAR); Fear_Timer = 20000 + rand()%15000; }else Fear_Timer -= diff; - if (HeroicMode) { if (!Enraged && Enrage_Timer < diff) @@ -191,12 +163,10 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI } } }; - CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature) { return new boss_ambassador_hellmawAI(pCreature); } - void AddSC_boss_ambassador_hellmaw() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp index 1eca5a36734..c400cc1de95 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Blackheart_the_Inciter SD%Complete: 75 SDComment: Incite Chaos not functional since core lacks Mind Control support SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ - #include "precompiled.h" #include "def_shadow_labyrinth.h" - #define SPELL_INCITE_CHAOS 33676 #define SPELL_INCITE_CHAOS_B 33684 //debuff applied to each member of party #define SPELL_CHARGE 33709 #define SPELL_WAR_STOMP 33707 - #define SAY_INTRO1 -1555008 //not used #define SAY_INTRO2 -1555009 //not used #define SAY_INTRO3 -1555010 //not used @@ -39,7 +35,6 @@ EndScriptData */ #define SAY_SLAY2 -1555015 #define SAY_HELP -1555016 //not used #define SAY_DEATH -1555017 - //below, not used #define SAY2_INTRO1 -1555018 #define SAY2_INTRO2 -1555019 @@ -51,22 +46,18 @@ EndScriptData */ #define SAY2_SLAY2 -1555025 #define SAY2_HELP -1555026 #define SAY2_DEATH -1555027 - struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI { boss_blackheart_the_inciterAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - bool InciteChaos; uint32 InciteChaos_Timer; uint32 InciteChaosWait_Timer; uint32 Charge_Timer; uint32 Knockback_Timer; - void Reset() { InciteChaos = false; @@ -74,38 +65,30 @@ struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI InciteChaosWait_Timer = 15000; Charge_Timer = 5000; Knockback_Timer = 15000; - if (pInstance) pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, NOT_STARTED); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); - if (pInstance) pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (InciteChaos) { if (InciteChaosWait_Timer < diff) @@ -113,28 +96,23 @@ struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI InciteChaos = false; InciteChaosWait_Timer = 15000; }else InciteChaosWait_Timer -= diff; - return; } - if (InciteChaos_Timer < diff) { DoCast(m_creature, SPELL_INCITE_CHAOS); - std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) target->CastSpell(target,SPELL_INCITE_CHAOS_B,true); } - DoResetThreat(); InciteChaos = true; InciteChaos_Timer = 40000; return; }else InciteChaos_Timer -= diff; - //Charge_Timer if (Charge_Timer < diff) { @@ -142,14 +120,12 @@ struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI DoCast(target, SPELL_CHARGE); Charge_Timer = 15000 + rand()%10000; }else Charge_Timer -= diff; - //Knockback_Timer if (Knockback_Timer < diff) { DoCast(m_creature, SPELL_WAR_STOMP); Knockback_Timer = 18000 + rand()%6000; }else Knockback_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -157,7 +133,6 @@ CreatureAI* GetAI_boss_blackheart_the_inciter(Creature* pCreature) { return new boss_blackheart_the_inciterAI (pCreature); } - void AddSC_boss_blackheart_the_inciter() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp index 34bcdd86175..6fe4eada5e6 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Grandmaster_Vorpil SD%Complete: 100 SDComment: SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ - #include "precompiled.h" #include "def_shadow_labyrinth.h" - #define SAY_INTRO -1555028 #define SAY_AGGRO1 -1555029 #define SAY_AGGRO2 -1555030 @@ -32,25 +29,19 @@ EndScriptData */ #define SAY_SLAY1 -1555033 #define SAY_SLAY2 -1555034 #define SAY_DEATH -1555035 - #define SPELL_RAIN_OF_FIRE 33617 #define H_SPELL_RAIN_OF_FIRE 39363 - #define SPELL_DRAW_SHADOWS 33563 #define SPELL_SHADOWBOLT_VOLLEY 33841 #define SPELL_BANISH 38791 - #define MOB_VOID_TRAVELER 19226 #define SPELL_SACRIFICE 33587 #define SPELL_SHADOW_NOVA 33846 #define SPELL_EMPOWERING_SHADOWS 33783 #define H_SPELL_EMPOWERING_SHADOWS 39364 - #define MOB_VOID_PORTAL 19224 #define SPELL_VOID_PORTAL_VISUAL 33569 - float VorpilPosition[3] = {-252.8820,-264.3030,17.1}; - float VoidPortalCoords[5][3] = { {-283.5894, -239.5718, 12.7}, @@ -59,28 +50,23 @@ float VoidPortalCoords[5][3] = {-209.3401, -262.7564, 17.1}, {-261.4533, -297.3298, 17.1} }; - struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI { mob_voidtravelerAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; Unit *Vorpil; uint32 move; bool sacrificed; - void Reset() { Vorpil = NULL; move = 0; sacrificed = false; } - void EnterCombat(Unit *who){} - void UpdateAI(const uint32 diff) { if (!Vorpil) @@ -121,7 +107,6 @@ CreatureAI* GetAI_mob_voidtraveler(Creature* pCreature) { return new mob_voidtravelerAI (pCreature); } - struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI { boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) @@ -130,18 +115,15 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI HeroicMode = c->GetMap()->IsHeroic(); Intro = false; } - ScriptedInstance *pInstance; bool Intro, HelpYell; bool sumportals; bool HeroicMode; - uint32 ShadowBoltVolley_Timer; uint32 DrawShadows_Timer; uint32 summonTraveler_Timer; uint32 banish_Timer; uint64 PortalsGuid[5]; - void Reset() { ShadowBoltVolley_Timer = 7000 + rand()%7000; @@ -150,11 +132,9 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI banish_Timer = 17000; HelpYell = false; destroyPortals(); - if (pInstance) pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); } - void summonPortals() { if (!sumportals) @@ -173,7 +153,6 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI summonTraveler_Timer = 5000; } } - void destroyPortals() { if (sumportals) @@ -188,7 +167,6 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI sumportals = false; } } - void spawnVoidTraveler() { int pos = urand(0,4); @@ -199,58 +177,47 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI HelpYell = true; } } - void JustSummoned(Creature *summoned) { if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER) CAST_AI(mob_voidtravelerAI, summoned->AI())->Vorpil = m_creature; } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); destroyPortals(); - if (pInstance) pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); summonPortals(); - if (pInstance) pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); } - void MoveInLineOfSight(Unit *who) { ScriptedAI::MoveInLineOfSight(who); - if (!Intro && m_creature->IsWithinLOSInMap(who)&& m_creature->IsWithinDistInMap(who, 100) && m_creature->IsHostileTo(who)) { DoScriptText(SAY_INTRO, m_creature); Intro = true; } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ShadowBoltVolley_Timer < diff) { DoCast(m_creature,SPELL_SHADOWBOLT_VOLLEY); ShadowBoltVolley_Timer = 15000 + rand()%15000;; } else ShadowBoltVolley_Timer -= diff; - if (HeroicMode && banish_Timer < diff) { Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,30,false); @@ -260,25 +227,20 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI banish_Timer = 16000; } } else banish_Timer -= diff; - if (DrawShadows_Timer < diff) { Map* pMap = m_creature->GetMap(); Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + 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)) i_pl->TeleportTo(m_creature->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); - m_creature->GetMap()->CreatureRelocation(m_creature, VorpilPosition[0],VorpilPosition[1],VorpilPosition[2],0.0f); DoCast(m_creature,SPELL_DRAW_SHADOWS,true); - DoCast(m_creature,HeroicMode?H_SPELL_RAIN_OF_FIRE:SPELL_RAIN_OF_FIRE); - ShadowBoltVolley_Timer = 6000; DrawShadows_Timer = 30000; } else DrawShadows_Timer -= diff; - if (summonTraveler_Timer < diff) { spawnVoidTraveler(); @@ -287,7 +249,6 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI if ((m_creature->GetHealth()*5) < m_creature->GetMaxHealth()) summonTraveler_Timer = 5000; } else summonTraveler_Timer -=diff; - DoMeleeAttackIfReady(); } }; @@ -295,7 +256,6 @@ CreatureAI* GetAI_boss_grandmaster_vorpil(Creature* pCreature) { return new boss_grandmaster_vorpilAI (pCreature); } - void AddSC_boss_grandmaster_vorpil() { Script *newscript; @@ -303,7 +263,6 @@ void AddSC_boss_grandmaster_vorpil() newscript->Name = "boss_grandmaster_vorpil"; newscript->GetAI = &GetAI_boss_grandmaster_vorpil; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_voidtraveler"; newscript->GetAI = &GetAI_mob_voidtraveler; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp index 7782b5fed62..6ab5baaf56c 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Murmur SD%Complete: 90 SDComment: Timers may be incorrect SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ - #include "precompiled.h" #include "def_shadow_labyrinth.h" - #define EMOTE_SONIC_BOOM -1555036 - #define SPELL_SONIC_BOOM_CAST (HeroicMode?38796:33923) #define SPELL_SONIC_BOOM_EFFECT (HeroicMode?38795:33666) #define SPELL_RESONANCE 33657 @@ -33,7 +29,6 @@ EndScriptData */ #define SPELL_MAGNETIC_PULL 33689 #define SPELL_SONIC_SHOCK 38797 #define SPELL_THUNDERING_STORM 39365 - struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI { boss_murmurAI(Creature *c) : ScriptedAI(c) @@ -41,7 +36,6 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI SetCombatMovement(false); HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 SonicBoom_Timer; uint32 MurmursTouch_Timer; uint32 Resonance_Timer; @@ -50,7 +44,6 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI uint32 ThunderingStorm_Timer; bool HeroicMode; bool SonicBoom; - void Reset() { SonicBoom_Timer = 30000; @@ -60,17 +53,15 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI ThunderingStorm_Timer = 15000; SonicShock_Timer = 10000; SonicBoom = false; - //database should have `RegenHealth`=0 to prevent regen uint32 hp = (m_creature->GetMaxHealth()*40)/100; if (hp) m_creature->SetHealth(hp); m_creature->ResetPlayerDamageReq(); } - void SonicBoomEffect() { std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) @@ -84,28 +75,23 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { } - // Sonic Boom instant damage (needs core fix instead of this) void SpellHitTarget(Unit *target, const SpellEntry *spell) { if (target && target->isAlive() && spell && spell->Id == SPELL_SONIC_BOOM_EFFECT) m_creature->DealDamage(target,(target->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); } - void UpdateAI(const uint32 diff) { //Return since we have no target or casting if (!UpdateVictim() || m_creature->IsNonMeleeSpellCasted(false)) return; - // Sonic Boom if (SonicBoom) { DoCast(m_creature, SPELL_SONIC_BOOM_EFFECT, true); SonicBoomEffect(); - SonicBoom = false; Resonance_Timer = 1500; } @@ -117,7 +103,6 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI SonicBoom = true; return; }else SonicBoom_Timer -= diff; - // Murmur's Touch if (MurmursTouch_Timer < diff) { @@ -125,7 +110,6 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI DoCast(target, SPELL_MURMURS_TOUCH); MurmursTouch_Timer = 25000 + rand()%10000; }else MurmursTouch_Timer -= diff; - // Resonance if (!SonicBoom && !(m_creature->IsWithinMeleeRange(m_creature->getVictim()))) { @@ -135,7 +119,6 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI Resonance_Timer = 5000; }else Resonance_Timer -= diff; } - // Magnetic Pull if (MagneticPull_Timer < diff) { @@ -148,20 +131,18 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI } MagneticPull_Timer = 500; }else MagneticPull_Timer -= diff; - if (HeroicMode) { // Thundering Storm if (ThunderingStorm_Timer < diff) { std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (target->isAlive() && !m_creature->IsWithinDist(target, 35, false)) DoCast(target, SPELL_THUNDERING_STORM, true); ThunderingStorm_Timer = 15000; }else ThunderingStorm_Timer -= diff; - // Sonic Shock if (SonicShock_Timer < diff) { @@ -171,14 +152,13 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI SonicShock_Timer = 10000+rand()%10000; }else SonicShock_Timer -= diff; } - // Select nearest most aggro target if top aggro too far if (!m_creature->isAttackReady()) return; if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) { std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (target->isAlive() && m_creature->IsWithinMeleeRange(target)) { @@ -186,16 +166,13 @@ struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_murmur(Creature* pCreature) { return new boss_murmurAI (pCreature); } - void AddSC_boss_murmur() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h index a78955368bf..a5f233dbbca 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SHADOW_LABYRINTH_H #define DEF_SHADOW_LABYRINTH_H - #define TYPE_HELLMAW 1 #define TYPE_OVERSEER 2 #define DATA_BLACKHEARTTHEINCITEREVENT 3 diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp index f8f3b73bffa..1897f405415 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp @@ -13,61 +13,46 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Shadow_Labyrinth SD%Complete: 85 SDComment: Some cleanup left along with save SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ - #include "precompiled.h" #include "def_shadow_labyrinth.h" - #define MAX_ENCOUNTER 5 - #define REFECTORY_DOOR 183296 //door opened when blackheart the inciter dies #define SCREAMING_HALL_DOOR 183295 //door opened when grandmaster vorpil dies - /* Shadow Labyrinth encounters: 1 - Ambassador Hellmaw event 2 - Blackheart the Inciter event 3 - Grandmaster Vorpil event 4 - Murmur event */ - struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance { instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - uint64 m_uiRefectoryDoorGUID; uint64 m_uiScreamingHallDoorGUID; - uint64 m_uiGrandmasterVorpil; uint32 m_uiFelOverseerCount; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiRefectoryDoorGUID = 0; m_uiScreamingHallDoorGUID = 0; - m_uiGrandmasterVorpil = 0; m_uiFelOverseerCount = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -84,7 +69,6 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -101,7 +85,6 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance break; } } - void SetData(uint32 type, uint32 uiData) { switch(type) @@ -109,7 +92,6 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance case TYPE_HELLMAW: m_auiEncounter[0] = uiData; break; - case TYPE_OVERSEER: if (uiData != DONE) { @@ -119,7 +101,6 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance if (m_uiFelOverseerCount) { --m_uiFelOverseerCount; - if (m_uiFelOverseerCount) debug_log("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); else @@ -129,42 +110,33 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance } } break; - case DATA_BLACKHEARTTHEINCITEREVENT: if (uiData == DONE) DoUseDoorOrButton(m_uiRefectoryDoorGUID); m_auiEncounter[2] = uiData; break; - case DATA_GRANDMASTERVORPILEVENT: if (uiData == DONE) DoUseDoorOrButton(m_uiScreamingHallDoorGUID); m_auiEncounter[3] = uiData; break; - case DATA_MURMUREVENT: m_auiEncounter[4] = uiData; break; } - if (uiData == DONE) { if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) return; - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint32 GetData(uint32 type) { switch(type) @@ -176,20 +148,16 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance } return false; } - uint64 GetData64(uint32 identifier) { if (identifier == DATA_GRANDMASTERVORPIL) return m_uiGrandmasterVorpil; - return 0; } - std::string GetSaveData() { return str_data; } - void Load(const char* in) { if (!in) @@ -197,25 +165,19 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_shadow_labyrinth(Map* pMap) { return new instance_shadow_labyrinth(pMap); } - void AddSC_instance_shadow_labyrinth() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp b/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp index 270dafabe54..3e8714217cd 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp @@ -13,53 +13,41 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Black_Temple SD%Complete: 95 SDComment: Spirit of Olum: Player Teleporter to Seer Kanai Teleport after defeating Naj'entus and Supremus. TODO: Find proper gossip. SDCategory: Black Temple EndScriptData */ - /* ContentData npc_spirit_of_olum EndContentData */ - #include "precompiled.h" #include "def_black_temple.h" - /*### # npc_spirit_of_olum ####*/ - #define SPELL_TELEPORT 41566 // s41566 - Teleport to Ashtongue NPC's #define GOSSIP_OLUM1 "Teleport me to the other Ashtongue Deathsworn" - bool GossipHello_npc_spirit_of_olum(Player* pPlayer, Creature* pCreature) { ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && (pInstance->GetData(DATA_SUPREMUSEVENT) >= DONE) && (pInstance->GetData(DATA_HIGHWARLORDNAJENTUSEVENT) >= DONE)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_OLUM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_spirit_of_olum(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->InterruptNonMeleeSpells(false); pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, false); return true; } - void AddSC_black_temple() { Script *newscript; - newscript = new Script; newscript->Name = "npc_spirit_of_olum"; newscript->pGossipHello = &GossipHello_npc_spirit_of_olum; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_bloodboil.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_bloodboil.cpp index be303f85980..c1f7f51e9b3 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_bloodboil.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_bloodboil.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Bloodboil SD%Complete: 80 SDComment: Bloodboil not working correctly, missing enrage SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - //Speech'n'Sound #define SAY_AGGRO -1564029 #define SAY_SLAY1 -1564030 @@ -33,7 +30,6 @@ EndScriptData */ #define SAY_ENRAGE1 -1564034 #define SAY_ENRAGE2 -1564035 #define SAY_DEATH -1564036 - //Spells #define SPELL_ACID_GEYSER 40630 #define SPELL_ACIDIC_WOUND 40481 @@ -50,22 +46,16 @@ EndScriptData */ #define SPELL_TAUNT_GURTOGG 40603 #define SPELL_INSIGNIFIGANCE 40618 #define SPELL_BERSERK 45078 - //This is used to sort the players by distance in preparation for the Bloodboil cast. - struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI { boss_gurtogg_bloodboilAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 TargetGUID; - float TargetThreat; - uint32 BloodboilTimer; uint32 BloodboilCount; uint32 AcidGeyserTimer; @@ -76,18 +66,13 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI uint32 EjectTimer; uint32 BewilderingStrikeTimer; uint32 PhaseChangeTimer; - bool Phase1; - void Reset() { if (pInstance) pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, NOT_STARTED); - TargetGUID = 0; - TargetThreat = 0; - BloodboilTimer = 10000; BloodboilCount = 0; AcidGeyserTimer = 1000; @@ -98,13 +83,10 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI EjectTimer = 10000; BewilderingStrikeTimer = 15000; PhaseChangeTimer = 60000; - Phase1 = true; - m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } - void EnterCombat(Unit *who) { DoZoneInCombat(); @@ -112,65 +94,55 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); } - // Note: This seems like a very complicated fix. The fix needs to be handled by the core, as implementation of limited-target AoE spells are still not limited. void CastBloodboil() { // Get the Threat List std::list m_threatlist = m_creature->getThreatManager().getThreatList(); - if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue return; - std::list targets; std::list::iterator itr = m_threatlist.begin(); - for(; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container + for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //only on alive players if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); } - //Sort the list of players targets.sort(ObjectDistanceOrderReversed(m_creature)); //Resize so we only get top 5 targets.resize(5); - //Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL); if (spellInfo) { - for(std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) { Unit* target = *itr; if (!target) return; - for(uint32 i = 0;i<3; ++i) + for (uint32 i = 0; i<3; ++i) { uint8 eff = spellInfo->Effect[i]; if (eff>=TOTAL_SPELL_EFFECTS) continue; - Aura *Aur = new Aura(spellInfo, i, target, target, target); target->AddAura(Aur); } } }*/ } - void RevertThreatOnTarget(uint64 guid) { Unit* pUnit = NULL; @@ -183,24 +155,20 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI m_creature->AddThreat(pUnit, TargetThreat); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ArcingSmashTimer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCING_SMASH); ArcingSmashTimer = 10000; }else ArcingSmashTimer -= diff; - if (FelAcidTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FEL_ACID); FelAcidTimer = 25000; }else FelAcidTimer -= diff; - if (!m_creature->HasAura(SPELL_BERSERK)) { if (EnrageTimer < diff) @@ -209,7 +177,6 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI DoScriptText(RAND(SAY_ENRAGE1,SAY_ENRAGE2), m_creature); }else EnrageTimer -= diff; } - if (Phase1) { if (BewilderingStrikeTimer < diff) @@ -220,20 +187,17 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI m_creature->AddThreat(target, mt_threat); BewilderingStrikeTimer = 20000; }else BewilderingStrikeTimer -= diff; - if (EjectTimer < diff) { DoCast(m_creature->getVictim(), SPELL_EJECT1); DoModifyThreatPercent(m_creature->getVictim(), -40); EjectTimer = 15000; }else EjectTimer -= diff; - if (AcidicWoundTimer < diff) { DoCast(m_creature->getVictim(), SPELL_ACIDIC_WOUND); AcidicWoundTimer = 10000; }else AcidicWoundTimer -= diff; - if (BloodboilTimer < diff) { if (BloodboilCount < 5) // Only cast it five times. @@ -245,7 +209,6 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI } }else BloodboilTimer -= diff; } - if (!Phase1) { if (AcidGeyserTimer < diff) @@ -253,14 +216,12 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_ACID_GEYSER); AcidGeyserTimer = 30000; }else AcidGeyserTimer -= diff; - if (EjectTimer < diff) { DoCast(m_creature->getVictim(), SPELL_EJECT2); EjectTimer = 15000; }else EjectTimer -= diff; } - if (PhaseChangeTimer < diff) { if (Phase1) @@ -269,7 +230,6 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI if (target && target->isAlive()) { Phase1 = false; - TargetThreat = DoGetThreat(target); TargetGUID = target->GetGUID(); target->CastSpell(m_creature, SPELL_TAUNT_GURTOGG, true); @@ -285,12 +245,9 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI /* These spells do not work, comment them out for now. DoCast(target, SPELL_FEL_RAGE_2, true); DoCast(target, SPELL_FEL_RAGE_3, true);*/ - //Cast this without triggered so that it appears in combat logs and shows visual. DoCast(m_creature, SPELL_FEL_RAGE_SELF); - DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), m_creature); - AcidGeyserTimer = 1000; PhaseChangeTimer = 30000; } @@ -311,16 +268,13 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } }else PhaseChangeTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_gurtogg_bloodboil(Creature* pCreature) { return new boss_gurtogg_bloodboilAI (pCreature); } - void AddSC_boss_gurtogg_bloodboil() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_illidan.cpp index e081e33eb06..9928ca54fd0 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_illidan.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_illidan.cpp @@ -13,26 +13,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_illidan_stormrage SD%Complete: 90 SDComment: Somewhat of a workaround for Parasitic Shadowfiend, unable to summon GOs for Cage Trap. SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - #define GETGO(obj, guid) GameObject* obj = pInstance->instance->GetGameObject(guid) #define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*m_creature, guid) #define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*m_creature, guid) #define HPPCT(unit) unit->GetHealth()*100 / unit->GetMaxHealth() - /************* Quotes and Sounds ***********************/ // Gossip for when a player clicks Akama #define GOSSIP_ITEM "We are ready to face Illidan" - // Yells for/by Akama #define SAY_AKAMA_BEWARE "Be wary friends, The Betrayer meditates in the court just beyond." #define SOUND_AKAMA_BEWARE 11388 @@ -40,31 +35,25 @@ EndScriptData */ #define SOUND_AKAMA_MINION 11465 #define SAY_AKAMA_LEAVE "I'll deal with these mongrels. Strike now, friends! Strike at the betrayer!" #define SOUND_AKAMA_LEAVE 11390 - // Self explanatory const char* SAY_KILL1 = "Who shall be next to taste my blades?!"; #define SOUND_KILL1 11473 const char* SAY_KILL2 = "This is too easy!"; #define SOUND_KILL2 11472 - // I think I'll fly now and let my subordinates take you on #define SAY_TAKEOFF "I will not be touched by rabble such as you!" #define SOUND_TAKEOFF 11479 #define SAY_SUMMONFLAMES "Behold the flames of Azzinoth!" #define SOUND_SUMMONFLAMES 11480 - // When casting Eye Blast. Demon Fire will be appear on places that he casts this #define SAY_EYE_BLAST "Stare into the eyes of the Betrayer!" #define SOUND_EYE_BLAST 11481 - // kk, I go big, dark and demon on you. #define SAY_MORPH "Behold the power... of the demon within!" #define SOUND_MORPH 11475 - // I KILL! #define SAY_ENRAGE "You've wasted too much time mortals, now you shall fall!" #define SOUND_ENRAGE 11474 - /************** Spells *************/ // Normal Form #define SPELL_SHEAR 37335 // 41032 is bugged, cannot be block/dodge/parry// Reduces Max. Health by 60% for 7 seconds. Can stack 19 times. 1.5 second cast @@ -128,18 +117,14 @@ const char* SAY_KILL2 = "This is too easy!"; #define SPELL_SHADOW_STRIKE 40685 // 4375 to 5625 every 3 seconds for 12 seconds #define SPELL_THROW_DAGGER 41152 // 5400 to 6600 damage, need dagger #define SPELL_FAN_BLADES 39954 // bugged visual - // Other defines #define CENTER_X 676.740 #define CENTER_Y 305.297 #define CENTER_Z 353.192 - #define FLAME_ENRAGE_DISTANCE 30 #define FLAME_CHARGE_DISTANCE 50 - #define EQUIP_ID_MAIN_HAND 32837 #define EQUIP_ID_OFF_HAND 32838 - /**** Creature Summon and Recognition IDs ****/ enum CreatureEntry { @@ -159,7 +144,6 @@ enum CreatureEntry PARASITIC_SHADOWFIEND = 23498, CAGE_TRAP_TRIGGER = 23292, }; - /*** Phase Names ***/ enum PhaseIllidan { @@ -174,7 +158,6 @@ enum PhaseIllidan PHASE_TRANSFORM_SEQUENCE = 8, PHASE_ILLIDAN_MAX = 9, };//Maiev uses the same phase - enum PhaseAkama { PHASE_AKAMA_NULL = 0, @@ -185,7 +168,6 @@ enum PhaseAkama PHASE_FIGHT_MINIONS = 5, PHASE_RETURN = 6, }; - enum EventIllidan { EVENT_NULL = 0, @@ -215,7 +197,6 @@ enum EventIllidan EVENT_FLIGHT_SEQUENCE = 2, EVENT_TRANSFORM_SEQUENCE = 2, }; - enum EventMaiev { EVENT_MAIEV_NULL = 0, @@ -225,7 +206,6 @@ enum EventMaiev EVENT_MAIEV_THROW_DAGGER = 4, EVENT_MAIEV_TRAP = 4, }; - static EventIllidan MaxTimer[]= { EVENT_NULL, @@ -238,7 +218,6 @@ static EventIllidan MaxTimer[]= EVENT_FLIGHT_SEQUENCE, EVENT_TRANSFORM_SEQUENCE }; - struct Yells { uint32 sound; @@ -246,7 +225,6 @@ struct Yells uint32 pCreature, timer, emote; bool Talk; }; - static Yells Conversation[]= { {11463, "Akama... your duplicity is hardly surprising. I should have slaughtered you and your malformed brethren long ago.", ILLIDAN_STORMRAGE, 8000, 0, true}, @@ -272,7 +250,6 @@ static Yells Conversation[]= {11387, "The Light will fill these dismal halls once again. I swear it.", AKAMA, 8000, 0, true}, {0, NULL, EMPTY, 1000, 0, false}//21 }; - static Yells RandomTaunts[]= { {11467, "I can feel your hatred.", ILLIDAN_STORMRAGE, 0, 0, false}, @@ -280,7 +257,6 @@ static Yells RandomTaunts[]= {11469, "You know nothing of power!", ILLIDAN_STORMRAGE, 0, 0, false}, {11471, "Such... arrogance!", ILLIDAN_STORMRAGE, 0, 0, false} }; - static Yells MaievTaunts[]= { {11493, "That is for Naisha!", MAIEV_SHADOWSONG, 0, false}, @@ -288,12 +264,10 @@ static Yells MaievTaunts[]= {11495, "There shall be no prison for you this time!", MAIEV_SHADOWSONG, 0, 0, false}, {11500, "Meet your end, demon!", MAIEV_SHADOWSONG, 0, 0, false} }; - struct Locations { float x, y, z; }; - static Locations HoverPosition[]= { {657, 340, 355}, @@ -301,7 +275,6 @@ static Locations HoverPosition[]= {705, 275, 355}, {705, 340, 355} }; - static Locations GlaivePosition[]= { {695.105, 305.303, 354.256}, @@ -309,13 +282,11 @@ static Locations GlaivePosition[]= {700.105, 305.303, 354.256}, {664.338, 305.303, 354.256} }; - static Locations EyeBlast[]= { {677, 350, 354},//start point, pass through glaive point {677, 260, 354} }; - static Locations AkamaWP[]= { {770.01, 304.50, 312.29}, // Bottom of the first stairs, at the doors @@ -338,13 +309,11 @@ static Locations SpiritSpawns[]= {755.5426, 309.9156, 312.2129}, {755.5426, 298.7923, 312.0834} }; - struct Animation // For the demon transformation { uint32 aura, unaura, timer, size, displayid, phase; bool equip; }; - static Animation DemonTransformation[]= { {SPELL_DEMON_TRANSFORM_1, 0, 1000, 0, 0, 6, true}, @@ -358,12 +327,9 @@ static Animation DemonTransformation[]= {SPELL_DEMON_TRANSFORM_3, SPELL_DEMON_TRANSFORM_2, 3500, 0, 0, 6, true}, {0, SPELL_DEMON_TRANSFORM_3, 0, 0, 0, 8, true} }; - #define EMOTE_SETS_GAZE_ON "sets its gaze on $N!" #define EMOTE_UNABLE_TO_SUMMON "is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter." - - /************************************** Illidan's AI ***************************************/ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI { @@ -371,43 +337,32 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI { pInstance = c->GetInstanceData(); m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); - SpellEntry *TempSpell = GET_SPELL(SPELL_SHADOWFIEND_PASSIVE); if (TempSpell) TempSpell->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends } - ScriptedInstance* pInstance; - PhaseIllidan Phase; EventIllidan Event; uint32 Timer[EVENT_ENRAGE + 1]; - uint32 TalkCount; uint32 TransformCount; uint32 FlightCount; - uint32 HoverPoint; - uint64 AkamaGUID; uint64 MaievGUID; uint64 FlameGUID[2]; uint64 GlaiveGUID[2]; - SummonList Summons; - void Reset(); - void JustSummoned(Creature* summon); - void SummonedCreatureDespawn(Creature* summon) { if (summon->GetCreatureInfo()->Entry == FLAME_OF_AZZINOTH) { - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) if (summon->GetGUID() == FlameGUID[i]) FlameGUID[i] = 0; - if (!FlameGUID[0] && !FlameGUID[1] && Phase != PHASE_ILLIDAN_NULL) { m_creature->InterruptNonMeleeSpells(true); @@ -416,7 +371,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } Summons.Despawn(summon); } - void MovementInform(uint32 MovementType, uint32 Data) { if (FlightCount == 7) //change hover point @@ -431,39 +385,30 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI else // handle flight sequence Timer[EVENT_FLIGHT_SEQUENCE] = 1000; } - void EnterCombat(Unit *who) { m_creature->setActive(true); DoZoneInCombat(); } - void AttackStart(Unit *who) { if (!who || Phase >= PHASE_TALK_SEQUENCE) return; - if (Phase == PHASE_FLIGHT || Phase == PHASE_DEMON) AttackStartNoMove(who); else ScriptedAI::AttackStart(who); } - void MoveInLineOfSight(Unit *who) {} - void JustDied(Unit *killer) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (!pInstance) return; - pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, DONE); // Completed - - for(uint8 i = DATA_GAMEOBJECT_ILLIDAN_DOOR_R; i < DATA_GAMEOBJECT_ILLIDAN_DOOR_L + 1; ++i) + for (uint8 i = DATA_GAMEOBJECT_ILLIDAN_DOOR_R; i < DATA_GAMEOBJECT_ILLIDAN_DOOR_L + 1; ++i) pInstance->HandleGameObject(pInstance->GetData64(i), true); } - void KilledUnit(Unit *victim) { if (victim == m_creature) return; @@ -480,7 +425,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI break; } } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth() && done_by != m_creature) @@ -488,7 +432,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI if (done_by->GetGUID() == MaievGUID) done_by->AddThreat(m_creature, -(3*(float)damage)/4); // do not let maiev tank him } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_GLAIVE_RETURNS) // Re-equip our warblades! @@ -500,10 +443,9 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); } } - void DeleteFromThreatList(uint64 TargetGUID) { - for(std::list::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) + for (std::list::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) { if ((*itr)->getUnitGuid() == TargetGUID) { @@ -512,11 +454,9 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } } } - void Talk(uint32 count) { Timer[EVENT_TALK_SEQUENCE] = Conversation[count].timer; - Creature* pCreature = NULL; if (Conversation[count].pCreature == ILLIDAN_STORMRAGE) pCreature = m_creature; @@ -524,7 +464,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI pCreature = (Unit::GetCreature((*m_creature), AkamaGUID)); else if (Conversation[count].pCreature == MAIEV_SHADOWSONG) pCreature = (Unit::GetCreature((*m_creature), MaievGUID)); - if (pCreature) { if (Conversation[count].emote) @@ -535,7 +474,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI DoPlaySoundToSet(pCreature, Conversation[count].sound); // Play some sound on the creature } } - void EnterPhase(PhaseIllidan NextPhase); void CastEyeBlast(); void SummonFlamesOfAzzinoth(); @@ -601,7 +539,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 8://glaive return - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (GlaiveGUID[i]) { @@ -619,7 +557,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->StopMoving(); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (GlaiveGUID[i]) { @@ -644,18 +582,14 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } FlightCount++; } - void HandleTransformSequence() { if (DemonTransformation[TransformCount].unaura) m_creature->RemoveAurasDueToSpell(DemonTransformation[TransformCount].unaura); - if (DemonTransformation[TransformCount].aura) DoCast(m_creature, DemonTransformation[TransformCount].aura, true); - if (DemonTransformation[TransformCount].displayid) m_creature->SetDisplayId(DemonTransformation[TransformCount].displayid); // It's morphin time! - if (DemonTransformation[TransformCount].equip) { // Requip warglaives if needed @@ -667,7 +601,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI // Unequip warglaives if needed SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); } - switch(TransformCount) { case 2: @@ -692,14 +625,12 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI Timer[EVENT_TRANSFORM_SEQUENCE] = DemonTransformation[TransformCount].timer; TransformCount++; } - void UpdateAI(const uint32 diff) { if ((!UpdateVictim()) && Phase < PHASE_TALK_SEQUENCE) return; - Event = EVENT_NULL; - for(uint32 i = 1; i <= MaxTimer[Phase]; ++i) + for (uint32 i = 1; i <= MaxTimer[Phase]; ++i) { if (Timer[i]) // Event is enabled if (Timer[i] <= diff) @@ -709,43 +640,35 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } else Timer[i] -= diff; } - switch(Phase) { case PHASE_NORMAL: if (HPPCT(m_creature) < 65) EnterPhase(PHASE_FLIGHT_SEQUENCE); break; - case PHASE_NORMAL_2: if (HPPCT(m_creature) < 30) EnterPhase(PHASE_TALK_SEQUENCE); break; - case PHASE_NORMAL_MAIEV: if (HPPCT(m_creature) < 1) EnterPhase(PHASE_TALK_SEQUENCE); break; - case PHASE_TALK_SEQUENCE: if (Event == EVENT_TALK_SEQUENCE) HandleTalkSequence(); break; - case PHASE_FLIGHT_SEQUENCE: if (Event == EVENT_FLIGHT_SEQUENCE) HandleFlightSequence(); break; - case PHASE_TRANSFORM_SEQUENCE: if (Event == EVENT_TRANSFORM_SEQUENCE) HandleTransformSequence(); break; } - if (m_creature->IsNonMeleeSpellCasted(false)) return; - if (Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !m_creature->HasAura(SPELL_CAGED)) { switch(Event) @@ -757,7 +680,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK, true); Timer[EVENT_BERSERK] = 5000;//The buff actually lasts forever. break; - case EVENT_TAUNT: { uint32 random = rand()%4; @@ -770,56 +692,46 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } Timer[EVENT_TAUNT] = 25000 + rand()%10000; break; - case EVENT_SHEAR: // no longer exists in 3.0.2 //DoCast(m_creature->getVictim(), SPELL_SHEAR); Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000); break; - case EVENT_FLAME_CRASH: DoCast(m_creature->getVictim(), SPELL_FLAME_CRASH); Timer[EVENT_FLAME_CRASH] = 30000 + rand()%10000; break; - case EVENT_PARASITIC_SHADOWFIEND: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true)) m_creature->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, true); Timer[EVENT_PARASITIC_SHADOWFIEND] = 35000 + rand()%10000; }break; - case EVENT_PARASITE_CHECK: Timer[EVENT_PARASITE_CHECK] = 0; break; - case EVENT_DRAW_SOUL: DoCast(m_creature->getVictim(), SPELL_DRAW_SOUL); Timer[EVENT_DRAW_SOUL] = 50000 + rand()%10000; break; - //PHASE_NORMAL_2 case EVENT_AGONIZING_FLAMES: DoCast(SelectUnit(SELECT_TARGET_RANDOM,0), SPELL_AGONIZING_FLAMES); Timer[EVENT_AGONIZING_FLAMES] = 0; break; - case EVENT_TRANSFORM_NORMAL: EnterPhase(PHASE_TRANSFORM_SEQUENCE); break; - //PHASE_NORMAL_MAIEV case EVENT_ENRAGE: DoCast(m_creature, SPELL_ENRAGE); Timer[EVENT_ENRAGE] = 0; break; - default: break; } DoMeleeAttackIfReady(); } - if (Phase == PHASE_FLIGHT) { switch(Event) @@ -828,17 +740,14 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); Timer[EVENT_FIREBALL] = 3000; break; - case EVENT_DARK_BARRAGE: DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DARK_BARRAGE); Timer[EVENT_DARK_BARRAGE] = 0; break; - case EVENT_EYE_BLAST: CastEyeBlast(); Timer[EVENT_EYE_BLAST] = 0; break; - case EVENT_MOVE_POINT: Phase = PHASE_FLIGHT_SEQUENCE; Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point @@ -847,12 +756,10 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI HoverPoint -= 4; m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); break; - default: break; } } - if (Phase == PHASE_DEMON) { switch(Event) @@ -884,26 +791,20 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI } } }; - /********************************** End of Illidan AI ******************************************/ - struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI { flame_of_azzinothAI(Creature *c) : ScriptedAI(c) {} - uint32 FlameBlastTimer; uint32 CheckTimer; uint64 GlaiveGUID; - void Reset() { FlameBlastTimer = 15000; CheckTimer = 5000; GlaiveGUID = 0; } - void EnterCombat(Unit *who) {DoZoneInCombat();} - void ChargeCheck() { Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 200, false); @@ -915,7 +816,6 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI m_creature->MonsterTextEmote(EMOTE_SETS_GAZE_ON, target->GetGUID()); } } - void EnrageCheck() { if (GETUNIT(Glaive, GlaiveGUID)) @@ -939,14 +839,11 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI } } } - void SetGlaiveGUID(uint64 guid){ GlaiveGUID = guid; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (FlameBlastTimer < diff) { DoCast(m_creature->getVictim(), SPELL_BLAZE_SUMMON, true); //appear at victim @@ -954,20 +851,16 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI FlameBlastTimer = 15000; //10000 is official-like? DoZoneInCombat(); //in case someone is revived }else FlameBlastTimer -= diff; - if (CheckTimer < diff) { ChargeCheck(); EnrageCheck(); CheckTimer = 1000; }else CheckTimer -= diff; - DoMeleeAttackIfReady(); } }; - - /******* Functions and vars for Akama's AI ******/ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI { @@ -978,46 +871,39 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI } bool JustCreated; ScriptedInstance* pInstance; - PhaseAkama Phase; bool Event; uint32 Timer; - uint64 IllidanGUID; uint64 ChannelGUID; uint64 SpiritGUID[2]; uint64 GateGUID; uint64 DoorGUID[2]; - uint32 ChannelCount; uint32 WalkCount; uint32 TalkCount; uint32 Check_Timer; - void Reset() { WalkCount = 0; if (pInstance) { pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED); - IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); GateGUID = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE); DoorGUID[0] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R); DoorGUID[1] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L); - - if(JustCreated)//close all doors at create + if(JustCreated) //close all doors at create { pInstance->HandleGameObject(GateGUID, false); - - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) pInstance->HandleGameObject(DoorGUID[i], false); //JustCreated = false; }else {//open all doors, raid wiped pInstance->HandleGameObject(GateGUID, true); WalkCount = 1;//skip first wp - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) pInstance->HandleGameObject(DoorGUID[i], true); } } @@ -1028,26 +914,20 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI DoorGUID[0] = 0; DoorGUID[1] = 0; } - ChannelGUID = 0; SpiritGUID[0] = 0; SpiritGUID[1] = 0; - Phase = PHASE_AKAMA_NULL; Timer = 0; - ChannelCount = 0; TalkCount = 0; Check_Timer = 5000; - KillAllElites(); - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has strange values.. m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); m_creature->setActive(false); m_creature->SetVisibility(VISIBILITY_OFF); } - // Do not call reset in Akama's evade mode, as this will stop him from summoning minions after he kills the first bit void EnterEvadeMode() { @@ -1055,44 +935,38 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI m_creature->DeleteThreatList(); m_creature->CombatStop(true); } - void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit* who) {} - void MovementInform(uint32 MovementType, uint32 Data) { if(MovementType == POINT_MOTION_TYPE) Timer = 1; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage > m_creature->GetHealth() || done_by->GetGUID() != IllidanGUID) damage = 0; } - void KillAllElites() { std::list& threatList = m_creature->getThreatManager().getThreatList(); std::vector eliteList; - for(std::list::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + for (std::list::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) eliteList.push_back(pUnit); } - for(std::vector::iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) + for (std::vector::iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) (*itr)->setDeathState(JUST_DIED); EnterEvadeMode(); } - void BeginTalk() { if (!pInstance) return; - pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS); - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) pInstance->HandleGameObject(DoorGUID[i], false); if (GETCRE(Illidan, IllidanGUID)) { @@ -1105,7 +979,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); } } - void BeginChannel() { m_creature->setActive(true); @@ -1117,29 +990,25 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI Gate->GetPosition(x, y, z); else return;//if door not spawned, don't crash server - if (Creature* Channel = m_creature->SummonCreature(ILLIDAN_DOOR_TRIGGER, x, y, z+5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) { ChannelGUID = Channel->GetGUID(); Channel->SetDisplayId(11686); // Invisible but spell visuals can still be seen. DoCast(Channel, SPELL_AKAMA_DOOR_FAIL); } - - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) if (Creature* Spirit = m_creature->SummonCreature(i ? SPIRIT_OF_OLUM : SPIRIT_OF_UDALO, SpiritSpawns[i].x, SpiritSpawns[i].y, SpiritSpawns[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) { Spirit->SetVisibility(VISIBILITY_OFF); SpiritGUID[i] = Spirit->GetGUID(); } } - void BeginWalk() { m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->SetSpeed(MOVE_RUN, 1.0f); m_creature->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); } - void EnterPhase(PhaseAkama NextPhase) { if (!pInstance) @@ -1203,7 +1072,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI Phase = NextPhase; Event = false; } - void HandleTalkSequence() { switch(TalkCount) @@ -1228,7 +1096,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI } TalkCount++; } - void HandleChannelSequence() { Unit* Channel, *Spirit[2]; @@ -1240,7 +1107,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI if (!Channel || !Spirit[0] || !Spirit[1]) return; } - switch(ChannelCount) { case 0: // channel failed @@ -1286,13 +1152,12 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI } ChannelCount++; } - void HandleWalkSequence() { switch(WalkCount) { case 6: - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) if(pInstance) pInstance->HandleGameObject(DoorGUID[i], true); break; @@ -1306,7 +1171,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI EnterPhase(PHASE_FIGHT_MINIONS); break; } - if (Phase == PHASE_WALK) { Timer = 0; @@ -1314,7 +1178,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(WalkCount, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); } } - void UpdateAI(const uint32 diff) { if(m_creature->GetVisibility() == VISIBILITY_OFF) @@ -1323,7 +1186,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI { if(pInstance && pInstance->GetData(DATA_ILLIDARICOUNCILEVENT) == DONE) m_creature->SetVisibility(VISIBILITY_ON); - Check_Timer = 5000; }else Check_Timer -= diff; } @@ -1334,7 +1196,6 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI Event = true; else Timer -= diff; } - if (Event) { switch(Phase) @@ -1387,29 +1248,22 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI break; } } - if (!UpdateVictim()) return; - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 20) DoCast(m_creature, SPELL_HEALING_POTION); - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI { boss_maievAI(Creature *c) : ScriptedAI(c) {}; - uint64 IllidanGUID; - PhaseIllidan Phase; EventMaiev Event; uint32 Timer[5]; uint32 MaxTimer; - void Reset() { MaxTimer = 0; @@ -1421,12 +1275,10 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI SetEquipmentSlots(false, 44850, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 45738); } - void EnterCombat(Unit *who) {} void MoveInLineOfSight(Unit *who) {} void EnterEvadeMode() {} void GetIllidanGUID(uint64 guid) { IllidanGUID = guid; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetGUID() != IllidanGUID) @@ -1440,12 +1292,10 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI damage = 0; } } - void AttackStart(Unit *who) { if (!who || Timer[EVENT_MAIEV_STEALTH]) return; - if (Phase == PHASE_TALK_SEQUENCE) AttackStartNoMove(who); else if (Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE) @@ -1458,14 +1308,12 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI else ScriptedAI::AttackStart(who); } - void DoAction(const int32 param) { if (param > PHASE_ILLIDAN_NULL && param < PHASE_ILLIDAN_MAX) EnterPhase(PhaseIllidan(param)); } - - void EnterPhase(PhaseIllidan NextPhase)//This is in fact Illidan's phase. + void EnterPhase(PhaseIllidan NextPhase) //This is in fact Illidan's phase. { switch(NextPhase) { @@ -1501,7 +1349,6 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI MaxTimer = 1; Phase = NextPhase; } - void BlinkTo(float x, float y, float z) { m_creature->AttackStop(); @@ -1510,13 +1357,11 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI DoTeleportTo(x, y, z); DoCast(m_creature, SPELL_TELEPORT_VISUAL, true); } - void BlinkToPlayer() { if (GETCRE(Illidan, IllidanGUID)) { Unit* target = CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!target || !m_creature->IsWithinDistInMap(target, 80) || Illidan->IsWithinDistInMap(target, 20)) { uint8 pos = rand()%4; @@ -1530,22 +1375,19 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if ((!UpdateVictim()) && !Timer[EVENT_MAIEV_STEALTH]) return; - Event = EVENT_MAIEV_NULL; - for(uint8 i = 1; i <= MaxTimer; ++i) + for (uint8 i = 1; i <= MaxTimer; ++i) if (Timer[i]) { if (Timer[i] <= diff) Event = (EventMaiev)i; else Timer[i] -= diff; } - switch(Event) { case EVENT_MAIEV_STEALTH: @@ -1588,7 +1430,6 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI default: break; } - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50) { m_creature->SetVisibility(VISIBILITY_OFF); @@ -1599,13 +1440,11 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI Timer[EVENT_MAIEV_STEALTH] = 60000; //reappear after 1 minute MaxTimer = 1; } - if (Phase == PHASE_NORMAL_MAIEV) DoMeleeAttackIfReady(); } }; - bool GossipSelect_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event @@ -1615,44 +1454,32 @@ bool GossipSelect_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature, uin } return true; } - bool GossipHello_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(10465, pCreature->GetGUID()); - return true; } - struct TRINITY_DLL_DECL cage_trap_triggerAI : public ScriptedAI { cage_trap_triggerAI(Creature *c) : ScriptedAI(c) {} - uint64 IllidanGUID; uint32 DespawnTimer; - bool Active; bool SummonedBeams; - void Reset() { IllidanGUID = 0; - Active = false; SummonedBeams = false; - DespawnTimer = 0; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who){} - void MoveInLineOfSight(Unit *who) { if (!Active) return; - if (who && (who->GetTypeId() != TYPEID_PLAYER)) { if (who->GetEntry() == ILLIDAN_STORMRAGE) // Check if who is Illidan @@ -1670,14 +1497,12 @@ struct TRINITY_DLL_DECL cage_trap_triggerAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (DespawnTimer) if (DespawnTimer < diff) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); else DespawnTimer -= diff; - //if (IllidanGUID && !SummonedBeams) //{ // if (Unit* Illidan = Unit::GetUnit(*m_creature, IllidanGUID) @@ -1687,45 +1512,35 @@ struct TRINITY_DLL_DECL cage_trap_triggerAI : public ScriptedAI //} } }; - bool GOHello_cage_trap(Player* pPlayer, GameObject* pGo) { float x, y, z; pPlayer->GetPosition(x, y, z); - // Grid search for nearest live Creature of entry 23304 within 10 yards if (Creature* pTrigger = pGo->FindNearestCreature(23304, 10.0f)) CAST_AI(cage_trap_triggerAI, pTrigger->AI())->Active = true; pGo->SetGoState(GO_STATE_ACTIVE); return true; } - struct TRINITY_DLL_DECL shadow_demonAI : public ScriptedAI { shadow_demonAI(Creature *c) : ScriptedAI(c) {} - uint64 TargetGUID; - void EnterCombat(Unit *who) {DoZoneInCombat();} - void Reset() { TargetGUID = 0; m_creature->CastSpell(m_creature, SPELL_SHADOW_DEMON_PASSIVE, true); } - void JustDied(Unit *killer) { if (Unit* target = Unit::GetUnit((*m_creature), TargetGUID)) target->RemoveAurasDueToSpell(SPELL_PARALYZE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players. - if (!m_creature->getVictim()->HasAura(SPELL_PARALYZE)) { TargetGUID = m_creature->getVictim()->GetGUID(); @@ -1738,7 +1553,6 @@ struct TRINITY_DLL_DECL shadow_demonAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_CONSUME_SOUL); } }; - // Shadowfiends interact with Illidan, setting more targets in Illidan's hashmap struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI { @@ -1746,24 +1560,19 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; uint64 IllidanGUID; uint32 CheckTimer; - void Reset() { if (pInstance) IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); else IllidanGUID = 0; - CheckTimer = 5000; DoCast(m_creature, SPELL_SHADOWFIEND_PASSIVE, true); } - void EnterCombat(Unit* who) { DoZoneInCombat(); } - void DoMeleeAttackIfReady() { if (m_creature->isAttackReady() && m_creature->IsWithinMeleeRange(m_creature->getVictim())) @@ -1771,7 +1580,7 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI if (!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2)) { - if (Creature* illidan = Unit::GetCreature((*m_creature),IllidanGUID))//summon only in 1. phase + if (Creature* illidan = Unit::GetCreature((*m_creature),IllidanGUID)) //summon only in 1. phase if (CAST_AI(boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) m_creature->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack } @@ -1779,7 +1588,6 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI m_creature->resetAttackTimer(); } } - void UpdateAI(const uint32 diff) { if (!m_creature->getVictim()) @@ -1793,7 +1601,6 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI return; } } - if (CheckTimer < diff) { GETUNIT(Illidan, IllidanGUID); @@ -1804,27 +1611,22 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI return; }else CheckTimer = 5000; }else CheckTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL blade_of_azzinothAI : public NullCreatureAI { blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_THROW_GLAIVE2 || spell->Id == SPELL_THROW_GLAIVE) me->SetDisplayId(21431);//appear when hit by Illidan's glaive } }; - void boss_illidan_stormrageAI::Reset() { if (pInstance) pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED); - if (AkamaGUID) { if (GETCRE(Akama, AkamaGUID)) @@ -1840,23 +1642,19 @@ void boss_illidan_stormrageAI::Reset() } AkamaGUID = 0; } - MaievGUID = 0; - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { FlameGUID[i] = 0; GlaiveGUID[i] = 0; } - Phase = PHASE_ILLIDAN_NULL; Event = EVENT_NULL; Timer[EVENT_BERSERK] = 1500000; - HoverPoint = 0; TalkCount = 0; FlightCount = 0; TransformCount = 0; - m_creature->SetDisplayId(21135); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -1866,7 +1664,6 @@ void boss_illidan_stormrageAI::Reset() m_creature->setActive(false); Summons.DespawnAll(); } - void boss_illidan_stormrageAI::JustSummoned(Creature* summon) { Summons.Summon(summon); @@ -1909,7 +1706,6 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon) break; } } - void boss_illidan_stormrageAI::HandleTalkSequence() { switch(TalkCount) @@ -1993,51 +1789,42 @@ void boss_illidan_stormrageAI::HandleTalkSequence() TalkCount++; } - void boss_illidan_stormrageAI::CastEyeBlast() { m_creature->InterruptNonMeleeSpells(false); - m_creature->MonsterYell(SAY_EYE_BLAST, LANG_UNIVERSAL, 0); DoPlaySoundToSet(m_creature, SOUND_EYE_BLAST); - float distx, disty, dist[2]; - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { distx = EyeBlast[i].x - HoverPosition[HoverPoint].x; disty = EyeBlast[i].y - HoverPosition[HoverPoint].y; dist[i] = distx * distx + disty * disty; } Locations initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { distx = GlaivePosition[i].x - HoverPosition[HoverPoint].x; disty = GlaivePosition[i].y - HoverPosition[HoverPoint].y; dist[i] = distx * distx + disty * disty; } Locations final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; - final.x = 2 * final.x - initial.x; final.y = 2 * final.y - initial.y; - Creature* Trigger = m_creature->SummonTrigger(initial.x, initial.y, initial.z, 0, 13000); if (!Trigger) return; - Trigger->SetSpeed(MOVE_WALK, 3); Trigger->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); - //Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); DoCast(Trigger, SPELL_EYE_BLAST); } - void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth() { m_creature->MonsterYell(SAY_SUMMONFLAMES, LANG_UNIVERSAL, 0); DoPlaySoundToSet(m_creature, SOUND_SUMMONFLAMES); - - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { if (GETUNIT(Glaive, GlaiveGUID[i])) { @@ -2053,7 +1840,6 @@ void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth() } } } - void boss_illidan_stormrageAI::SummonMaiev() { m_creature->CastSpell(m_creature, SPELL_SHADOW_PRISON, true); @@ -2066,7 +1852,6 @@ void boss_illidan_stormrageAI::SummonMaiev() } } - void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase) { DoZoneInCombat(); @@ -2151,93 +1936,75 @@ void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase) Phase = NextPhase; Event = EVENT_NULL; } - CreatureAI* GetAI_boss_illidan_stormrage(Creature* pCreature) { return new boss_illidan_stormrageAI (pCreature); } - CreatureAI* GetAI_npc_akama_at_illidan(Creature* pCreature) { return new npc_akama_illidanAI(pCreature); } - CreatureAI* GetAI_boss_maiev(Creature* pCreature) { return new boss_maievAI (pCreature); } - CreatureAI* GetAI_mob_flame_of_azzinoth(Creature* pCreature) { return new flame_of_azzinothAI (pCreature); } - CreatureAI* GetAI_cage_trap_trigger(Creature* pCreature) { return new cage_trap_triggerAI (pCreature); } - CreatureAI* GetAI_shadow_demon(Creature* pCreature) { return new shadow_demonAI (pCreature); } - CreatureAI* GetAI_blade_of_azzinoth(Creature* pCreature) { return new blade_of_azzinothAI (pCreature); } - CreatureAI* GetAI_parasitic_shadowfiend(Creature* pCreature) { return new mob_parasitic_shadowfiendAI (pCreature); } - void AddSC_boss_illidan() { Script* newscript; - newscript = new Script; newscript->Name = "boss_illidan_stormrage"; newscript->GetAI = &GetAI_boss_illidan_stormrage; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_akama_illidan"; newscript->GetAI = &GetAI_npc_akama_at_illidan; newscript->pGossipHello = &GossipHello_npc_akama_at_illidan; newscript->pGossipSelect = &GossipSelect_npc_akama_at_illidan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_maiev_shadowsong"; newscript->GetAI = &GetAI_boss_maiev; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_flame_of_azzinoth"; newscript->GetAI = &GetAI_mob_flame_of_azzinoth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_blade_of_azzinoth"; newscript->GetAI = &GetAI_blade_of_azzinoth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "gameobject_cage_trap"; newscript->pGOHello = &GOHello_cage_trap; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_cage_trap_trigger"; newscript->GetAI = &GetAI_cage_trap_trigger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadow_demon"; newscript->GetAI = &GetAI_shadow_demon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_parasitic_shadowfiend"; newscript->GetAI = &GetAI_parasitic_shadowfiend; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_mother_shahraz.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_mother_shahraz.cpp index 524ab213d73..3b3fc3d6da6 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_mother_shahraz.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_mother_shahraz.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Mother_Shahraz SD%Complete: 80 SDComment: Saber Lash missing, Fatal Attraction slightly incorrect; need to damage only if affected players are within range of each other SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - //Speech'n'Sounds #define SAY_TAUNT1 -1564018 #define SAY_TAUNT2 -1564019 @@ -36,7 +33,6 @@ EndScriptData */ #define SAY_SLAY2 -1564026 #define SAY_ENRAGE -1564027 #define SAY_DEATH -1564028 - //Spells #define SPELL_BEAM_SINISTER 40859 #define SPELL_BEAM_VILE 40860 @@ -49,7 +45,6 @@ EndScriptData */ #define SPELL_SABER_LASH_IMM 43690 #define SPELL_TELEPORT_VISUAL 40869 #define SPELL_BERSERK 45078 - uint32 PrismaticAuras[]= { 40880, // Shadow @@ -59,12 +54,10 @@ uint32 PrismaticAuras[]= 40896, // Frost 40897, // Holy }; - struct Locations { float x,y,z; }; - static Locations TeleportPoint[]= { {959.996, 212.576, 193.843}, @@ -75,16 +68,13 @@ static Locations TeleportPoint[]= {930.548, 284.888, 193.367}, {965.997, 278.398, 195.777} }; - struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI { boss_shahrazAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 TargetGUID[3]; uint32 BeamTimer; uint32 BeamCount; @@ -97,17 +87,13 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI uint32 RandomYellTimer; uint32 EnrageTimer; uint32 ExplosionCount; - bool Enraged; - void Reset() { if (pInstance) pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, NOT_STARTED); - - for(uint8 i = 0; i<3; ++i) + for (uint8 i = 0; i<3; ++i) TargetGUID[i] = 0; - BeamTimer = 20000; // Timers may be incorrect BeamCount = 0; CurrentBeam = 0; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful @@ -119,39 +105,32 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI RandomYellTimer = 70000 + rand()%41 * 1000; EnrageTimer = 600000; ExplosionCount = 0; - Enraged = false; } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, IN_PROGRESS); - DoZoneInCombat(); DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); } - void TeleportPlayers() { uint32 random = rand()%7; float X = TeleportPoint[random].x; float Y = TeleportPoint[random].y; float Z = TeleportPoint[random].z; - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 1); if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) @@ -162,28 +141,23 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !Enraged) { Enraged = true; DoCast(m_creature, SPELL_ENRAGE, true); DoScriptText(SAY_ENRAGE, m_creature); } - //Randomly cast one beam. if (BeamTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!target || !target->isAlive()) return; - BeamTimer = 9000; - switch(CurrentBeam) { case 0: @@ -204,9 +178,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI if (BeamCount > 3) while(CurrentBeam == Beam) CurrentBeam = rand()%3; - }else BeamTimer -= diff; - // Random Prismatic Shield every 15 seconds. if (PrismaticShieldTimer < diff) { @@ -215,25 +187,21 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI DoCast(m_creature, PrismaticAuras[random]); PrismaticShieldTimer = 15000; }else PrismaticShieldTimer -= diff; - // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other. if (FatalAttractionTimer < diff) { ExplosionCount = 0; - TeleportPlayers(); - DoScriptText(RAND(SAY_SPELL2,SAY_SPELL3), m_creature); FatalAttractionExplodeTimer = 2000; FatalAttractionTimer = 40000 + rand()%31 * 1000; }else FatalAttractionTimer -= diff; - if (FatalAttractionExplodeTimer < diff) { // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later. if (ExplosionCount < 3) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Unit* pUnit = NULL; if (TargetGUID[i]) @@ -244,7 +212,6 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI TargetGUID[i] = 0; } } - ExplosionCount++; FatalAttractionExplodeTimer = 1000; } @@ -254,19 +221,16 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI ExplosionCount = 0; } }else FatalAttractionExplodeTimer -= diff; - if (ShriekTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SILENCING_SHRIEK); ShriekTimer = 25000+rand()%10 * 1000; }else ShriekTimer -= diff; - if (SaberTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SABER_LASH); SaberTimer = 25000+rand()%10 * 1000; }else SaberTimer -= diff; - //Enrage if (!m_creature->HasAura(SPELL_BERSERK)) if (EnrageTimer < diff) @@ -274,23 +238,19 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK); DoScriptText(SAY_ENRAGE, m_creature); }else EnrageTimer -= diff; - //Random taunts if (RandomYellTimer < diff) { DoScriptText(RAND(SAY_TAUNT1,SAY_TAUNT2,SAY_TAUNT3), m_creature); RandomYellTimer = 60000 + rand()%91 * 1000; }else RandomYellTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_shahraz(Creature* pCreature) { return new boss_shahrazAI (pCreature); } - void AddSC_boss_mother_shahraz() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_reliquary_of_souls.cpp index f1e0873dd95..04921585793 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_reliquary_of_souls.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_reliquary_of_souls.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Reliquary_of_Souls SD%Complete: 90 SDComment: SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" #include "Spell.h" - //Sound'n'speech //Suffering #define SUFF_SAY_FREED -1564047 @@ -35,7 +32,6 @@ EndScriptData */ #define SUFF_SAY_RECAP -1564052 #define SUFF_SAY_AFTER -1564053 #define SUFF_EMOTE_ENRAGE -1564054 - //Desire #define DESI_SAY_FREED -1564055 #define DESI_SAY_SLAY1 -1564056 @@ -44,7 +40,6 @@ EndScriptData */ #define DESI_SAY_SPEC -1564059 #define DESI_SAY_RECAP -1564060 #define DESI_SAY_AFTER -1564061 - //Anger #define ANGER_SAY_FREED -1564062 #define ANGER_SAY_FREED2 -1564063 @@ -53,7 +48,6 @@ EndScriptData */ #define ANGER_SAY_SPEC -1564066 #define ANGER_SAY_BEFORE -1564067 #define ANGER_SAY_DEATH -1564068 - //Spells #define AURA_OF_SUFFERING 41292 #define AURA_OF_SUFFERING_ARMOR 42017 // linked aura, need core support @@ -63,32 +57,26 @@ EndScriptData */ #define SPELL_FIXATE_TAUNT 41295 // force taunt #define SPELL_ENRAGE 41305 #define SPELL_SOUL_DRAIN 41303 - #define AURA_OF_DESIRE 41350 #define AURA_OF_DESIRE_DAMAGE 41352 #define SPELL_RUNE_SHIELD 41431 #define SPELL_DEADEN 41410 #define SPELL_SOUL_SHOCK 41426 - #define AURA_OF_ANGER 41337 #define SPELL_SELF_SEETHE 41364 // force cast 41520 #define SPELL_ENEMY_SEETHE 41520 #define SPELL_SOUL_SCREAM 41545 #define SPELL_SPITE_TARGET 41376 // cast 41377 after 6 sec #define SPELL_SPITE_DAMAGE 41377 - #define ENSLAVED_SOUL_PASSIVE 41535 #define SPELL_SOUL_RELEASE 41542 #define SPELL_SUBMERGE 37550 //dropout 'head' - #define CREATURE_ENSLAVED_SOUL 23469 #define NUMBER_ENSLAVED_SOUL 8 - struct Position2d { float x,y; }; - static Position2d Coords[]= { {450.4, 212.3}, @@ -98,24 +86,18 @@ static Position2d Coords[]= {450.4, 137.4}, {450.4, 168.3} }; - struct TRINITY_DLL_DECL npc_enslaved_soulAI : public ScriptedAI { npc_enslaved_soulAI(Creature *c) : ScriptedAI(c) {} - uint64 ReliquaryGUID; - void Reset() {ReliquaryGUID = 0;} - void EnterCombat(Unit* who) { m_creature->CastSpell(m_creature, ENSLAVED_SOUL_PASSIVE, true); DoZoneInCombat(); } - void JustDied(Unit *killer); }; - struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI { boss_reliquary_of_soulsAI(Creature *c) : ScriptedAI(c) @@ -123,23 +105,17 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI pInstance = c->GetInstanceData(); EssenceGUID = 0; } - ScriptedInstance* pInstance; - uint64 EssenceGUID; - uint32 Phase; uint32 Counter; uint32 Timer; - uint32 SoulCount; uint32 SoulDeathCount; - void Reset() { if (pInstance) pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, NOT_STARTED); - if (EssenceGUID) { if (Creature* Essence = Unit::GetCreature(*m_creature, EssenceGUID)) @@ -148,26 +124,21 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI } EssenceGUID = 0; } - Phase = 0; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); m_creature->RemoveAurasDueToSpell(SPELL_SUBMERGE); } - void EnterCombat(Unit* who) { m_creature->AddThreat(who, 10000.0f); DoZoneInCombat(); if (pInstance) pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, IN_PROGRESS); - Phase = 1; Counter = 0; Timer = 0; } - bool SummonSoul() { uint32 random = rand()%6; @@ -182,15 +153,13 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI }else EnterEvadeMode(); return true; } - void MergeThreatList(Creature* target) { if (!target) return; - std::list& m_threatlist = target->getThreatManager().getThreatList(); std::list::iterator itr = m_threatlist.begin(); - for(; itr != m_threatlist.end(); itr++) + for (; itr != m_threatlist.end(); itr++) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit) @@ -201,24 +170,20 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI } } } - void JustDied(Unit* killer) { if (pInstance) pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, DONE); } - void UpdateAI(const uint32 diff) { if (!Phase) return; - if (m_creature->getThreatManager().getThreatList().empty()) // Reset if event is begun and we don't have a threatlist { EnterEvadeMode(); return; } - Creature* Essence; if (EssenceGUID) { @@ -229,7 +194,6 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI return; } } - if (Timer < diff) { switch(Counter) @@ -330,30 +294,24 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI }else Timer -= diff; } }; - struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI { boss_essence_of_sufferingAI(Creature *c) : ScriptedAI(c) {} - uint64 StatAuraGUID; - uint32 AggroYellTimer; uint32 FixateTimer; uint32 EnrageTimer; uint32 SoulDrainTimer; uint32 AuraTimer; - void Reset() { StatAuraGUID = 0; - AggroYellTimer = 5000; FixateTimer = 8000; EnrageTimer = 30000; SoulDrainTimer = 45000; AuraTimer = 5000; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (damage >= m_creature->GetHealth()) @@ -364,7 +322,6 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI DoScriptText(SUFF_SAY_RECAP, m_creature); } } - void EnterCombat(Unit *who) { if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) @@ -377,12 +334,10 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI } else return; } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SUFF_SAY_SLAY1,SUFF_SAY_SLAY2,SUFF_SAY_SLAY3), m_creature); } - void CastFixate() { std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); @@ -390,7 +345,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI return; // No point continuing if empty threatlist. std::list targets; std::list::iterator itr = m_threatlist.begin(); - for(; itr != m_threatlist.end(); ++itr) + for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players @@ -406,7 +361,6 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI DoResetThreat(); m_creature->AddThreat(target,1000000); } - void UpdateAI(const uint32 diff) { if (m_creature->isInCombat()) @@ -422,36 +376,29 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI } }else FixateTimer -= diff; } - //Return since we have no target if (!UpdateVictim()) return; - if (EnrageTimer < diff) { DoCast(m_creature, SPELL_ENRAGE); EnrageTimer = 60000; DoScriptText(SUFF_EMOTE_ENRAGE, m_creature); }else EnrageTimer -= diff; - if (SoulDrainTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM,0), SPELL_SOUL_DRAIN); SoulDrainTimer = 60000; }else SoulDrainTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI { boss_essence_of_desireAI(Creature *c) : ScriptedAI(c) {} - uint32 RuneShieldTimer; uint32 DeadenTimer; uint32 SoulShockTimer; - void Reset() { RuneShieldTimer = 60000; @@ -459,12 +406,10 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI SoulShockTimer = 5000; m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CONFUSE, true); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by == m_creature) return; - if (damage >= m_creature->GetHealth()) { damage = 0; @@ -477,34 +422,29 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI m_creature->CastCustomSpell(done_by, AURA_OF_DESIRE_DAMAGE, &bp0, NULL, NULL, true); } } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) if (spell->Effect[i] == SPELL_EFFECT_INTERRUPT_CAST) if (m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK || m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN) m_creature->InterruptSpell(CURRENT_GENERIC_SPELL, false); } - void EnterCombat(Unit *who) { DoScriptText(DESI_SAY_FREED, m_creature); DoZoneInCombat(); DoCast(m_creature, AURA_OF_DESIRE, true); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(DESI_SAY_SLAY1,DESI_SAY_SLAY2,DESI_SAY_SLAY3), m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (RuneShieldTimer < diff) { m_creature->InterruptNonMeleeSpells(false); @@ -513,13 +453,11 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI DeadenTimer += 2000; RuneShieldTimer = 60000; }else RuneShieldTimer -= diff; - if (SoulShockTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SOUL_SHOCK); SoulShockTimer = 5000; }else SoulShockTimer -= diff; - if (DeadenTimer < diff) { m_creature->InterruptNonMeleeSpells(false); @@ -530,68 +468,51 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI DoScriptText(DESI_SAY_SPEC, m_creature); } }else DeadenTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI { boss_essence_of_angerAI(Creature *c) : ScriptedAI(c) {} - uint64 AggroTargetGUID; - uint32 CheckTankTimer; uint32 SoulScreamTimer; uint32 SpiteTimer; - std::list SpiteTargetGUID; - bool CheckedAggro; - void Reset() { AggroTargetGUID = 0; - CheckTankTimer = 5000; SoulScreamTimer = 10000; SpiteTimer = 30000; - SpiteTargetGUID.clear(); - CheckedAggro = false; } - void EnterCombat(Unit *who) { DoScriptText(RAND(ANGER_SAY_FREED,ANGER_SAY_FREED2), m_creature); - DoZoneInCombat(); DoCast(m_creature, AURA_OF_ANGER, true); } - void JustDied(Unit *victim) { DoScriptText(ANGER_SAY_DEATH, m_creature); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(ANGER_SAY_SLAY1,ANGER_SAY_SLAY2), m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (!CheckedAggro) { AggroTargetGUID = m_creature->getVictim()->GetGUID(); CheckedAggro = true; } - if (CheckTankTimer < diff) { if (m_creature->getVictim()->GetGUID() != AggroTargetGUID) @@ -602,7 +523,6 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI } CheckTankTimer = 2000; }else CheckTankTimer -= diff; - if (SoulScreamTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SOUL_SCREAM); @@ -612,18 +532,15 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI DoScriptText(ANGER_SAY_SPEC, m_creature); } }else SoulScreamTimer -= diff; - if (SpiteTimer < diff) { DoCast(m_creature, SPELL_SPITE_TARGET); SpiteTimer = 30000; DoScriptText(ANGER_SAY_SPEC, m_creature); }else SpiteTimer -= diff; - DoMeleeAttackIfReady(); } }; - void npc_enslaved_soulAI::JustDied(Unit *killer) { if (ReliquaryGUID) @@ -634,32 +551,26 @@ void npc_enslaved_soulAI::JustDied(Unit *killer) } DoCast(m_creature, SPELL_SOUL_RELEASE, true); } - CreatureAI* GetAI_boss_reliquary_of_souls(Creature* pCreature) { return new boss_reliquary_of_soulsAI (pCreature); } - CreatureAI* GetAI_boss_essence_of_suffering(Creature* pCreature) { return new boss_essence_of_sufferingAI (pCreature); } - CreatureAI* GetAI_boss_essence_of_desire(Creature* pCreature) { return new boss_essence_of_desireAI (pCreature); } - CreatureAI* GetAI_boss_essence_of_anger(Creature* pCreature) { return new boss_essence_of_angerAI (pCreature); } - CreatureAI* GetAI_npc_enslaved_soul(Creature* pCreature) { return new npc_enslaved_soulAI (pCreature); } - void AddSC_boss_reliquary_of_souls() { Script *newscript; @@ -667,22 +578,18 @@ void AddSC_boss_reliquary_of_souls() newscript->Name = "boss_reliquary_of_souls"; newscript->GetAI = &GetAI_boss_reliquary_of_souls; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_essence_of_suffering"; newscript->GetAI = &GetAI_boss_essence_of_suffering; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_essence_of_desire"; newscript->GetAI = &GetAI_boss_essence_of_desire; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_essence_of_anger"; newscript->GetAI = &GetAI_boss_essence_of_anger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_enslaved_soul"; newscript->GetAI = &GetAI_npc_enslaved_soul; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_shade_of_akama.cpp index ada3230a6f6..c4365bc8168 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_shade_of_akama.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_shade_of_akama.cpp @@ -13,31 +13,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Shade_of_Akama SD%Complete: 90 SDComment: Seems to be complete. SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - #define SAY_DEATH -1564013 #define SAY_LOW_HEALTH -1564014 // Ending cinematic text #define SAY_FREE -1564015 #define SAY_BROKEN_FREE_01 -1564016 #define SAY_BROKEN_FREE_02 -1564017 - #define GOSSIP_ITEM "We are ready to fight alongside you, Akama" - struct Location { float x, y, o, z; }; - static Location ChannelerLocations[]= { {463.161285, 401.219757, 3.141592}, @@ -47,19 +41,16 @@ static Location ChannelerLocations[]= {446.012421, 411.211853, 5.210546}, {457.377625, 411.211853, 4.177494} }; - static Location SpawnLocations[]= { {498.652740, 461.728119, 0}, {498.505003, 339.619324, 0} }; - static Location AkamaWP[]= { {482.352448, 401.162720, 0, 112.783928}, {469.597443, 402.264404, 0, 118.537910} }; - static Location BrokenCoords[]= { {541.375916, 401.439575, M_PI, 112.783997}, // The place where Akama channels @@ -67,7 +58,6 @@ static Location BrokenCoords[]= {499.621185, 341.534729, 1.652856, 112.783730}, // East Alcove {499.151093, 461.036438, 4.770888, 112.78370}, // West Alcove }; - static Location BrokenWP[]= { {492.491638, 400.744690, 3.122336, 112.783737}, @@ -75,7 +65,6 @@ static Location BrokenWP[]= {489.555939, 373.507202, 2.416263, 112.783737}, {491.136353, 427.868774, 3.519748, 112.783737}, }; - // Locations #define Z1 118.543144 #define Z2 120.783768 @@ -86,7 +75,6 @@ static Location BrokenWP[]= #define AKAMA_X 514.583984 #define AKAMA_Y 400.601013 #define AKAMA_Z 112.783997 - // Spells #define SPELL_VERTEX_SHADE_BLACK 39833 #define SPELL_SHADE_SOUL_CHANNEL 40401 @@ -96,21 +84,16 @@ static Location BrokenWP[]= #define SPELL_AKAMA_SOUL_RETRIEVE 40902 #define AKAMA_SOUL_EXPEL 40855 #define SPELL_SHADE_SOUL_CHANNEL_2 40520 - // Channeler entry #define CREATURE_CHANNELER 23421 #define CREATURE_SORCERER 23215 #define CREATURE_DEFENDER 23216 #define CREATURE_BROKEN 23319 - const uint32 spawnEntries[4]= { 23523, 23318, 23524 }; - struct TRINITY_DLL_DECL mob_ashtongue_channelerAI : public ScriptedAI { mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} - uint64 ShadeGUID; - void Reset() {} void JustDied(Unit* killer); void EnterCombat(Unit* who) {} @@ -118,21 +101,17 @@ struct TRINITY_DLL_DECL mob_ashtongue_channelerAI : public ScriptedAI void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) {} }; - struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI { mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} - uint64 ShadeGUID; uint32 CheckTimer; bool StartBanishing; - void Reset() { StartBanishing = false; CheckTimer = 5000; } - void JustDied(Unit* killer); void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} @@ -141,7 +120,6 @@ struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI { if (StartBanishing) return; - if (CheckTimer < diff) { Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID); @@ -153,7 +131,6 @@ struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL, true); DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL_2, true); - StartBanishing = true; } } @@ -161,7 +138,6 @@ struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI }else CheckTimer -= diff; } }; - struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI { boss_shade_of_akamaAI(Creature* c) : ScriptedAI(c), summons(m_creature) @@ -172,38 +148,29 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } - ScriptedInstance* pInstance; - std::list Channelers; std::list Sorcerers; uint64 AkamaGUID; - uint32 SorcererCount; uint32 DeathCount; - uint32 ReduceHealthTimer; uint32 SummonTimer; uint32 ResetTimer; uint32 DefenderTimer; // They are on a flat 15 second timer, independant of the other summon Creature timer. - bool IsBanished; bool HasKilledAkama; bool reseting; bool GridSearcherSucceeded; bool HasKilledAkamaAndReseting; SummonList summons; - void Reset() { reseting = true; HasKilledAkamaAndReseting = false; - GridSearcherSucceeded = false; - Sorcerers.clear(); summons.DespawnAll();//despawn all adds - if (Creature* Akama = Unit::GetCreature(*m_creature, AkamaGUID)) { Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//turn gossip on so players can restart the event @@ -215,25 +182,20 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } SorcererCount = 0; DeathCount = 0; - SummonTimer = 10000; ReduceHealthTimer = 0; ResetTimer = 60000; DefenderTimer = 15000; - IsBanished = true; HasKilledAkama = false; - m_creature->SetVisibility(VISIBILITY_ON); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //m_creature->GetMotionMaster()->Clear(); //m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); - if (pInstance) pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED); - reseting = false; } void JustDied(Unit* killer) @@ -250,16 +212,14 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI if (summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) summons.Despawn(summon); } - void MoveInLineOfSight(Unit *who) { if (!GridSearcherSucceeded) { FindChannelers(); - if (!Channelers.empty()) { - for(std::list::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (std::list::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) { Creature* Channeler = (Unit::GetCreature(*m_creature, *itr)); if (Channeler) @@ -269,7 +229,6 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI Channeler->RemoveCorpse(); Channeler->Respawn(); } - Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL, true); Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL_2, true); Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -279,20 +238,16 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI }else error_log("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); } } - void AttackStart(Unit* who) { if (!who || IsBanished) return; - if (who->isTargetableForAttack() && who != m_creature) DoStartMovement(who); } - void IncrementDeathCount(uint64 guid = 0) // If guid is set, will remove it from list of sorcerer { if (reseting) return; - debug_log("TSCR: Increasing Death Count for Shade of Akama encounter"); ++DeathCount; m_creature->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2); @@ -303,7 +258,6 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI else Sorcerers.remove(guid); } } - void SummonCreature() { uint32 random = rand()%2; @@ -326,7 +280,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } else { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Creature* Spawn = m_creature->SummonCreature(spawnEntries[i], X, Y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); if (Spawn) @@ -339,15 +293,13 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } } } - void FindChannelers() { std::list ChannelerList; m_creature->GetCreatureListWithEntryInGrid(ChannelerList,CREATURE_CHANNELER,50.0f); - if (!ChannelerList.empty()) { - for(std::list::iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) + for (std::list::iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) { CAST_AI(mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = m_creature->GetGUID(); Channelers.push_back((*itr)->GetGUID()); @@ -356,7 +308,6 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } else error_log("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); } - void SetSelectableChannelers() { if (Channelers.empty()) @@ -364,19 +315,15 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI error_log("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); return; } - - for(std::list::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (std::list::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) if (Creature* Channeler = (Unit::GetCreature(*m_creature, *itr))) Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat()) return; - if (IsBanished) { // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check @@ -385,7 +332,6 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI EnterEvadeMode(); return; } - if (DefenderTimer < diff) { uint32 ran = rand()%2; @@ -410,13 +356,11 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } DefenderTimer = 15000; }else DefenderTimer -= diff; - if (SummonTimer < diff) { SummonCreature(); SummonTimer = 35000; }else SummonTimer -= diff; - if (DeathCount >= 6) { if (AkamaGUID) @@ -455,10 +399,9 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI } } }else ReduceHealthTimer -= diff; - if (HasKilledAkama) { - if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug + if (!HasKilledAkamaAndReseting) //do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug { HasKilledAkamaAndReseting = true; m_creature->RemoveAllAuras(); @@ -474,12 +417,10 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI return; } else ResetTimer -= diff; } - DoMeleeAttackIfReady(); } } }; - void mob_ashtongue_channelerAI::JustDied(Unit* killer) { Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID)); @@ -487,7 +428,6 @@ void mob_ashtongue_channelerAI::JustDied(Unit* killer) CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(); else error_log("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); } - void mob_ashtongue_sorcererAI::JustDied(Unit* killer) { Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID)); @@ -495,7 +435,6 @@ void mob_ashtongue_sorcererAI::JustDied(Unit* killer) CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(m_creature->GetGUID()); else error_log("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); } - struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI { npc_akamaAI(Creature* c) : ScriptedAI(c), summons(m_creature) @@ -515,11 +454,8 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI BrokenList.clear(); HasYelledOnce = false; } - ScriptedInstance* pInstance; - uint64 ShadeGUID; - uint32 DestructivePoisonTimer; uint32 LightningBoltTimer; uint32 CheckTimer; @@ -529,21 +465,17 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI uint32 EndingTalkCount; uint32 WayPointId; uint32 BrokenSummonIndex; - std::list BrokenList; - bool EventBegun; bool ShadeHasDied; bool StartCombat; bool HasYelledOnce; SummonList summons; - void Reset() { DestructivePoisonTimer = 15000; LightningBoltTimer = 10000; CheckTimer = 2000; - if (!EventBegun) { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has very very strange values @@ -551,7 +483,6 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI } summons.DespawnAll(); } - void JustSummoned(Creature *summon) { if (summon->GetEntry() == CREATURE_BROKEN) @@ -562,18 +493,14 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI if (summon->GetEntry() == CREATURE_BROKEN) summons.Despawn(summon); } - void EnterCombat(Unit* who) {} - void BeginEvent(Player* pl) { if (!pInstance) return; - ShadeGUID = pInstance->GetData64(DATA_SHADEOFAKAMA); if (!ShadeGUID) return; - Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID)); if (Shade) { @@ -591,16 +518,13 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI EventBegun = true; } } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - switch(id) { case 0: ++WayPointId; break; - case 1: if (Creature* Shade = Unit::GetCreature(*m_creature, ShadeGUID)) { @@ -612,7 +536,6 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI break; } } - void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); @@ -632,18 +555,15 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; summons.DespawnAll(); } - void UpdateAI(const uint32 diff) { if (!EventBegun) return; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 15 && !HasYelledOnce) { DoScriptText(SAY_LOW_HEALTH, m_creature); HasYelledOnce = true; } - if (ShadeGUID && !StartCombat) { Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID)); @@ -664,7 +584,6 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI } } } - if (ShadeHasDied && (WayPointId == 1)) { if (pInstance) @@ -672,7 +591,6 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[1].x, AkamaWP[1].y, AkamaWP[1].z); ++WayPointId; } - if (!ShadeHasDied && StartCombat) { if (CheckTimer < diff) @@ -696,12 +614,11 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI CheckTimer = 5000; }else CheckTimer -= diff; } - if (SummonBrokenTimer && BrokenSummonIndex < 4) { if (SummonBrokenTimer <= diff) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { float x = BrokenCoords[BrokenSummonIndex].x + (i*5); float y = BrokenCoords[BrokenSummonIndex].y + (1*5); @@ -722,7 +639,6 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI SummonBrokenTimer = 1000; }else SummonBrokenTimer -= diff; } - if (SoulRetrieveTimer) if (SoulRetrieveTimer <= diff) { @@ -743,7 +659,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI if (!BrokenList.empty()) { bool Yelled = false; - for(std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) { if (!Yelled) @@ -760,7 +676,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI case 3: if (!BrokenList.empty()) { - for(std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) // This is the incorrect spell, but can't seem to find the right one. pUnit->CastSpell(pUnit, 39656, true); @@ -771,7 +687,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI case 4: if (!BrokenList.empty()) { - for(std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature((*m_creature), *itr)) pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); } @@ -779,10 +695,8 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI break; } }else SoulRetrieveTimer -= diff; - if (!UpdateVictim()) return; - if (DestructivePoisonTimer < diff) { Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID); @@ -790,37 +704,30 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI DoCast(Shade, SPELL_DESTRUCTIVE_POISON); DestructivePoisonTimer = 15000; }else DestructivePoisonTimer -= diff; - if (LightningBoltTimer < diff) { DoCast(m_creature->getVictim(), SPELL_LIGHTNING_BOLT); LightningBoltTimer = 10000; }else LightningBoltTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_shade_of_akama(Creature* pCreature) { return new boss_shade_of_akamaAI (pCreature); } - CreatureAI* GetAI_mob_ashtongue_channeler(Creature* pCreature) { return new mob_ashtongue_channelerAI (pCreature); } - CreatureAI* GetAI_mob_ashtongue_sorcerer(Creature* pCreature) { return new mob_ashtongue_sorcererAI (pCreature); } - CreatureAI* GetAI_npc_akama_shade(Creature* pCreature) { return new npc_akamaAI (pCreature); } - bool GossipSelect_npc_akama(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time @@ -828,10 +735,8 @@ bool GossipSelect_npc_akama(Player* pPlayer, Creature* pCreature, uint32 uiSende pPlayer->CLOSE_GOSSIP_MENU(); CAST_AI(npc_akamaAI, pCreature->AI())->BeginEvent(pPlayer); } - return true; } - bool GossipHello_npc_akama(Player* pPlayer, Creature* pCreature) { if (pPlayer->isAlive()) @@ -839,10 +744,8 @@ bool GossipHello_npc_akama(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); } - return true; } - void AddSC_boss_shade_of_akama() { Script *newscript; @@ -850,17 +753,14 @@ void AddSC_boss_shade_of_akama() newscript->Name = "boss_shade_of_akama"; newscript->GetAI = &GetAI_boss_shade_of_akama; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ashtongue_channeler"; newscript->GetAI = &GetAI_mob_ashtongue_channeler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ashtongue_sorcerer"; newscript->GetAI = &GetAI_mob_ashtongue_sorcerer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_akama_shade"; newscript->GetAI = &GetAI_npc_akama_shade; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_supremus.cpp index a4e1b2d5428..aedfdd97ccc 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_supremus.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_supremus.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Supremus SD%Complete: 95 SDComment: Need to implement molten punch SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - #define EMOTE_NEW_TARGET -1564010 #define EMOTE_PUNCH_GROUND -1564011 //DoScriptText(EMOTE_PUNCH_GROUND, m_creature); #define EMOTE_GROUND_CRACK -1564012 - //Spells #define SPELL_MOLTEN_PUNCH 40126 #define SPELL_HATEFUL_STRIKE 41926 @@ -35,26 +31,20 @@ EndScriptData */ #define SPELL_VOLCANIC_ERUPTION 40117 #define SPELL_VOLCANIC_SUMMON 40276 #define SPELL_BERSERK 45078 - #define CREATURE_VOLCANO 23085 #define CREATURE_STALKER 23095 - #define PHASE_STRIKE 1 #define PHASE_CHASE 2 - #define EVENT_BERSERK 1 #define EVENT_SWITCH_PHASE 2 #define EVENT_FLAME 3 #define EVENT_VOLCANO 4 #define EVENT_SWITCH_TARGET 5 #define EVENT_HATEFUL_STRIKE 6 - #define GCD_CAST 1 - struct TRINITY_DLL_DECL molten_flameAI : public NullCreatureAI { molten_flameAI(Creature *c) : NullCreatureAI(c) {} - void InitializeAI() { float x, y, z; @@ -64,19 +54,16 @@ struct TRINITY_DLL_DECL molten_flameAI : public NullCreatureAI me->CastSpell(me,SPELL_MOLTEN_FLAME,true); } }; - struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI { boss_supremusAI(Creature *c) : ScriptedAI(c), summons(m_creature) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; EventMap events; SummonList summons; uint32 phase; - void Reset() { if (pInstance) @@ -88,23 +75,18 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI } //else ToggleDoors(false); } - phase = 0; - events.Reset(); summons.DespawnAll(); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_SUPREMUSEVENT, IN_PROGRESS); - ChangePhase(); events.ScheduleEvent(EVENT_BERSERK, 900000, GCD_CAST); events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); } - void ChangePhase() { if (!phase || phase == PHASE_CHASE) @@ -130,7 +112,6 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI events.SetPhase(phase); events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000, GCD_CAST); } - void JustDied(Unit *killer) { if (pInstance) @@ -140,15 +121,12 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI } summons.DespawnAll(); } - void JustSummoned(Creature *summon) {summons.Summon(summon);} void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - Unit* CalculateHatefulStrikeTarget() { uint32 health = 0; Unit* target = NULL; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) @@ -163,17 +141,13 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI } } } - return target; } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -220,15 +194,12 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL npc_volcanoAI : public Scripted_NoMovementAI { npc_volcanoAI(Creature *c) : Scripted_NoMovementAI(c) {} - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -238,43 +209,34 @@ struct TRINITY_DLL_DECL npc_volcanoAI : public Scripted_NoMovementAI wait = 3000; } uint32 wait; - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit *who) {} - void DoAction(const uint32 info) { m_creature->RemoveAura(SPELL_VOLCANIC_ERUPTION); } - void UpdateAI(const uint32 diff) { - if (wait<=diff)//wait 3secs before casting + if (wait<=diff) //wait 3secs before casting { DoCast(m_creature, SPELL_VOLCANIC_ERUPTION); wait = 60000; } else wait -= diff; } - }; - CreatureAI* GetAI_boss_supremus(Creature* pCreature) { return new boss_supremusAI (pCreature); } - CreatureAI* GetAI_molten_flame(Creature* pCreature) { return new molten_flameAI (pCreature); } - CreatureAI* GetAI_npc_volcano(Creature* pCreature) { return new npc_volcanoAI (pCreature); } - void AddSC_boss_supremus() { Script *newscript; @@ -282,12 +244,10 @@ void AddSC_boss_supremus() newscript->Name = "boss_supremus"; newscript->GetAI = &GetAI_boss_supremus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "molten_flame"; newscript->GetAI = &GetAI_molten_flame; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_volcano"; newscript->GetAI = &GetAI_npc_volcano; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_teron_gorefiend.cpp index d4f06f13274..70fad658bb9 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_teron_gorefiend.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_teron_gorefiend.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Teron_Gorefiend SD%Complete: 60 SDComment: Requires Mind Control support for Ghosts. SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - //Speech'n'sound #define SAY_INTRO -1564037 #define SAY_AGGRO -1564038 @@ -35,7 +32,6 @@ EndScriptData */ #define SAY_SPECIAL2 -1564044 #define SAY_ENRAGE -1564045 #define SAY_DEATH -1564046 - //Spells #define SPELL_INCINERATE 40239 #define SPELL_CRUSHING_SHADOWS 40243 @@ -43,37 +39,29 @@ EndScriptData */ #define SPELL_PASSIVE_SHADOWFORM 40326 #define SPELL_SHADOW_OF_DEATH 40251 #define SPELL_BERSERK 45078 - #define SPELL_ATROPHY 40327 // Shadowy Constructs use this when they get within melee range of a player - #define CREATURE_DOOM_BLOSSOM 23123 #define CREATURE_SHADOWY_CONSTRUCT 23111 - struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI { mob_doom_blossomAI(Creature *c) : ScriptedAI(c) {} - uint32 CheckTeronTimer; uint32 ShadowBoltTimer; uint64 TeronGUID; - void Reset() { CheckTeronTimer = 5000; ShadowBoltTimer = 12000; TeronGUID = 0; } - void EnterCombat(Unit *who) { } void AttackStart(Unit* who) { } void MoveInLineOfSight(Unit* who) { } - void Despawn() { m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); } - void UpdateAI(const uint32 diff) { if (CheckTeronTimer < diff) @@ -81,17 +69,14 @@ struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI if (TeronGUID) { DoZoneInCombat(); - Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID)); if ((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode())) Despawn(); } else Despawn(); - CheckTeronTimer = 5000; }else CheckTeronTimer -= diff; - if (ShadowBoltTimer < diff && m_creature->isInCombat()) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOWBOLT); @@ -99,39 +84,29 @@ struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI }else ShadowBoltTimer -= diff; return; } - void SetTeronGUID(uint64 guid){ TeronGUID = guid; } }; - struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI { mob_shadowy_constructAI(Creature* c) : ScriptedAI(c) {} - uint64 GhostGUID; uint64 TeronGUID; - uint32 CheckPlayerTimer; uint32 CheckTeronTimer; - void Reset() { GhostGUID = 0; TeronGUID = 0; - CheckPlayerTimer = 2000; CheckTeronTimer = 5000; } - void EnterCombat(Unit* who) { } - void MoveInLineOfSight(Unit *who) { if (!who || (!who->isAlive()) || (who->GetGUID() == GhostGUID)) return; - ScriptedAI::MoveInLineOfSight(who); } - /* Comment it out for now. NOTE TO FUTURE DEV: UNCOMMENT THIS OUT ONLY AFTER MIND CONTROL IS IMPLEMENTED void DamageTaken(Unit* done_by, uint32 &damage) { @@ -139,7 +114,6 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI damage = 0; // Only the ghost can deal damage. } */ - void CheckPlayers() { std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); @@ -147,7 +121,7 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI return; // No threat list. Don't continue. std::list::iterator itr = m_threatlist.begin(); std::list targets; - for(; itr != m_threatlist.end(); ++itr) + for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->isAlive()) @@ -161,7 +135,6 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI m_creature->AI()->AttackStart(target); } } - void UpdateAI(const uint32 diff) { if (CheckPlayerTimer < diff) @@ -169,27 +142,22 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI CheckPlayers(); CheckPlayerTimer = 3000; }else CheckPlayerTimer -= diff; - if (CheckTeronTimer < diff) { Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID)); if (!Teron || !Teron->isAlive() || Teron->IsInEvadeMode()) m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - CheckTeronTimer = 5000; }else CheckTeronTimer -= diff; } }; - struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { boss_teron_gorefiendAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 IncinerateTimer; uint32 SummonDoomBlossomTimer; uint32 EnrageTimer; @@ -198,37 +166,29 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI uint32 SummonShadowsTimer; uint32 RandomYellTimer; uint32 AggroTimer; - uint64 AggroTargetGUID; uint64 GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost - bool Intro; bool Done; - void Reset() { if (pInstance) pInstance->SetData(DATA_TERONGOREFIENDEVENT, NOT_STARTED); - IncinerateTimer = 20000 + rand()%11000; SummonDoomBlossomTimer = 12000; EnrageTimer = 600000; CrushingShadowsTimer = 22000; SummonShadowsTimer = 60000; RandomYellTimer = 50000; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Start off unattackable so that the intro is done properly m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 20000; AggroTargetGUID = 0; Intro = false; Done = false; } - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit* pWho) { if (!Intro && pWho->GetTypeId() == TYPEID_PLAYER && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho) && pWho->isInAccessiblePlaceFor(m_creature)) @@ -237,7 +197,6 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { if (pInstance) pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS); - m_creature->GetMotionMaster()->Clear(false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoScriptText(SAY_INTRO, m_creature); @@ -249,20 +208,16 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI if (Done) ScriptedAI::MoveInLineOfSight(pWho); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_TERONGOREFIENDEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); } - float CalculateRandomLocation(float Loc, uint32 radius) { float coord = Loc; @@ -277,14 +232,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI } return coord; } - void SetThreatList(Creature* Blossom) { if (!Blossom) return; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); - for(i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); if (pUnit && pUnit->isAlive()) @@ -294,7 +247,6 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI } } } - void MindControlGhost() { /************************************************************************/ @@ -303,7 +255,6 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI /** THE CURRENT CODE IN THIS FUNCTION IS ONLY THE BEGINNING OF *****/ /** WHAT IS FULLY NECESSARY FOR GOREFIEND TO BE 100% COMPLETE *****/ /************************************************************************/ - Unit* Ghost = NULL; if (GhostGUID) Ghost = Unit::GetUnit((*m_creature), GhostGUID); @@ -318,7 +269,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI Ghost->DealDamage(Ghost, Ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); }*/ - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature* Construct = NULL; float X = CalculateRandomLocation(Ghost->GetPositionX(), 10); @@ -332,14 +283,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) // someone's trying to solo. target = m_creature->getVictim(); - if (target) Construct->GetMotionMaster()->MoveChase(target); } } } } - void UpdateAI(const uint32 diff) { if (Intro && !Done) @@ -356,7 +305,6 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI Unit* pUnit = Unit::GetUnit((*m_creature), AggroTargetGUID); if (pUnit) AttackStart(pUnit); - DoZoneInCombat(); } else @@ -366,15 +314,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI } }else AggroTimer -= diff; } - if (!UpdateVictim() || !Done) return; - if (SummonShadowsTimer < diff) { //MindControlGhost(); - - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) { Creature* Shadow = NULL; float X = CalculateRandomLocation(m_creature->GetPositionX(), 10); @@ -384,14 +329,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) target = m_creature->getVictim(); - if (target) Shadow->AI()->AttackStart(target); } } SummonShadowsTimer = 60000; }else SummonShadowsTimer -= diff; - if (SummonDoomBlossomTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -413,13 +356,11 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI } } }else SummonDoomBlossomTimer -= diff; - if (IncinerateTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) target = m_creature->getVictim(); - if (target) { DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), m_creature); @@ -427,7 +368,6 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI IncinerateTimer = 20000 + rand()%31 * 1000; } }else IncinerateTimer -= diff; - if (CrushingShadowsTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); @@ -435,15 +375,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI DoCast(target, SPELL_CRUSHING_SHADOWS); CrushingShadowsTimer = 10000 + rand()%16 * 1000; }else CrushingShadowsTimer -= diff; - /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/ /*if (ShadowOfDeathTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!target) target = m_creature->getVictim(); - if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) { DoCast(target, SPELL_SHADOW_OF_DEATH); @@ -452,13 +389,11 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player } }else ShadowOfDeathTimer -= diff;*/ - if (RandomYellTimer < diff) { DoScriptText(RAND(SAY_SPELL1,SAY_SPELL2), m_creature); RandomYellTimer = 50000 + rand()%51 * 1000; }else RandomYellTimer -= diff; - if (!m_creature->HasAura(SPELL_BERSERK)) { if (EnrageTimer < diff) @@ -467,26 +402,21 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI DoScriptText(SAY_ENRAGE, m_creature); }else EnrageTimer -= diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_doom_blossom(Creature* pCreature) { return new mob_doom_blossomAI(pCreature); } - CreatureAI* GetAI_mob_shadowy_construct(Creature* pCreature) { return new mob_shadowy_constructAI(pCreature); } - CreatureAI* GetAI_boss_teron_gorefiend(Creature* pCreature) { return new boss_teron_gorefiendAI (pCreature); } - void AddSC_boss_teron_gorefiend() { Script *newscript; @@ -494,12 +424,10 @@ void AddSC_boss_teron_gorefiend() newscript->Name = "mob_doom_blossom"; newscript->GetAI = &GetAI_mob_doom_blossom; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadowy_construct"; newscript->GetAI = &GetAI_mob_shadowy_construct; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_teron_gorefiend"; newscript->GetAI = &GetAI_boss_teron_gorefiend; diff --git a/src/bindings/scripts/scripts/outland/black_temple/boss_warlord_najentus.cpp b/src/bindings/scripts/scripts/outland/black_temple/boss_warlord_najentus.cpp index 0d7e2a7e61d..928e0903d9c 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/boss_warlord_najentus.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/boss_warlord_najentus.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warlord_Najentus SD%Complete: 95 SDComment: SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - enum eEnums { SAY_AGGRO = -1564000, @@ -36,7 +33,6 @@ enum eEnums SAY_ENRAGE1 = -1564007, //is this text actually in use? SAY_ENRAGE2 = -1564008, SAY_DEATH = -1564009, - //Spells SPELL_NEEDLE_SPINE = 39992, SPELL_TIDAL_BURST = 39878, @@ -45,55 +41,42 @@ enum eEnums SPELL_CREATE_NAJENTUS_SPINE = 39956, SPELL_HURL_SPINE = 39948, SPELL_BERSERK = 26662, - GOBJECT_SPINE = 185584, - EVENT_BERSERK = 1, EVENT_YELL = 2, EVENT_NEEDLE = 3, EVENT_SPINE = 4, EVENT_SHIELD = 5, - GCD_CAST = 1, GCD_YELL = 2 }; - struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI { boss_najentusAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; EventMap events; - uint64 SpineTargetGUID; - void Reset() { events.Reset(); - SpineTargetGUID = 0; - if (pInstance) pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, NOT_STARTED); } - void KilledUnit(Unit *victim) { DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, m_creature); events.DelayEvents(5000, GCD_YELL); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_HURL_SPINE && m_creature->HasAura(SPELL_TIDAL_SHIELD)) @@ -103,19 +86,16 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI ResetTimer(); } } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST); events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL); ResetTimer(); } - bool RemoveImpalingSpine() { if (!SpineTargetGUID) return false; @@ -125,21 +105,17 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI SpineTargetGUID=0; return true; } - void ResetTimer(uint32 inc = 0) { events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST); events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST); events.RescheduleEvent(EVENT_SHIELD, 60000 + inc); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) @@ -175,7 +151,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI //m_creature->CastSpell(m_creature, SPELL_NEEDLE_SPINE, true); std::list target; SelectTargetList(target, 3, SELECT_TARGET_RANDOM, 80, true); - for(std::list::iterator i = target.begin(); i != target.end(); ++i) + for (std::list::iterator i = target.begin(); i != target.end(); ++i) m_creature->CastSpell(*i, 39835, true); events.ScheduleEvent(EVENT_NEEDLE, 15000+rand()%10000, GCD_CAST); events.DelayEvents(1500, GCD_CAST); @@ -188,11 +164,9 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI break; } } - DoMeleeAttackIfReady(); } }; - bool GOHello_go_najentus_spine(Player* pPlayer, GameObject* pGo) { if (ScriptedInstance* pInstance = pGo->GetInstanceData()) @@ -204,12 +178,10 @@ bool GOHello_go_najentus_spine(Player* pPlayer, GameObject* pGo) } return true; } - CreatureAI* GetAI_boss_najentus(Creature* pCreature) { return new boss_najentusAI (pCreature); } - void AddSC_boss_najentus() { Script *newscript; @@ -217,7 +189,6 @@ void AddSC_boss_najentus() newscript->Name = "boss_najentus"; newscript->GetAI = &GetAI_boss_najentus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_najentus_spine"; newscript->pGOHello = &GOHello_go_najentus_spine; diff --git a/src/bindings/scripts/scripts/outland/black_temple/def_black_temple.h b/src/bindings/scripts/scripts/outland/black_temple/def_black_temple.h index b7432cd5b20..9b22ff1c0e9 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/def_black_temple.h +++ b/src/bindings/scripts/scripts/outland/black_temple/def_black_temple.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_BLACK_TEMPLE_H #define DEF_BLACK_TEMPLE_H - enum eTypes { DATA_AKAMA = 1, @@ -34,6 +32,5 @@ enum eTypes DATA_GAMEOBJECT_SUPREMUS_DOORS = 25, DATA_BLOOD_ELF_COUNCIL_VOICE = 26 }; - #endif diff --git a/src/bindings/scripts/scripts/outland/black_temple/illidari_council.cpp b/src/bindings/scripts/scripts/outland/black_temple/illidari_council.cpp index 7530909cb11..ec486675595 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/illidari_council.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/illidari_council.cpp @@ -13,52 +13,42 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Illidari_Council SD%Complete: 95 SDComment: Circle of Healing not working properly. SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - //Speech'n'Sounds #define SAY_GATH_SLAY -1564085 #define SAY_GATH_SLAY_COMNT -1564089 #define SAY_GATH_DEATH -1564093 #define SAY_GATH_SPECIAL1 -1564077 #define SAY_GATH_SPECIAL2 -1564081 - #define SAY_VERA_SLAY -1564086 #define SAY_VERA_COMNT -1564089 //signed for 22949 #define SAY_VERA_DEATH -1564094 #define SAY_VERA_SPECIAL1 -1564078 #define SAY_VERA_SPECIAL2 -1564082 - #define SAY_MALA_SLAY -1564087 #define SAY_MALA_COMNT -1564090 #define SAY_MALA_DEATH -1564095 #define SAY_MALA_SPECIAL1 -1564079 #define SAY_MALA_SPECIAL2 -1564083 - #define SAY_ZERE_SLAY -1564088 #define SAY_ZERE_COMNT -1564091 #define SAY_ZERE_DEATH -1564096 #define SAY_ZERE_SPECIAL1 -1564080 #define SAY_ZERE_SPECIAL2 -1564084 - #define ERROR_INST_DATA "SD2 ERROR: Instance Data for Black Temple not set properly; Illidari Council event will not function properly." - #define AKAMAID 23089 - struct CouncilYells { int32 entry; uint32 timer; }; - static CouncilYells CouncilAggro[]= { {-1564069, 5000}, // Gathios @@ -66,7 +56,6 @@ static CouncilYells CouncilAggro[]= {-1564071, 5000}, // Malande {-1564072, 0}, // Zerevor }; - // Need to get proper timers for this later static CouncilYells CouncilEnrage[]= { @@ -75,21 +64,18 @@ static CouncilYells CouncilEnrage[]= {-1564075, 5000}, // Malande {-1564076, 0}, // Zerevor }; - // High Nethermancer Zerevor's spells #define SPELL_FLAMESTRIKE 41481 #define SPELL_BLIZZARD 41482 #define SPELL_ARCANE_BOLT 41483 #define SPELL_ARCANE_EXPLOSION 41524 #define SPELL_DAMPEN_MAGIC 41478 - // Lady Malande's spells #define SPELL_EMPOWERED_SMITE 41471 #define SPELL_CIRCLE_OF_HEALING 41455 #define SPELL_REFLECTIVE_SHIELD 41475 #define SPELL_DIVINE_WRATH 41472 #define SPELL_HEAL_VISUAL 24171 - // Gathios the Shatterer's spells #define SPELL_BLESS_PROTECTION 41450 #define SPELL_BLESS_SPELLWARD 41451 @@ -99,41 +85,30 @@ static CouncilYells CouncilEnrage[]= #define SPELL_SEAL_OF_BLOOD 41459 #define SPELL_CHROMATIC_AURA 41453 #define SPELL_DEVOTION_AURA 41452 - // Veras Darkshadow's spells #define SPELL_DEADLY_POISON 41485 #define SPELL_ENVENOM 41487 #define SPELL_VANISH 41479 - #define SPELL_BERSERK 45078 - struct TRINITY_DLL_DECL mob_blood_elf_council_voice_triggerAI : public ScriptedAI { mob_blood_elf_council_voice_triggerAI(Creature* c) : ScriptedAI(c) { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) Council[i] = 0; } - uint64 Council[4]; - uint32 EnrageTimer; uint32 AggroYellTimer; - uint8 YellCounter; // Serves as the counter for both the aggro and enrage yells - bool EventStarted; - void Reset() { EnrageTimer = 900000; // 15 minutes AggroYellTimer = 500; - YellCounter = 0; - EventStarted = false; } - // finds and stores the GUIDs for each Council member using instance data system. void LoadCouncilGUIDs() { @@ -145,20 +120,15 @@ struct TRINITY_DLL_DECL mob_blood_elf_council_voice_triggerAI : public ScriptedA Council[3] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); }else error_log(ERROR_INST_DATA); } - void EnterCombat(Unit* who) {} - void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!EventStarted) return; - if (YellCounter > 3) return; - if (AggroYellTimer) { if (AggroYellTimer <= diff) @@ -173,7 +143,6 @@ struct TRINITY_DLL_DECL mob_blood_elf_council_voice_triggerAI : public ScriptedA YellCounter = 0; // Reuse for Enrage Yells }else AggroYellTimer -= diff; } - if (EnrageTimer) { if (EnrageTimer <= diff) @@ -189,36 +158,27 @@ struct TRINITY_DLL_DECL mob_blood_elf_council_voice_triggerAI : public ScriptedA } } }; - struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI { mob_illidari_councilAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) Council[i] = 0; } - ScriptedInstance* pInstance; - uint64 Council[4]; - uint32 CheckTimer; uint32 EndEventTimer; - uint8 DeathCount; - bool EventBegun; - void Reset() { CheckTimer = 2000; EndEventTimer = 0; - DeathCount = 0; - Creature* pMember = NULL; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (pMember = (Unit::GetCreature((*m_creature), Council[i]))) { @@ -230,45 +190,37 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI pMember->AI()->EnterEvadeMode(); } } - if (pInstance) { pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED); if (Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) VoiceTrigger->AI()->EnterEvadeMode(); } - EventBegun = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetDisplayId(11686); } - void EnterCombat(Unit *who) {} void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} - void StartEvent(Unit *target) { if (!pInstance) return; - if (target && target->isAlive()) { Council[0] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); Council[1] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); Council[2] = pInstance->GetData64(DATA_LADYMALANDE); Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW); - // Start the event for the Voice Trigger if (Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) { CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; } - - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Unit* Member = NULL; if (Council[i]) @@ -278,17 +230,13 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI CAST_CRE(Member)->AI()->AttackStart(target); } } - pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, IN_PROGRESS); - EventBegun = true; } } - void UpdateAI(const uint32 diff) { if (!EventBegun) return; - if (EndEventTimer) { if (EndEventTimer <= diff) @@ -305,7 +253,6 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } - Creature* pMember = (Unit::GetCreature(*m_creature, Council[DeathCount])); if (pMember && pMember->isAlive()) pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); @@ -313,13 +260,12 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI EndEventTimer = 1500; }else EndEventTimer -= diff; } - if (CheckTimer) { if (CheckTimer <= diff) { uint8 EvadeCheck = 0; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (Council[i]) { @@ -337,33 +283,25 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI } } } - if (EvadeCheck > 3) Reset(); - CheckTimer = 2000; }else CheckTimer -= diff; } - } }; - struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI { boss_illidari_councilAI(Creature* c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) Council[i] = 0; LoadedGUIDs = false; } - uint64 Council[4]; - ScriptedInstance* pInstance; - bool LoadedGUIDs; - void EnterCombat(Unit* who) { if (pInstance) @@ -386,10 +324,9 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI if (!LoadedGUIDs) LoadGUIDs(); } - void EnterEvadeMode() { - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (Unit* pUnit = Unit::GetUnit(*m_creature, Council[i])) if (pUnit != m_creature && pUnit->getVictim()) @@ -400,14 +337,12 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI } ScriptedAI::EnterEvadeMode(); } - void DamageTaken(Unit* done_by, uint32 &damage) { if (done_by == m_creature) return; - damage /= 4; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (Creature* pUnit = Unit::GetCreature(*m_creature, Council[i])) if (pUnit != m_creature && damage < pUnit->GetHealth()) @@ -417,7 +352,6 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI } } } - void LoadGUIDs() { if (!pInstance) @@ -425,26 +359,21 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI error_log(ERROR_INST_DATA); return; } - Council[0] = pInstance->GetData64(DATA_LADYMALANDE); Council[1] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); Council[2] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW); - LoadedGUIDs = true; } }; - struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_councilAI { boss_gathios_the_shattererAI(Creature *c) : boss_illidari_councilAI(c) {} - uint32 ConsecrationTimer; uint32 HammerOfJusticeTimer; uint32 SealTimer; uint32 AuraTimer; uint32 BlessingTimer; - void Reset() { ConsecrationTimer = 40000; @@ -453,30 +382,24 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun AuraTimer = 90000; BlessingTimer = 60000; } - void KilledUnit(Unit *victim) { DoScriptText(SAY_GATH_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_GATH_DEATH, m_creature); } - Unit* SelectCouncilMember() { Unit* pUnit = m_creature; uint32 member = 0; // He chooses Lady Malande most often - if (rand()%10 == 0) // But there is a chance he picks someone else. member = urand(1, 3); - if (member != 2) // No need to create another pointer to us using Unit::GetUnit pUnit = Unit::GetUnit((*m_creature), Council[member]); return pUnit; } - void CastAuraOnCouncil() { uint32 spellid = 0; @@ -485,19 +408,17 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun case 0: spellid = SPELL_DEVOTION_AURA; break; case 1: spellid = SPELL_CHROMATIC_AURA; break; } - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), Council[i]); if (pUnit) pUnit->CastSpell(pUnit, spellid, true, 0, 0, m_creature->GetGUID()); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (BlessingTimer < diff) { if (Unit* pUnit = SelectCouncilMember()) @@ -510,13 +431,11 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun } BlessingTimer = 60000; }else BlessingTimer -= diff; - if (ConsecrationTimer < diff) { DoCast(m_creature, SPELL_CONSECRATION); ConsecrationTimer = 40000; }else ConsecrationTimer -= diff; - if (HammerOfJusticeTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -529,7 +448,6 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun } } }else HammerOfJusticeTimer -= diff; - if (SealTimer < diff) { switch(rand()%2) @@ -539,28 +457,23 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun } SealTimer = 40000; }else SealTimer -= diff; - if (AuraTimer < diff) { CastAuraOnCouncil(); AuraTimer = 90000; }else AuraTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI { boss_high_nethermancer_zerevorAI(Creature *c) : boss_illidari_councilAI(c) {} - uint32 BlizzardTimer; uint32 FlamestrikeTimer; uint32 ArcaneBoltTimer; uint32 DampenMagicTimer; uint32 Cooldown; uint32 ArcaneExplosionTimer; - void Reset() { BlizzardTimer = 30000 + rand()%61 * 1000; @@ -570,22 +483,18 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ ArcaneExplosionTimer = 14000; Cooldown = 0; } - void KilledUnit(Unit *victim) { DoScriptText(SAY_ZERE_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_ZERE_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Cooldown) { if (Cooldown < diff) Cooldown = 0; @@ -595,7 +504,6 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ return; // Don't cast any other spells if global cooldown is still ticking } } - if (DampenMagicTimer < diff) { DoCast(m_creature, SPELL_DAMPEN_MAGIC); @@ -603,21 +511,18 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ DampenMagicTimer = 67200; // almost 1,12 minutes ArcaneBoltTimer += 1000; // Give the Mage some time to spellsteal Dampen. }else DampenMagicTimer -= diff; - if (ArcaneExplosionTimer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION); Cooldown = 1000; ArcaneExplosionTimer = 14000; }else ArcaneExplosionTimer -= diff; - if (ArcaneBoltTimer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_BOLT); ArcaneBoltTimer = 3000; Cooldown = 2000; }else ArcaneBoltTimer -= diff; - if (BlizzardTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -628,7 +533,6 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ Cooldown = 1000; } }else BlizzardTimer -= diff; - if (FlamestrikeTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -641,16 +545,13 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ }else FlamestrikeTimer -= diff; } }; - struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI { boss_lady_malandeAI(Creature *c) : boss_illidari_councilAI(c) {} - uint32 EmpoweredSmiteTimer; uint32 CircleOfHealingTimer; uint32 DivineWrathTimer; uint32 ReflectiveShieldTimer; - void Reset() { EmpoweredSmiteTimer = 38000; @@ -658,22 +559,18 @@ struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI DivineWrathTimer = 40000; ReflectiveShieldTimer = 0; } - void KilledUnit(Unit *victim) { DoScriptText(SAY_MALA_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_MALA_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (EmpoweredSmiteTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -682,13 +579,11 @@ struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI EmpoweredSmiteTimer = 38000; } }else EmpoweredSmiteTimer -= diff; - if (CircleOfHealingTimer < diff) { DoCast(m_creature, SPELL_CIRCLE_OF_HEALING); CircleOfHealingTimer = 60000; }else CircleOfHealingTimer -= diff; - if (DivineWrathTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -697,57 +592,44 @@ struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI DivineWrathTimer = 40000 + rand()%41 * 1000; } }else DivineWrathTimer -= diff; - if (ReflectiveShieldTimer < diff) { DoCast(m_creature, SPELL_REFLECTIVE_SHIELD); ReflectiveShieldTimer = 65000; }else ReflectiveShieldTimer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI { boss_veras_darkshadowAI(Creature *c) : boss_illidari_councilAI(c) {} - uint64 EnvenomTargetGUID; - uint32 DeadlyPoisonTimer; uint32 VanishTimer; uint32 AppearEnvenomTimer; - bool HasVanished; - void Reset() { EnvenomTargetGUID = 0; - DeadlyPoisonTimer = 20000; VanishTimer = 60000 + rand()%61 * 1000; AppearEnvenomTimer = 150000; - HasVanished = false; m_creature->SetVisibility(VISIBILITY_ON); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void KilledUnit(Unit *victim) { DoScriptText(SAY_VERA_SLAY, m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_VERA_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!HasVanished) { if (DeadlyPoisonTimer < diff) @@ -755,13 +637,11 @@ struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI DoCast(m_creature->getVictim(), SPELL_DEADLY_POISON); DeadlyPoisonTimer = 15000 + rand()%31 * 1000; }else DeadlyPoisonTimer -= diff; - if (AppearEnvenomTimer < diff) // Cast Envenom. This is cast 4 seconds after Vanish is over { DoCast(m_creature->getVictim(), SPELL_ENVENOM); AppearEnvenomTimer = 90000; }else AppearEnvenomTimer -= diff; - if (VanishTimer < diff) // Disappear and stop attacking, but follow a random unit { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -777,7 +657,6 @@ struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI m_creature->GetMotionMaster()->MoveChase(target); } }else VanishTimer -= diff; - DoMeleeAttackIfReady(); } else @@ -794,7 +673,6 @@ struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI AppearEnvenomTimer = 4000; HasVanished = false; }else VanishTimer -= diff; - if (AppearEnvenomTimer < diff) // Appear 2 seconds before becoming attackable (Shifting out of vanish) { m_creature->GetMotionMaster()->Clear(); @@ -805,66 +683,53 @@ struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI } } }; - CreatureAI* GetAI_mob_blood_elf_council_voice_trigger(Creature* c) { return new mob_blood_elf_council_voice_triggerAI(c); } - CreatureAI* GetAI_mob_illidari_council(Creature* pCreature) { return new mob_illidari_councilAI (pCreature); } - CreatureAI* GetAI_boss_gathios_the_shatterer(Creature* pCreature) { return new boss_gathios_the_shattererAI (pCreature); } - CreatureAI* GetAI_boss_lady_malande(Creature* pCreature) { return new boss_lady_malandeAI (pCreature); } - CreatureAI* GetAI_boss_veras_darkshadow(Creature* pCreature) { return new boss_veras_darkshadowAI (pCreature); } - CreatureAI* GetAI_boss_high_nethermancer_zerevor(Creature* pCreature) { return new boss_high_nethermancer_zerevorAI (pCreature); } - void AddSC_boss_illidari_council() { Script *newscript; - newscript = new Script; newscript->Name = "mob_illidari_council"; newscript->GetAI = &GetAI_mob_illidari_council; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_blood_elf_council_voice_trigger"; newscript->GetAI = &GetAI_mob_blood_elf_council_voice_trigger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_gathios_the_shatterer"; newscript->GetAI = &GetAI_boss_gathios_the_shatterer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lady_malande"; newscript->GetAI = &GetAI_boss_lady_malande; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_veras_darkshadow"; newscript->GetAI = &GetAI_boss_veras_darkshadow; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_high_nethermancer_zerevor"; newscript->GetAI = &GetAI_boss_high_nethermancer_zerevor; diff --git a/src/bindings/scripts/scripts/outland/black_temple/instance_black_temple.cpp b/src/bindings/scripts/scripts/outland/black_temple/instance_black_temple.cpp index cd67af9a8f3..0d49c7970a7 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/instance_black_temple.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/instance_black_temple.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Black_Temple SD%Complete: 100 SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Black Temple Scripts SDCategory: Black Temple EndScriptData */ - #include "precompiled.h" #include "def_black_temple.h" - #define MAX_ENCOUNTER 9 - /* Black Temple encounters: 0 - High Warlord Naj'entus event 1 - Supremus Event @@ -37,14 +33,11 @@ EndScriptData */ 7 - Illidari Council Event 8 - Illidan Stormrage Event */ - struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance { instance_black_temple(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - uint64 Najentus; uint64 Akama; // This is the Akama that starts the Illidan encounter. uint64 Akama_Shade; // This is the Akama that starts the Shade of Akama encounter. @@ -57,7 +50,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance uint64 IllidariCouncil; uint64 BloodElfCouncilVoice; uint64 IllidanStormrage; - uint64 NajentusGate; uint64 MainTempleDoors; uint64 ShadeOfAkamaDoor; @@ -70,11 +62,9 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance uint64 SimpleDoor;//council uint64 IllidanGate; uint64 IllidanDoor[2]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Najentus = 0; Akama = 0; Akama_Shade = 0; @@ -87,7 +77,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance IllidariCouncil = 0; BloodElfCouncilVoice = 0; IllidanStormrage = 0; - NajentusGate = 0; MainTempleDoors = 0; ShadeOfAkamaDoor= 0; @@ -102,32 +91,26 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance IllidanDoor[0] = 0; IllidanDoor[1] = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* plr = itr->getSource()) return plr; } } - debug_log("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); return NULL; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -146,7 +129,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance case 23499: BloodElfCouncilVoice = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -175,7 +157,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance case 186262: IllidanDoor[1] = pGo->GetGUID(); break; // Left door at Temple Summit } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -198,10 +179,8 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance case DATA_GAMEOBJECT_SUPREMUS_DOORS: return MainTempleDoors; case DATA_BLOOD_ELF_COUNCIL_VOICE: return BloodElfCouncilVoice; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -266,24 +245,19 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance m_auiEncounter[7] = data; break; case DATA_ILLIDANSTORMRAGEEVENT: m_auiEncounter[8] = data; break; } - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint32 GetData(uint32 type) { switch(type) @@ -298,15 +272,12 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance case DATA_ILLIDARICOUNCILEVENT: return m_auiEncounter[7]; case DATA_ILLIDANSTORMRAGEEVENT: return m_auiEncounter[8]; } - return 0; } - std::string GetSaveData() { return str_data; } - void Load(const char* in) { if (!in) @@ -314,27 +285,21 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_black_temple(Map* pMap) { return new instance_black_temple(pMap); } - void AddSC_instance_black_temple() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/blades_edge_mountains.cpp b/src/bindings/scripts/scripts/outland/blades_edge_mountains.cpp index 4c8d148d565..4ee593cf194 100644 --- a/src/bindings/scripts/scripts/outland/blades_edge_mountains.cpp +++ b/src/bindings/scripts/scripts/outland/blades_edge_mountains.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Blades_Edge_Mountains SD%Complete: 90 SDComment: Quest support: 10503, 10504, 10556, 10609, 10682, 10821, 10980. Ogri'la->Skettis Flight. (npc_daranelle needs bit more work before consider complete) SDCategory: Blade's Edge Mountains EndScriptData */ - /* ContentData mobs_bladespire_ogre mobs_nether_drake @@ -29,34 +27,26 @@ npc_overseer_nuaar npc_saikkal_the_elder go_legion_obelisk EndContentData */ - #include "precompiled.h" - //Support for quest: You're Fired! (10821) bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; - #define LEGION_OBELISK_ONE 185193 #define LEGION_OBELISK_TWO 185195 #define LEGION_OBELISK_THREE 185196 #define LEGION_OBELISK_FOUR 185197 #define LEGION_OBELISK_FIVE 185198 - /*###### ## mobs_bladespire_ogre ######*/ - //TODO: add support for quest 10512 + Creature abilities struct TRINITY_DLL_DECL mobs_bladespire_ogreAI : public ScriptedAI { mobs_bladespire_ogreAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; @@ -64,11 +54,9 @@ CreatureAI* GetAI_mobs_bladespire_ogre(Creature* pCreature) { return new mobs_bladespire_ogreAI (pCreature); } - /*###### ## mobs_nether_drake ######*/ - enum eNetherdrake { SAY_NIHIL_1 = -1000396, //signed for 5955 @@ -76,59 +64,46 @@ enum eNetherdrake SAY_NIHIL_3 = -1000398, //signed for 5955 SAY_NIHIL_4 = -1000399, //signed for 20021, used by 20021,21817,21820,21821,21823 SAY_NIHIL_INTERRUPT = -1000400, //signed for 20021, used by 20021,21817,21820,21821,21823 - ENTRY_WHELP = 20021, ENTRY_PROTO = 21821, ENTRY_ADOLE = 21817, ENTRY_MATUR = 21820, ENTRY_NIHIL = 21823, - SPELL_T_PHASE_MODULATOR = 37573, - SPELL_ARCANE_BLAST = 38881, SPELL_MANA_BURN = 38884, SPELL_INTANGIBLE_PRESENCE = 36513 }; - struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI { mobs_nether_drakeAI(Creature *c) : ScriptedAI(c) {} - bool IsNihil; uint32 NihilSpeech_Timer; uint32 NihilSpeech_Phase; - uint32 ArcaneBlast_Timer; uint32 ManaBurn_Timer; uint32 IntangiblePresence_Timer; - void Reset() { IsNihil = false; NihilSpeech_Timer = 3000; NihilSpeech_Phase = 0; - ArcaneBlast_Timer = 7500; ManaBurn_Timer = 10000; IntangiblePresence_Timer = 15000; } - void EnterCombat(Unit* who) { } - void MoveInLineOfSight(Unit *who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - //in case Creature was not summoned (not expected) void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == 0) { m_creature->setDeathState(JUST_DIED); @@ -136,17 +111,14 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI m_creature->SetHealth(0); } } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) { const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL}; int cid = rand()%(4-1); - if (entry_list[cid] == m_creature->GetEntry()) ++cid; - //we are nihil, so say before transform if (m_creature->GetEntry() == ENTRY_NIHIL) { @@ -154,7 +126,6 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); IsNihil = false; } - if (m_creature->UpdateEntry(entry_list[cid])) { if (entry_list[cid] == ENTRY_NIHIL) @@ -167,7 +138,6 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (IsNihil) @@ -201,20 +171,16 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI } NihilSpeech_Timer = 5000; }else NihilSpeech_Timer -=diff; - //anything below here is not interesting for Nihil, so skip it return; } - if (!UpdateVictim()) return; - if (IntangiblePresence_Timer <= diff) { DoCast(m_creature->getVictim(),SPELL_INTANGIBLE_PRESENCE); IntangiblePresence_Timer = 15000+rand()%15000; }else IntangiblePresence_Timer -= diff; - if (ManaBurn_Timer <= diff) { Unit* target = m_creature->getVictim(); @@ -222,40 +188,31 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI DoCast(target,SPELL_MANA_BURN); ManaBurn_Timer = 8000+rand()%8000; }else ManaBurn_Timer -= diff; - if (ArcaneBlast_Timer <= diff) { DoCast(m_creature->getVictim(),SPELL_ARCANE_BLAST); ArcaneBlast_Timer = 2500+rand()%5000; }else ArcaneBlast_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mobs_nether_drake(Creature* pCreature) { return new mobs_nether_drakeAI (pCreature); } - /*###### ## npc_daranelle ######*/ - enum eDaranelle { SAY_SPELL_INFLUENCE = -1000174, SPELL_LASHHAN_CHANNEL = 36904 }; - struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI { npc_daranelleAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void EnterCombat(Unit* who) { } - void MoveInLineOfSight(Unit *who) { if (who->GetTypeId() == TYPEID_PLAYER) @@ -267,32 +224,24 @@ struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI m_creature->CastSpell(who,37028,true); } } - ScriptedAI::MoveInLineOfSight(who); } }; - CreatureAI* GetAI_npc_daranelle(Creature* pCreature) { return new npc_daranelleAI (pCreature); } - /*###### ## npc_overseer_nuaar ######*/ - #define GOSSIP_HELLO_ON "Overseer, I am here to negotiate on behalf of the Cenarion Expedition." - bool GossipHello_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(10682) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10532, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -302,24 +251,18 @@ bool GossipSelect_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature, uint3 } return true; } - /*###### ## npc_saikkal_the_elder ######*/ - #define GOSSIP_HELLO_STE "Yes... yes, it's me." #define GOSSIP_SELECT_STE "Yes elder. Tell me more of the book." - bool GossipHello_npc_saikkal_the_elder(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(10980) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10794, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_saikkal_the_elder(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -335,11 +278,9 @@ bool GossipSelect_npc_saikkal_the_elder(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## go_legion_obelisk ######*/ - bool GOHello_go_legion_obelisk(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(10821) == QUEST_STATUS_INCOMPLETE) @@ -362,7 +303,6 @@ bool GOHello_go_legion_obelisk(Player* pPlayer, GameObject* pGo) obelisk_five = true; break; } - if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true) { pGo->SummonCreature(19963,2943.40f,4778.20f,284.49f,0.94f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); @@ -374,45 +314,36 @@ bool GOHello_go_legion_obelisk(Player* pPlayer, GameObject* pGo) obelisk_five = false; } } - return true; } - /*###### ## AddSC ######*/ - void AddSC_blades_edge_mountains() { Script *newscript; - newscript = new Script; newscript->Name = "mobs_bladespire_ogre"; newscript->GetAI = &GetAI_mobs_bladespire_ogre; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mobs_nether_drake"; newscript->GetAI = &GetAI_mobs_nether_drake; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_daranelle"; newscript->GetAI = &GetAI_npc_daranelle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_overseer_nuaar"; newscript->pGossipHello = &GossipHello_npc_overseer_nuaar; newscript->pGossipSelect = &GossipSelect_npc_overseer_nuaar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_saikkal_the_elder"; newscript->pGossipHello = &GossipHello_npc_saikkal_the_elder; newscript->pGossipSelect = &GossipSelect_npc_saikkal_the_elder; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_legion_obelisk"; newscript->pGOHello = &GOHello_go_legion_obelisk; diff --git a/src/bindings/scripts/scripts/outland/boss_doomlord_kazzak.cpp b/src/bindings/scripts/scripts/outland/boss_doomlord_kazzak.cpp index 902c3e347b5..e9edad38db4 100644 --- a/src/bindings/scripts/scripts/outland/boss_doomlord_kazzak.cpp +++ b/src/bindings/scripts/scripts/outland/boss_doomlord_kazzak.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Doomlord_Kazzak SD%Complete: 70 SDComment: Using incorrect spell for Mark of Kazzak SDCategory: Hellfire Peninsula EndScriptData */ - #include "precompiled.h" - #define SAY_INTRO -1000375 //signed for 3465 #define SAY_AGGRO1 -1000376 //signed for 3465 #define SAY_AGGRO2 -1000377 //signed for 3465 @@ -35,7 +32,6 @@ EndScriptData */ #define EMOTE_FRENZY -1000384 //signed for 21027 #define SAY_RAND1 -1000385 //signed for 21027 #define SAY_RAND2 -1000386 //signed for 21027 - #define SPELL_SHADOWVOLLEY 32963 #define SPELL_CLEAVE 31779 #define SPELL_THUNDERCLAP 36706 @@ -44,11 +40,9 @@ EndScriptData */ #define SPELL_ENRAGE 32964 #define SPELL_CAPTURESOUL 32966 #define SPELL_TWISTEDREFLECTION 21063 - struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI { boss_doomlordkazzakAI(Creature *c) : ScriptedAI(c) {} - uint32 ShadowVolley_Timer; uint32 Cleave_Timer; uint32 ThunderClap_Timer; @@ -56,7 +50,6 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI uint32 MarkOfKazzak_Timer; uint32 Enrage_Timer; uint32 Twisted_Reflection_Timer; - void Reset() { ShadowVolley_Timer = 6000 + rand()%4000; @@ -67,67 +60,55 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI Enrage_Timer = 60000; Twisted_Reflection_Timer = 33000; // Timer may be incorrect } - void JustRespawned() { DoScriptText(SAY_INTRO, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), m_creature); } - void KilledUnit(Unit* victim) { // When Kazzak kills a player (not pets/totems), he regens some health if (victim->GetTypeId() != TYPEID_PLAYER) return; - DoCast(m_creature,SPELL_CAPTURESOUL); - DoScriptText(RAND(SAY_KILL1,SAY_KILL2,SAY_KILL3), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //ShadowVolley_Timer if (ShadowVolley_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWVOLLEY); ShadowVolley_Timer = 4000 + rand()%2000; }else ShadowVolley_Timer -= diff; - //Cleave_Timer if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 8000 + rand()%4000; }else Cleave_Timer -= diff; - //ThunderClap_Timer if (ThunderClap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_THUNDERCLAP); ThunderClap_Timer = 10000 + rand()%4000; }else ThunderClap_Timer -= diff; - //VoidBolt_Timer if (VoidBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_VOIDBOLT); VoidBolt_Timer = 15000 + rand()%3000; }else VoidBolt_Timer -= diff; - //MarkOfKazzak_Timer if (MarkOfKazzak_Timer < diff) { @@ -138,7 +119,6 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI MarkOfKazzak_Timer = 20000; } }else MarkOfKazzak_Timer -= diff; - //Enrage_Timer if (Enrage_Timer < diff) { @@ -146,23 +126,18 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI DoCast(m_creature,SPELL_ENRAGE); Enrage_Timer = 30000; }else Enrage_Timer -= diff; - if (Twisted_Reflection_Timer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_TWISTEDREFLECTION); Twisted_Reflection_Timer = 15000; }else Twisted_Reflection_Timer -= diff; - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_boss_doomlordkazzak(Creature* pCreature) { return new boss_doomlordkazzakAI (pCreature); } - void AddSC_boss_doomlordkazzak() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/boss_doomwalker.cpp b/src/bindings/scripts/scripts/outland/boss_doomwalker.cpp index 4eba3e1e38d..af01d09454a 100644 --- a/src/bindings/scripts/scripts/outland/boss_doomwalker.cpp +++ b/src/bindings/scripts/scripts/outland/boss_doomwalker.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Doomwalker SD%Complete: 100 SDComment: SDCategory: Shadowmoon Valley EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1000387 //signed for 21027 #define SAY_EARTHQUAKE_1 -1000388 //signed for 21027 #define SAY_EARTHQUAKE_2 -1000389 //signed for 21027 @@ -32,7 +29,6 @@ EndScriptData */ #define SAY_SLAY_2 -1000393 //signed for 5955 #define SAY_SLAY_3 -1000394 //signed for 5955 #define SAY_DEATH -1000395 //signed for 5955 - #define SPELL_EARTHQUAKE 32686 #define SPELL_SUNDER_ARMOR 33661 #define SPELL_CHAIN_LIGHTNING 33665 @@ -40,19 +36,15 @@ EndScriptData */ #define SPELL_ENRAGE 33653 #define SPELL_MARK_DEATH 37128 #define SPELL_AURA_DEATH 37131 - struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI { boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {} - uint32 Chain_Timer; uint32 Enrage_Timer; uint32 Overrun_Timer; uint32 Quake_Timer; uint32 Armor_Timer; - bool InEnrage; - void Reset() { Enrage_Timer = 0; @@ -60,30 +52,23 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI Chain_Timer = 10000 + rand()%20000; Quake_Timer = 25000 + rand()%10000; Overrun_Timer = 30000 + rand()%15000; - InEnrage = false; } - void KilledUnit(Unit* Victim) { Victim->CastSpell(Victim,SPELL_MARK_DEATH,0); - if (rand()%5) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void MoveInLineOfSight(Unit *who) { if (who && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsHostileTo(who)) @@ -94,12 +79,10 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Spell Enrage, when hp <= 20% gain enrage if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20) { @@ -110,63 +93,49 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI InEnrage = true; }else Enrage_Timer -= diff; } - //Spell Overrun if (Overrun_Timer < diff) { DoScriptText(RAND(SAY_OVERRUN_1,SAY_OVERRUN_2), m_creature); - DoCast(m_creature->getVictim(),SPELL_OVERRUN); Overrun_Timer = 25000 + rand()%15000; }else Overrun_Timer -= diff; - //Spell Earthquake if (Quake_Timer < diff) { if (rand()%2) return; - DoScriptText(RAND(SAY_EARTHQUAKE_1,SAY_EARTHQUAKE_2), m_creature); - //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead if (InEnrage) m_creature->RemoveAura(SPELL_ENRAGE); - DoCast(m_creature,SPELL_EARTHQUAKE); Quake_Timer = 30000 + rand()%25000; }else Quake_Timer -= diff; - //Spell Chain Lightning if (Chain_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,1); - if (!target) target = m_creature->getVictim(); - if (target) DoCast(target,SPELL_CHAIN_LIGHTNING); - Chain_Timer = 7000 + rand()%20000; }else Chain_Timer -= diff; - //Spell Sunder Armor if (Armor_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR); Armor_Timer = 10000 + rand()%15000; }else Armor_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_doomwalker(Creature* pCreature) { return new boss_doomwalkerAI (pCreature); } - void AddSC_boss_doomwalker() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp index 7b25584cf64..fa9e079f8e4 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Fathomlord_Karathress SD%Complete: 70 SDComment: Cyclone workaround SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" #include "escort_ai.h" - #define SAY_AGGRO -1548021 #define SAY_GAIN_BLESSING -1548022 #define SAY_GAIN_ABILITY1 -1548023 @@ -34,7 +31,6 @@ EndScriptData */ #define SAY_SLAY2 -1548027 #define SAY_SLAY3 -1548028 #define SAY_DEATH -1548029 - //Karathress spells #define SPELL_CATACLYSMIC_BOLT 38441 #define SPELL_POWER_OF_SHARKKIS 38455 @@ -43,7 +39,6 @@ EndScriptData */ #define SPELL_ENRAGE 24318 #define SPELL_SEAR_NOVA 38445 #define SPELL_BLESSING_OF_THE_TIDES 38449 - //Sharkkis spells #define SPELL_LEECHING_THROW 29436 #define SPELL_THE_BEAST_WITHIN 38373 @@ -51,7 +46,6 @@ EndScriptData */ #define SPELL_SUMMON_FATHOM_LURKER 38433 #define SPELL_SUMMON_FATHOM_SPOREBAT 38431 #define SPELL_PET_ENRAGE 19574 - //Tidalvess spells #define SPELL_FROST_SHOCK 38234 #define SPELL_SPITFIRE_TOTEM 38236 @@ -61,7 +55,6 @@ EndScriptData */ #define SPELL_EARTHBIND_TOTEM 38304 #define SPELL_EARTHBIND_TOTEM_EFFECT 6474 #define SPELL_WINDFURY_WEAPON 38184 - //Caribdis Spells #define SPELL_WATER_BOLT_VOLLEY 38335 #define SPELL_TIDAL_SURGE 38358 @@ -69,13 +62,11 @@ EndScriptData */ #define SPELL_HEAL 38330 #define SPELL_SUMMON_CYCLONE 38337 #define SPELL_CYCLONE_CYCLONE 29538 - //Yells and Quotes #define SAY_GAIN_BLESSING_OF_TIDES "Your overconfidence will be your undoing! Guards, lend me your strength!" #define SOUND_GAIN_BLESSING_OF_TIDES 11278 #define SAY_MISC "Alana be'lendor!" //don't know what use this #define SOUND_MISC 11283 - //Summoned Unit GUIDs #define CREATURE_CYCLONE 22104 #define CREATURE_FATHOM_SPOREBAT 22120 @@ -83,14 +74,12 @@ EndScriptData */ #define CREATURE_SPITFIRE_TOTEM 22091 #define CREATURE_EARTHBIND_TOTEM 22486 #define CREATURE_POISON_CLEANSING_TOTEM 22487 - //entry and position for Seer Olum #define SEER_OLUM 22820 #define OLUM_X 446.78f #define OLUM_Y -542.76f #define OLUM_Z -7.54773f #define OLUM_O 0.401581f - //Fathom-Lord Karathress AI struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI { @@ -101,27 +90,19 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI Advisors[1] = 0; Advisors[2] = 0; } - ScriptedInstance* pInstance; - uint32 CataclysmicBolt_Timer; uint32 Enrage_Timer; uint32 SearNova_Timer; - bool BlessingOfTides; - uint64 Advisors[3]; - void Reset() { CataclysmicBolt_Timer = 10000; Enrage_Timer = 600000; //10 minutes SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds - BlessingOfTides = false; - - if (pInstance) { uint64 RAdvisors[3]; @@ -130,8 +111,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI RAdvisors[2] = pInstance->GetData64(DATA_CARIBDIS); //Respawn of the 3 Advisors Creature* pAdvisor = NULL; - for(int i=0; i<3; ++i) - + for (int i=0; i<3; ++i) if (RAdvisors[i]) { pAdvisor = (Unit::GetCreature((*m_creature), RAdvisors[i])); @@ -145,133 +125,108 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - } - void EventSharkkisDeath() { DoScriptText(SAY_GAIN_ABILITY1, m_creature); DoCast(m_creature, SPELL_POWER_OF_SHARKKIS); } - void EventTidalvessDeath() { DoScriptText(SAY_GAIN_ABILITY2, m_creature); DoCast(m_creature, SPELL_POWER_OF_TIDALVESS); } - void EventCaribdisDeath() { DoScriptText(SAY_GAIN_ABILITY3, m_creature); DoCast(m_creature, SPELL_POWER_OF_CARIBDIS); } - void GetAdvisors() { if (!pInstance) return; - Advisors[0] = pInstance->GetData64(DATA_SHARKKIS); Advisors[1] = pInstance->GetData64(DATA_TIDALVESS); Advisors[2] = pInstance->GetData64(DATA_CARIBDIS); } - void StartEvent(Unit *who) { if (!pInstance) return; - GetAdvisors(); - DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); - pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit *killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, DONE); - //support for quest 10944 m_creature->SummonCreature(SEER_OLUM, OLUM_X, OLUM_Y, OLUM_Z, OLUM_O, TEMPSUMMON_TIMED_DESPAWN, 3600000); } - void EnterCombat(Unit *who) { StartEvent(who); } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - if (target) { AttackStart(target); GetAdvisors(); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } - //CataclysmicBolt_Timer if (CataclysmicBolt_Timer < diff) { //select a random unit other than the main tank Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1); - //if there aren't other units, cast on the tank if (!target) target = m_creature->getVictim(); - if (target) DoCast(target, SPELL_CATACLYSMIC_BOLT); CataclysmicBolt_Timer = 10000; }else CataclysmicBolt_Timer -= diff; - //SearNova_Timer if (SearNova_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SEAR_NOVA); SearNova_Timer = 20000+rand()%40000; }else SearNova_Timer -= diff; - //Enrage_Timer if (Enrage_Timer < diff) { DoCast(m_creature, SPELL_ENRAGE); Enrage_Timer = 90000; }else Enrage_Timer -= diff; - //Blessing of Tides Trigger if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75 && !BlessingOfTides) { BlessingOfTides = true; bool continueTriggering; Creature* Advisor; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) if (Advisors[i]) { Advisor = (Unit::GetCreature(*m_creature, Advisors[i])); @@ -291,11 +246,9 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_GAIN_BLESSING_OF_TIDES); } } - DoMeleeAttackIfReady(); } }; - //Fathom-Guard Sharkkis AI struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI { @@ -303,53 +256,41 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 LeechingThrow_Timer; uint32 TheBeastWithin_Timer; uint32 Multishot_Timer; uint32 Pet_Timer; - bool pet; - uint64 SummonedPet; - void Reset() { LeechingThrow_Timer = 20000; TheBeastWithin_Timer = 30000; Multishot_Timer = 15000; Pet_Timer = 10000; - pet = false; - Creature *Pet = Unit::GetCreature(*m_creature, SummonedPet); if (Pet && Pet->isAlive()) { Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - SummonedPet = 0; - if (pInstance) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit *victim) { if (pInstance) { Creature *Karathress = NULL; Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS))); - if (Karathress) CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); } } - void EnterCombat(Unit *who) { if (pInstance) @@ -358,45 +299,38 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } - //LeechingThrow_Timer if (LeechingThrow_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_LEECHING_THROW); LeechingThrow_Timer = 20000; }else LeechingThrow_Timer -= diff; - //Multishot_Timer if (Multishot_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MULTISHOT); Multishot_Timer = 20000; }else Multishot_Timer -= diff; - //TheBeastWithin_Timer if (TheBeastWithin_Timer < diff) { @@ -408,7 +342,6 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI } TheBeastWithin_Timer = 30000; }else TheBeastWithin_Timer -= diff; - //Pet_Timer if (Pet_Timer < diff && pet == false) { @@ -435,11 +368,9 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI SummonedPet = Pet->GetGUID(); } }else Pet_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Fathom-Guard Tidalvess AI struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI { @@ -447,38 +378,31 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 FrostShock_Timer; uint32 Spitfire_Timer; uint32 PoisonCleansing_Timer; uint32 Earthbind_Timer; - void Reset() { FrostShock_Timer = 25000; Spitfire_Timer = 60000; PoisonCleansing_Timer = 30000; Earthbind_Timer = 45000; - if (pInstance) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit *victim) { if (pInstance) { Creature *Karathress = NULL; Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS))); - if (Karathress) if (!m_creature->isAlive() && Karathress) CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); } } - void EnterCombat(Unit *who) { if (pInstance) @@ -488,43 +412,36 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI } DoCast(m_creature, SPELL_WINDFURY_WEAPON); } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } - if (!m_creature->HasAura(SPELL_WINDFURY_WEAPON)) { DoCast(m_creature, SPELL_WINDFURY_WEAPON); } - //FrostShock_Timer if (FrostShock_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FROST_SHOCK); FrostShock_Timer = 25000+rand()%5000; }else FrostShock_Timer -= diff; - //Spitfire_Timer if (Spitfire_Timer < diff) { @@ -536,25 +453,21 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI } Spitfire_Timer = 60000; }else Spitfire_Timer -= diff; - //PoisonCleansing_Timer if (PoisonCleansing_Timer < diff) { DoCast(m_creature, SPELL_POISON_CLEANSING_TOTEM); PoisonCleansing_Timer = 30000; }else PoisonCleansing_Timer -= diff; - //Earthbind_Timer if (Earthbind_Timer < diff) { DoCast(m_creature, SPELL_EARTHBIND_TOTEM); Earthbind_Timer = 45000; }else Earthbind_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Fathom-Guard Caribdis AI struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI { @@ -562,38 +475,31 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 WaterBoltVolley_Timer; uint32 TidalSurge_Timer; uint32 Heal_Timer; uint32 Cyclone_Timer; - void Reset() { WaterBoltVolley_Timer = 35000; TidalSurge_Timer = 15000+rand()%5000; Heal_Timer = 55000; Cyclone_Timer = 30000+rand()%10000; - if (pInstance) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit *victim) { if (pInstance) { Creature *Karathress = NULL; Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS))); - if (Karathress) if (!m_creature->isAlive() && Karathress) CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); } } - void EnterCombat(Unit *who) { if (pInstance) @@ -602,38 +508,32 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } - //WaterBoltVolley_Timer if (WaterBoltVolley_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_WATER_BOLT_VOLLEY); WaterBoltVolley_Timer = 30000; }else WaterBoltVolley_Timer -= diff; - //TidalSurge_Timer if (TidalSurge_Timer < diff) { @@ -642,7 +542,6 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true); TidalSurge_Timer = 15000+rand()%5000; }else TidalSurge_Timer -= diff; - //Cyclone_Timer if (Cyclone_Timer < diff) { @@ -662,26 +561,21 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI } } }else Cyclone_Timer -= diff; - //Heal_Timer if (Heal_Timer < diff) { // It can be cast on any of the mobs Unit *pUnit = NULL; - while(pUnit == NULL || !pUnit->isAlive()) { pUnit = selectAdvisorUnit(); } - if (pUnit && pUnit->isAlive()) DoCast(pUnit, SPELL_HEAL); Heal_Timer = 60000; }else Heal_Timer -= diff; - DoMeleeAttackIfReady(); } - Unit* selectAdvisorUnit() { Unit* pUnit = NULL; @@ -703,31 +597,25 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI break; } }else pUnit = m_creature; - return pUnit; } }; - CreatureAI* GetAI_boss_fathomlord_karathress(Creature* pCreature) { return new boss_fathomlord_karathressAI (pCreature); } - CreatureAI* GetAI_boss_fathomguard_sharkkis(Creature* pCreature) { return new boss_fathomguard_sharkkisAI (pCreature); } - CreatureAI* GetAI_boss_fathomguard_tidalvess(Creature* pCreature) { return new boss_fathomguard_tidalvessAI (pCreature); } - CreatureAI* GetAI_boss_fathomguard_caribdis(Creature* pCreature) { return new boss_fathomguard_caribdisAI (pCreature); } - void AddSC_boss_fathomlord_karathress() { Script *newscript; @@ -735,17 +623,14 @@ void AddSC_boss_fathomlord_karathress() newscript->Name = "boss_fathomlord_karathress"; newscript->GetAI = &GetAI_boss_fathomlord_karathress; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_fathomguard_sharkkis"; newscript->GetAI = &GetAI_boss_fathomguard_sharkkis; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_fathomguard_tidalvess"; newscript->GetAI = &GetAI_boss_fathomguard_tidalvess; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_fathomguard_caribdis"; newscript->GetAI = &GetAI_boss_fathomguard_caribdis; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp index 288b8cf917e..ba02cd9805d 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hydross_The_Unstable SD%Complete: 90 SDComment: Some details and adjustments left to do, probably nothing major. Spawns may be spawned in different way/location. SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" - #define SAY_AGGRO -1548000 #define SAY_SWITCH_TO_CLEAN -1548001 #define SAY_CLEAN_SLAY1 -1548002 @@ -33,12 +30,9 @@ EndScriptData */ #define SAY_CORRUPT_SLAY1 -1548006 #define SAY_CORRUPT_SLAY2 -1548007 #define SAY_CORRUPT_DEATH -1548008 - #define SWITCH_RADIUS 18 - #define MODEL_CORRUPT 20609 #define MODEL_CLEAN 20162 - #define SPELL_WATER_TOMB 38235 #define SPELL_MARK_OF_HYDROSS1 38215 #define SPELL_MARK_OF_HYDROSS2 38216 @@ -57,14 +51,11 @@ EndScriptData */ #define SPELL_SUMMON_WATER_ELEMENT 36459 //not in use yet(in use ever?) #define SPELL_ELEMENTAL_SPAWNIN 25035 #define SPELL_BLUE_BEAM 40227 //channeled Hydross Beam Helper (not in use yet) - #define ENTRY_PURE_SPAWN 22035 #define ENTRY_TAINTED_SPAWN 22036 #define ENTRY_BEAM_DUMMY 21934 - #define HYDROSS_X -239.439 #define HYDROSS_Y -363.481 - #define SPAWN_X_DIFF1 6.934003 #define SPAWN_Y_DIFF1 -11.255012 #define SPAWN_X_DIFF2 -6.934003 @@ -73,16 +64,13 @@ EndScriptData */ #define SPAWN_Y_DIFF3 -4.72702 #define SPAWN_X_DIFF4 12.577011 #define SPAWN_Y_DIFF4 4.72702 - struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI { boss_hydross_the_unstableAI(Creature *c) : ScriptedAI(c), Summons(m_creature) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint64 beams[2]; uint32 PosCheck_Timer; uint32 MarkOfHydross_Timer; @@ -95,7 +83,6 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI bool CorruptedForm; bool beam; SummonList Summons; - void Reset() { DeSummonBeams(); @@ -109,20 +96,16 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI MarkOfHydross_Count = 0; MarkOfCorruption_Count = 0; EnrageTimer = 600000; - CorruptedForm = false; m_creature->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); - m_creature->SetDisplayId(MODEL_CLEAN); - if (pInstance) pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED); beam = false; Summons.DespawnAll(); } - void SummonBeams() { Creature* beamer = m_creature->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0); @@ -144,7 +127,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI } void DeSummonBeams() { - for(uint8 i=0;i<2; ++i) + for (uint8 i=0; i<2; ++i) { Creature* mob = Unit::GetCreature(*m_creature,beams[i]); if (mob) @@ -157,11 +140,9 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { if (CorruptedForm) @@ -173,7 +154,6 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI DoScriptText(RAND(SAY_CLEAN_SLAY1,SAY_CLEAN_SLAY2), m_creature); } } - void JustSummoned(Creature* summoned) { if (summoned->GetEntry() == ENTRY_PURE_SPAWN) @@ -189,24 +169,20 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI Summons.Summon(summoned); } } - void SummonedCreatureDespawn(Creature *summon) { Summons.Despawn(summon); } - void JustDied(Unit *victim) { if (CorruptedForm) DoScriptText(SAY_CORRUPT_DEATH, m_creature); else DoScriptText(SAY_CLEAN_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, DONE); Summons.DespawnAll(); } - void UpdateAI(const uint32 diff) { if (!beam) @@ -217,7 +193,6 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - // corrupted form if (CorruptedForm) { @@ -227,7 +202,6 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI if (MarkOfCorruption_Count <= 5) { uint32 mark_spell; - switch(MarkOfCorruption_Count) { case 0: mark_spell = SPELL_MARK_OF_CORRUPTION1; break; @@ -237,26 +211,20 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI case 4: mark_spell = SPELL_MARK_OF_CORRUPTION5; break; case 5: mark_spell = SPELL_MARK_OF_CORRUPTION6; break; } - DoCast(m_creature->getVictim(), mark_spell); - if (MarkOfCorruption_Count < 5) MarkOfCorruption_Count++; } - MarkOfCorruption_Timer = 15000; }else MarkOfCorruption_Timer -= diff; - //VileSludge_Timer if (VileSludge_Timer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_VILE_SLUDGE); - VileSludge_Timer = 15000; }else VileSludge_Timer -= diff; - //PosCheck_Timer if (PosCheck_Timer < diff) { @@ -266,22 +234,18 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI m_creature->SetDisplayId(MODEL_CLEAN); CorruptedForm = false; MarkOfHydross_Count = 0; - DoScriptText(SAY_SWITCH_TO_CLEAN, m_creature); DoResetThreat(); SummonBeams(); - // spawn 4 adds DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - m_creature->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); } - PosCheck_Timer = 2500; }else PosCheck_Timer -=diff; } @@ -294,7 +258,6 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI if (MarkOfHydross_Count <= 5) { uint32 mark_spell; - switch(MarkOfHydross_Count) { case 0: mark_spell = SPELL_MARK_OF_HYDROSS1; break; @@ -304,26 +267,20 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI case 4: mark_spell = SPELL_MARK_OF_HYDROSS5; break; case 5: mark_spell = SPELL_MARK_OF_HYDROSS6; break; } - DoCast(m_creature->getVictim(), mark_spell); - if (MarkOfHydross_Count < 5) MarkOfHydross_Count++; } - MarkOfHydross_Timer = 15000; }else MarkOfHydross_Timer -= diff; - //WaterTomb_Timer if (WaterTomb_Timer < diff) { Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (target) DoCast(target, SPELL_WATER_TOMB); - WaterTomb_Timer = 7000; }else WaterTomb_Timer -= diff; - //PosCheck_Timer if (PosCheck_Timer < diff) { @@ -333,33 +290,27 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI m_creature->SetDisplayId(MODEL_CORRUPT); MarkOfCorruption_Count = 0; CorruptedForm = true; - DoScriptText(SAY_SWITCH_TO_CORRUPT, m_creature); DoResetThreat(); DeSummonBeams(); - // spawn 4 adds DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - m_creature->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); } - PosCheck_Timer = 2500; }else PosCheck_Timer -=diff; } - //EnrageTimer if (EnrageTimer < diff) { DoCast(m_creature, SPELL_ENRAGE); EnrageTimer = 60000; }else EnrageTimer -= diff; - DoMeleeAttackIfReady(); } }; @@ -367,7 +318,6 @@ CreatureAI* GetAI_boss_hydross_the_unstable(Creature* pCreature) { return new boss_hydross_the_unstableAI (pCreature); } - void AddSC_boss_hydross_the_unstable() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index 0ee1a68ee0e..efdc19d1cc5 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -13,19 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA */ - /* ScriptData SDName: Boss_Lady_Vashj SD%Complete: 99 SDComment: Missing blizzlike Shield Generators coords SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" #include "simple_ai.h" #include "Spell.h" - #define SAY_INTRO -1548042 #define SAY_AGGRO1 -1548043 #define SAY_AGGRO2 -1548044 @@ -40,7 +37,6 @@ EndScriptData */ #define SAY_SLAY2 -1548053 #define SAY_SLAY3 -1548054 #define SAY_DEATH -1548055 - #define SPELL_SURGE 38044 #define SPELL_MULTI_SHOT 38310 #define SPELL_SHOCK_BLAST 38509 @@ -51,16 +47,13 @@ EndScriptData */ #define SPELL_POISON_BOLT 40095 #define SPELL_TOXIC_SPORES 38575 #define SPELL_MAGIC_BARRIER 38112 - #define MIDDLE_X 30.134 #define MIDDLE_Y -923.65 #define MIDDLE_Z 42.9 - #define SPOREBAT_X 30.977156 #define SPOREBAT_Y -925.297761 #define SPOREBAT_Z 77.176567 #define SPOREBAT_O 5.223932 - #define SHIED_GENERATOR_CHANNEL 19870 #define ENCHANTED_ELEMENTAL 21958 #define TAINTED_ELEMENTAL 22009 @@ -68,10 +61,8 @@ EndScriptData */ #define COILFANG_ELITE 22055 #define TOXIC_SPOREBAT 22140 #define TOXIC_SPORES_TRIGGER 22207 - #define TEXT_NOT_INITIALIZED "Instance script not initialized" #define TEXT_ALREADY_DEACTIVATED "Already deactivated" - float ElementPos[8][4] = { {8.3, -835.3, 21.9, 5}, @@ -83,7 +74,6 @@ float ElementPos[8][4] = {-35, -987.6, 21.5, 0.8}, {-58.9, -901.6, 21.5, 6} }; - float ElementWPPos[8][3] = { {71.700752, -883.905884, 41.097168}, @@ -95,7 +85,6 @@ float ElementWPPos[8][3] = {43.466549, -979.406677, 41.097027}, {69.945908, -964.663940, 41.097054} }; - float SporebatWPPos[8][3] = { {31.6,-896.3,59.1}, @@ -107,21 +96,18 @@ float SporebatWPPos[8][3] = {42.2, -912.4, 51.7}, {27, -905.9, 50} }; - float CoilfangElitePos[3][4] = { {28.84, -923.28, 42.9, 6}, {31.183281, -953.502625, 41.523602, 1.640957}, {58.895180, -923.124268, 41.545307, 3.152848} }; - float CoilfangStriderPos[3][4] = { {66.427010, -948.778503, 41.262245, 2.584220}, {7.513962, -959.538208, 41.300422, 1.034629}, {-12.843201, -907.798401, 41.239620, 6.087094} }; - float ShieldGeneratorChannelPos[4][4] = { {49.6262, -902.181, 43.0975, 3.95683}, @@ -129,7 +115,6 @@ float ShieldGeneratorChannelPos[4][4] = {10.3859, -944.036, 42.5446, 0.779888}, {49.3126, -943.398, 42.5501, 2.40174} }; - //Lady Vashj AI struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { @@ -140,11 +125,8 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI JustCreated = true; c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on Creature create (no need do intro if wiped) } - ScriptedInstance *pInstance; - uint64 ShieldGeneratorChannel[4]; - uint32 AggroTimer; uint32 ShockBlast_Timer; uint32 Entangle_Timer; @@ -159,12 +141,10 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI uint32 SummonSporebat_StaticTimer; uint8 EnchantedElemental_Pos; uint8 Phase; - bool Entangle; bool Intro; bool CanAttack; bool JustCreated; - void Reset() { AggroTimer = 19000; @@ -181,32 +161,27 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI SummonSporebat_StaticTimer = 30000; EnchantedElemental_Pos = 0; Phase = 0; - Entangle = false; if (JustCreated) { CanAttack = false; JustCreated = false; }else CanAttack = true; - Unit *remo; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { remo = Unit::GetUnit(*m_creature, ShieldGeneratorChannel[i]); if (remo) remo->setDeathState(JUST_DIED); } - if (pInstance) pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); ShieldGeneratorChannel[0] = 0; ShieldGeneratorChannel[1] = 0; ShieldGeneratorChannel[2] = 0; ShieldGeneratorChannel[3] = 0; - m_creature->SetCorpseDelay(1000*60*60); } - //Called when a tainted elemental dies void EventTaintedElementalDeath() { @@ -218,25 +193,19 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_LADYVASHJEVENT, DONE); } - void StartEvent() { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3,SAY_AGGRO4), m_creature); - Phase = 1; - if (pInstance) pInstance->SetData(DATA_LADYVASHJEVENT, IN_PROGRESS); } - void EnterCombat(Unit *who) { if (pInstance) @@ -244,7 +213,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI //remove old tainted cores to prevent cheating in phase 2 Map* pMap = m_creature->GetMap(); Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin();i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* i_pl = i->getSource()) { @@ -253,11 +222,9 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI } } StartEvent();//this is EnterCombat(), so were are 100% in combat, start the event - if (Phase != 2) AttackStart(who); } - void MoveInLineOfSight(Unit *who) { if (!Intro) @@ -269,7 +236,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI return; if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { float attackRadius = m_creature->GetAttackDistance(who); @@ -277,16 +243,13 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { //if (who->HasStealthAura()) // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - - if (!m_creature->isInCombat())//AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking + if (!m_creature->isInCombat()) //AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking StartEvent(); - if (Phase != 2) AttackStart(who); } } } - void CastShootOrMultishot() { switch(rand()%2) @@ -307,7 +270,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI DoScriptText(RAND(SAY_BOWSHOT1,SAY_BOWSHOT2), m_creature); } } - void UpdateAI(const uint32 diff) { if (!CanAttack && Intro) @@ -332,7 +294,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - if (Phase == 1 || Phase == 3) { //ShockBlast_Timer @@ -342,10 +303,8 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. DoCast(m_creature->getVictim(), SPELL_SHOCK_BLAST); m_creature->TauntApply(m_creature->getVictim()); - ShockBlast_Timer = 1000+rand()%14000; //random cooldown }else ShockBlast_Timer -= diff; - //StaticCharge_Timer if (StaticCharge_Timer < diff) { @@ -353,14 +312,11 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. Unit *target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); - if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) //cast Static Charge every 2 seconds for 20 seconds DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); - StaticCharge_Timer = 10000+rand()%20000; //blizzlike }else StaticCharge_Timer -= diff; - //Entangle_Timer if (Entangle_Timer < diff) { @@ -379,7 +335,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI Entangle_Timer = 20000+rand()%5000; } }else Entangle_Timer -= diff; - //Phase 1 if (Phase == 1) { @@ -388,12 +343,10 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. Phase = 2; - m_creature->GetMotionMaster()->Clear(); DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - Creature *pCreature; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { pCreature = m_creature->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); if (pCreature) @@ -410,7 +363,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { Creature *Sporebat = NULL; Sporebat = m_creature->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Sporebat) { Unit *target = NULL; @@ -418,29 +370,23 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI if (target) Sporebat->AI()->AttackStart(target); } - //summon sporebats faster and faster if (SummonSporebat_StaticTimer > 1000) SummonSporebat_StaticTimer -= 1000; - SummonSporebat_Timer = SummonSporebat_StaticTimer; - if (SummonSporebat_Timer < 5000) SummonSporebat_Timer = 5000; - }else SummonSporebat_Timer -= diff; } - //Melee attack DoMeleeAttackIfReady(); - //Check_Timer - used to check if somebody is in melee range if (Check_Timer < diff) { bool InMeleeRange = false; Unit *target; std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //if in melee range @@ -450,11 +396,9 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI break; } } - //if nobody is in melee range if (!InMeleeRange) CastShootOrMultishot(); - Check_Timer = 5000; }else Check_Timer -= diff; } @@ -468,39 +412,30 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!target) target = m_creature->getVictim(); - DoCast(target, SPELL_FORKED_LIGHTNING); - ForkedLightning_Timer = 2000+rand()%6000; //blizzlike }else ForkedLightning_Timer -= diff; - //EnchantedElemental_Timer if (EnchantedElemental_Timer < diff) { Creature *Elemental; Elemental = m_creature->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (EnchantedElemental_Pos == 7) EnchantedElemental_Pos = 0; else EnchantedElemental_Pos++; - EnchantedElemental_Timer = 10000+rand()%5000; }else EnchantedElemental_Timer -= diff; - //TaintedElemental_Timer if (TaintedElemental_Timer < diff) { Creature *Tain_Elemental; uint32 pos = rand()%8; Tain_Elemental = m_creature->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0); - TaintedElemental_Timer = 120000; }else TaintedElemental_Timer -= diff; - //CoilfangElite_Timer if (CoilfangElite_Timer < diff) { @@ -518,7 +453,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI } CoilfangElite_Timer = 45000+rand()%5000; }else CoilfangElite_Timer -= diff; - //CoilfangStrider_Timer if (CoilfangStrider_Timer < diff) { @@ -536,7 +470,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI } CoilfangStrider_Timer = 60000+rand()%10000; }else CoilfangStrider_Timer -= diff; - //Check_Timer if (Check_Timer < diff) { @@ -545,13 +478,9 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { //set life 50% m_creature->SetHealth(m_creature->GetMaxHealth()/2); - m_creature->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); - DoScriptText(SAY_PHASE3, m_creature); - Phase = 3; - //return to the tank m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } @@ -560,7 +489,6 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI } } }; - //Enchanted Elemental //If one of them reaches Vashj he will increase her damage done by 5%. struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI @@ -569,13 +497,11 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 move; uint32 phase; float x, y, z; Creature *Vashj; - void Reset() { m_creature->SetSpeed(MOVE_WALK,0.6);//walk @@ -583,8 +509,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI move = 0; phase = 1; Vashj = NULL; - - for (int i = 0;i<8; ++i)//search for nearest waypoint (up on stairs) + for (int i = 0; i<8; ++i) //search for nearest waypoint (up on stairs) { if (!x || !y || !z) { @@ -605,21 +530,16 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI if (pInstance) Vashj = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); } - void EnterCombat(Unit *who) { return; } - void MoveInLineOfSight(Unit *who){return;} - void UpdateAI(const uint32 diff) { if (!pInstance) return; - if (!Vashj) { return; } - if (move < diff) { m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); @@ -661,7 +581,6 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI } else move -= diff; } }; - //Tainted Elemental //This mob has 7,900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3,000 nature damage and placing a posion doing 2,000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI @@ -670,35 +589,28 @@ struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 PoisonBolt_Timer; uint32 Despawn_Timer; - void Reset() { PoisonBolt_Timer = 5000+rand()%5000; Despawn_Timer = 30000; } - void JustDied(Unit *killer) { if (pInstance) { Creature *Vashj = NULL; Vashj = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ))); - if (Vashj) CAST_AI(boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath(); } } - void EnterCombat(Unit *who) { m_creature->AddThreat(who, 0.1f); } - void UpdateAI(const uint32 diff) { //PoisonBolt_Timer @@ -706,25 +618,20 @@ struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (target && target->IsWithinDistInMap(m_creature, 30)) DoCast(target, SPELL_POISON_BOLT); - PoisonBolt_Timer = 5000+rand()%5000; }else PoisonBolt_Timer -= diff; - //Despawn_Timer if (Despawn_Timer < diff) { //call Unsummon() m_creature->setDeathState(DEAD); - //to prevent crashes Despawn_Timer = 1000; }else Despawn_Timer -= diff; } }; - //Toxic Sporebat //Toxic Spores: Used in Phase 3 by the Spore Bats, it creates a contaminated green patch of ground, dealing about 2775-3225 nature damage every second to anyone who stands in it. struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI @@ -734,14 +641,11 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI pInstance = c->GetInstanceData(); EnterEvadeMode(); } - ScriptedInstance *pInstance; - uint32 movement_timer; uint32 ToxicSpore_Timer; uint32 bolt_timer; uint32 Check_Timer; - void Reset() { m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); @@ -751,26 +655,19 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI bolt_timer = 5500; Check_Timer = 1000; } - void EnterCombat(Unit *who) { - } - void MoveInLineOfSight(Unit *who) { - } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == 1) movement_timer = 0; } - void UpdateAI (const uint32 diff) { //Random movement @@ -780,7 +677,6 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); movement_timer = 6000; }else movement_timer -= diff; - //toxic spores if (bolt_timer < diff) { @@ -798,7 +694,6 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI bolt_timer = 10000+rand()%5000; } else bolt_timer -= diff; - //Check_Timer if (Check_Timer < diff) { @@ -815,57 +710,45 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI m_creature->setFaction(35); } } - Check_Timer = 1000; }else Check_Timer -= diff; } }; - //Coilfang Elite //It's an elite Naga mob with 170,000 HP. It does about 5000 damage on plate, and has a nasty cleave hitting for about 7500 damage CreatureAI* GetAI_mob_coilfang_elite(Creature* pCreature) { SimpleAI* ai = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = 31345; //Cleave ai->Spell[0].Cooldown = 15000; ai->Spell[0].CooldownRandomAddition = 5000; ai->Spell[0].First_Cast = 5000; ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; - ai->EnterEvadeMode(); - return ai; } - //Coilfang Strider //It hits plate for about 8000 damage, has a Mind Blast spell doing about 3000 shadow damage, and a Psychic Scream Aura, which fears everybody in a 8 yard range of it every 2-3 seconds , for 5 seconds and increasing their movement speed by 150% during the fear. CreatureAI* GetAI_mob_coilfang_strider(Creature* pCreature) { SimpleAI* ai = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = 41374; //Mind Blast ai->Spell[0].Cooldown = 30000; ai->Spell[0].CooldownRandomAddition = 10000; ai->Spell[0].First_Cast = 8000; ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - //Scream aura not implemented - ai->EnterEvadeMode(); - return ai; } - struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI { mob_shield_generator_channelAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; uint32 Check_Timer; bool Casted; @@ -874,24 +757,18 @@ struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI Check_Timer = 0; Casted = false; m_creature->SetDisplayId(11686); //invisible - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) { return; } - void MoveInLineOfSight(Unit *who) { return; } - void UpdateAI (const uint32 diff) { if (!pInstance) return; - if (Check_Timer < diff) { Unit *Vashj = NULL; Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); - if (Vashj && Vashj->isAlive()) { //start visual channel @@ -905,17 +782,14 @@ struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI }else Check_Timer -= diff; } }; - bool ItemUse_item_tainted_core(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { ScriptedInstance *pInstance = pPlayer->GetInstanceData(); - if (!pInstance) { pPlayer->GetSession()->SendNotification(TEXT_NOT_INITIALIZED); return true; } - Creature *Vashj = NULL; Vashj = (Unit::GetCreature((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ))); if (Vashj && CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase == 2) @@ -945,13 +819,11 @@ bool ItemUse_item_tainted_core(Player* pPlayer, Item* _Item, SpellCastTargets co default: return true; } - if (pInstance->GetData(identifier)) { pPlayer->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED); return true; } - //get and remove channel Unit *Channel = NULL; Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]); @@ -960,9 +832,7 @@ bool ItemUse_item_tainted_core(Player* pPlayer, Item* _Item, SpellCastTargets co //call Unsummon() Channel->setDeathState(JUST_DIED); } - pInstance->SetData(identifier, 1); - //remove this item pPlayer->DestroyItemCount(31088, 1, true); return true; @@ -978,32 +848,26 @@ bool ItemUse_item_tainted_core(Player* pPlayer, Item* _Item, SpellCastTargets co } return true; } - CreatureAI* GetAI_boss_lady_vashj(Creature* pCreature) { return new boss_lady_vashjAI (pCreature); } - CreatureAI* GetAI_mob_enchanted_elemental(Creature* pCreature) { return new mob_enchanted_elementalAI (pCreature); } - CreatureAI* GetAI_mob_tainted_elemental(Creature* pCreature) { return new mob_tainted_elementalAI (pCreature); } - CreatureAI* GetAI_mob_toxic_sporebat(Creature* pCreature) { return new mob_toxic_sporebatAI (pCreature); } - CreatureAI* GetAI_mob_shield_generator_channel(Creature* pCreature) { return new mob_shield_generator_channelAI (pCreature); } - void AddSC_boss_lady_vashj() { Script *newscript; @@ -1011,37 +875,30 @@ void AddSC_boss_lady_vashj() newscript->Name = "boss_lady_vashj"; newscript->GetAI = &GetAI_boss_lady_vashj; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_enchanted_elemental"; newscript->GetAI = &GetAI_mob_enchanted_elemental; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_tainted_elemental"; newscript->GetAI = &GetAI_mob_tainted_elemental; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_toxic_sporebat"; newscript->GetAI = &GetAI_mob_toxic_sporebat; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_coilfang_elite"; newscript->GetAI = &GetAI_mob_coilfang_elite; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_coilfang_strider"; newscript->GetAI = &GetAI_mob_coilfang_strider; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shield_generator_channel"; newscript->GetAI = &GetAI_mob_shield_generator_channel; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_tainted_core"; newscript->pItemUse = &ItemUse_item_tainted_core; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index f57f0542bdf..cf3657439c4 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -13,45 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Leotheras_The_Blind SD%Complete: 80 SDComment: Possesion Support SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" - // --- Spells used by Leotheras The Blind #define SPELL_WHIRLWIND 37640 #define SPELL_CHAOS_BLAST 37674 #define SPELL_BERSERK 26662 #define SPELL_INSIDIOUS_WHISPER 37676 #define SPELL_DUAL_WIELD 42459 - // --- Spells used in banish phase --- #define BANISH_BEAM 38909 #define AURA_BANISH 37833 - // --- Spells used by Greyheart Spellbinders #define SPELL_EARTHSHOCK 39076 #define SPELL_MINDBLAST 37531 - // --- Spells used by Inner Demons and Creature ID #define INNER_DEMON_ID 21857 #define AURA_DEMONIC_ALIGNMENT 37713 #define SPELL_SHADOWBOLT 39309 #define SPELL_SOUL_LINK 38007 #define SPELL_CONSUMING_MADNESS 37749 //not supported by core yet - //Misc. #define MODEL_DEMON 20125 #define MODEL_NIGHTELF 20514 #define DEMON_FORM 21875 #define MOB_SPELLBINDER 21806 - #define SAY_AGGRO -1548009 #define SAY_SWITCH_TO_DEMON -1548010 #define SAY_INNER_DEMONS -1548011 @@ -64,19 +56,15 @@ EndScriptData */ #define SAY_FINAL_FORM -1548018 #define SAY_FREE -1548019 #define SAY_DEATH -1548020 - struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI { mob_inner_demonAI(Creature *c) : ScriptedAI(c) { victimGUID = 0; } - uint32 ShadowBolt_Timer; - uint32 Link_Timer; uint64 victimGUID; - void Reset() { ShadowBolt_Timer = 10000; @@ -88,7 +76,6 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER)) pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetGUID() != victimGUID && done_by->GetGUID() != m_creature->GetGUID()) @@ -97,18 +84,15 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI DoModifyThreatPercent(done_by, -100); } } - void EnterCombat(Unit *who) { if (!victimGUID) return; } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (m_creature->getVictim()->GetGUID() != victimGUID) { DoModifyThreatPercent(m_creature->getVictim(), -100); @@ -123,23 +107,19 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI return; } } - if (Link_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SOUL_LINK, true); Link_Timer = 1000; }else Link_Timer -= diff; - if (!m_creature->HasAura(AURA_DEMONIC_ALIGNMENT)) DoCast(m_creature, AURA_DEMONIC_ALIGNMENT,true); - if (ShadowBolt_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWBOLT, false); ShadowBolt_Timer = 10000; }else ShadowBolt_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -151,13 +131,10 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI c->GetPosition(x,y,z); pInstance = c->GetInstanceData(); Demon = 0; - - for(uint8 i = 0; i < 3; ++i)//clear guids + for (uint8 i = 0; i < 3; ++i) //clear guids SpellBinderGUID[i] = 0; } - ScriptedInstance *pInstance; - uint32 Whirlwind_Timer; uint32 ChaosBlast_Timer; uint32 SwitchToDemon_Timer; @@ -165,19 +142,16 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI uint32 Berserk_Timer; uint32 InnerDemons_Timer; uint32 BanishTimer; - bool DealDamage; bool NeedThreatReset; bool DemonForm; bool IsFinalForm; bool EnrageUsed; float x,y,z; - uint64 InnderDemon[5]; uint32 InnderDemon_Count; uint64 Demon; uint64 SpellBinderGUID[3]; - void Reset() { CheckChannelers(); @@ -204,14 +178,12 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, NOT_STARTED); } - void CheckChannelers(bool DoEvade = true) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { if (Creature *add = Unit::GetCreature(*m_creature,SpellBinderGUID[i])) add->DisappearAndDie(); - float nx = x; float ny = y; float o = 2.4f; @@ -221,19 +193,16 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI Creature* binder = m_creature->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0); if (binder) SpellBinderGUID[i] = binder->GetGUID(); - } } void MoveInLineOfSight(Unit *who) { if (m_creature->HasAura(AURA_BANISH)) return; - if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) { if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius)) { @@ -245,39 +214,32 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI } } } - void StartEvent() { DoScriptText(SAY_AGGRO, m_creature); if (pInstance) pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, IN_PROGRESS); } - void CheckBanish() { uint8 AliveChannelers = 0; - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Unit *add = Unit::GetUnit(*m_creature,SpellBinderGUID[i]); if (add && add->isAlive()) AliveChannelers++; } - // channelers == 0 remove banish aura if (AliveChannelers == 0 && m_creature->HasAura(AURA_BANISH)) { // removing banish aura m_creature->RemoveAurasDueToSpell(AURA_BANISH); - // Leotheras is getting immune again m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); - // changing model to bloodelf m_creature->SetDisplayId(MODEL_NIGHTELF); - // and reseting equipment m_creature->LoadEquipment(m_creature->GetEquipmentId()); - if (pInstance && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { Unit *victim = NULL; @@ -293,20 +255,17 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI // removing Leotheras banish immune to apply AURA_BANISH m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); DoCast(m_creature, AURA_BANISH); - // changing model m_creature->SetDisplayId(MODEL_DEMON); - // and removing weapons m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); } } - //Despawn all Inner Demon summoned void DespawnDemon() { - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) { if (InnderDemon[i]) { @@ -319,13 +278,11 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI InnderDemon[i] = 0; } } - InnderDemon_Count = 0; } - void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core { - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) { if (InnderDemon[i] > 0) { @@ -342,12 +299,10 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) { if (victim->GetTypeId() != TYPEID_PLAYER) return; - if (DemonForm) { DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), m_creature); @@ -357,11 +312,9 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI DoScriptText(RAND(SAY_NIGHTELF_SLAY1,SAY_NIGHTELF_SLAY2,SAY_NIGHTELF_SLAY3), m_creature); } } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - //despawn copy if (Demon) { @@ -371,15 +324,12 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE); } - void EnterCombat(Unit *who) { if (m_creature->HasAura(AURA_BANISH)) return; - m_creature->LoadEquipment(m_creature->GetEquipmentId()); } - void UpdateAI(const uint32 diff) { //Return since we have no target @@ -404,7 +354,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI } Whirlwind_Timer = 2000; }else Whirlwind_Timer -= diff; - // reseting after changing forms and after ending whirlwind if (NeedThreatReset && !m_creature->HasAura(SPELL_WHIRLWIND)) { @@ -413,13 +362,11 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI InnerDemons_Timer = 30000; else Whirlwind_Timer = 15000; - NeedThreatReset = false; DoResetThreat(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } - //Enrage_Timer (10 min) if (Berserk_Timer < diff && !EnrageUsed) { @@ -427,7 +374,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI DoCast(m_creature, SPELL_BERSERK); EnrageUsed = true; }else Berserk_Timer -= diff; - if (!DemonForm) { //Whirldind Timer @@ -442,7 +388,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI }else Whirlwind_Timer -= diff; } //Switch_Timer - if (!IsFinalForm) if (SwitchToDemon_Timer < diff) { @@ -481,14 +426,14 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { std::list& ThreatList = m_creature->getThreatManager().getThreatList(); std::vector TargetList; - for(std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + for (std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) TargetList.push_back(tempTarget); } SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); - for(std::vector::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + for (std::vector::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) { if ((*itr) && (*itr)->isAlive()) { @@ -497,7 +442,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { demon->AI()->AttackStart((*itr)); CAST_AI(mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID(); - uint8 eff_mask=0; for (int i=0; i<3; ++i) { @@ -507,37 +451,29 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI } (*itr)->AddAura(new Aura(spell, eff_mask, *itr, *itr, *itr)); if (InnderDemon_Count > 4) InnderDemon_Count = 0; - //Safe storing of creatures InnderDemon[InnderDemon_Count] = demon->GetGUID(); - //Update demon count InnderDemon_Count++; } } } DoScriptText(SAY_INNER_DEMONS, m_creature); - InnerDemons_Timer = 999999; }else InnerDemons_Timer -= diff; - //Switch_Timer if (SwitchToHuman_Timer < diff) { //switch to nightelf form m_creature->SetDisplayId(MODEL_NIGHTELF); m_creature->LoadEquipment(m_creature->GetEquipmentId()); - CastConsumingMadness(); DespawnDemon(); - DemonForm = false; NeedThreatReset = true; - SwitchToHuman_Timer = 60000; }else SwitchToHuman_Timer -= diff; } - if (!IsFinalForm && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 15) { //at this point he divides himself in two parts @@ -554,52 +490,42 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI //set nightelf final form IsFinalForm = true; DemonForm = false; - DoScriptText(SAY_FINAL_FORM, m_creature); m_creature->SetDisplayId(MODEL_NIGHTELF); m_creature->LoadEquipment(m_creature->GetEquipmentId()); } } }; - //Leotheras the Blind Demon Form AI struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI { boss_leotheras_the_blind_demonformAI(Creature *c) : ScriptedAI(c) {} - uint32 ChaosBlast_Timer; bool DealDamage; - void Reset() { ChaosBlast_Timer = 1000; DealDamage = true; } - void StartEvent() { DoScriptText(SAY_FREE, m_creature); } - void KilledUnit(Unit *victim) { if (victim->GetTypeId() != TYPEID_PLAYER) return; - DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), m_creature); } - void JustDied(Unit *victim) { //invisibility (blizzlike, at the end of the fight he doesn't die, he disappears) m_creature->CastSpell(m_creature, 8149, true); } - void EnterCombat(Unit *who) { StartEvent(); } - void UpdateAI(const uint32 diff) { //Return since we have no target @@ -608,7 +534,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI //ChaosBlast_Timer if (m_creature->IsWithinDist(m_creature->getVictim(), 30)) m_creature->StopMoving(); - if (ChaosBlast_Timer < diff) { // will cast only when in range od spell @@ -620,7 +545,6 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI ChaosBlast_Timer = 3000; } }else ChaosBlast_Timer -= diff; - //Do NOT deal any melee damage to the target. } }; @@ -632,21 +556,15 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI leotherasGUID = 0; AddedBanish = false; } - ScriptedInstance *pInstance; - uint64 leotherasGUID; - uint32 Mindblast_Timer; uint32 Earthshock_Timer; - bool AddedBanish; - void Reset() { Mindblast_Timer = 3000 + rand()%5000; Earthshock_Timer = 5000 + rand()%5000; - if (pInstance) { pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); @@ -655,20 +573,17 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI CAST_AI(boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(false); } } - void EnterCombat(Unit *who) { m_creature->InterruptNonMeleeSpells(false); if (pInstance) pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); } - void JustRespawned() { AddedBanish = false; Reset(); } - void CastChanneling() { if (!m_creature->isInCombat() && !m_creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) @@ -681,14 +596,12 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (pInstance) { if (!leotherasGUID) leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS); - if (!m_creature->isInCombat() && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { Unit *victim = NULL; @@ -697,42 +610,35 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI AttackStart(victim); } } - if (!UpdateVictim()) { CastChanneling(); return; } - if (pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { EnterEvadeMode(); return; } - if (Mindblast_Timer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target)DoCast(target, SPELL_MINDBLAST); - Mindblast_Timer = 10000 + rand()%5000; }else Mindblast_Timer -= diff; - if (Earthshock_Timer < diff) { Map* pMap = m_creature->GetMap(); Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator itr = PlayerList.begin();itr != PlayerList.end(); ++itr) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* i_pl = itr->getSource()) { bool isCasting = false; - for(uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) + for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) if (i_pl->GetCurrentSpell(i)) isCasting = true; - if (isCasting) { DoCast(i_pl, SPELL_EARTHSHOCK); @@ -744,24 +650,20 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI }else Earthshock_Timer -= diff; DoMeleeAttackIfReady(); } - void JustDied(Unit *killer) {} }; CreatureAI* GetAI_boss_leotheras_the_blind(Creature* pCreature) { return new boss_leotheras_the_blindAI (pCreature); } - CreatureAI* GetAI_boss_leotheras_the_blind_demonform(Creature* pCreature) { return new boss_leotheras_the_blind_demonformAI (pCreature); } - CreatureAI* GetAI_mob_greyheart_spellbinder(Creature* pCreature) { return new mob_greyheart_spellbinderAI (pCreature); } - CreatureAI* GetAI_mob_inner_demon(Creature* pCreature) { return new mob_inner_demonAI (pCreature); @@ -769,22 +671,18 @@ CreatureAI* GetAI_mob_inner_demon(Creature* pCreature) void AddSC_boss_leotheras_the_blind() { Script *newscript; - newscript = new Script; newscript->Name = "boss_leotheras_the_blind"; newscript->GetAI = &GetAI_boss_leotheras_the_blind; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_leotheras_the_blind_demonform"; newscript->GetAI = &GetAI_boss_leotheras_the_blind_demonform; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_greyheart_spellbinder"; newscript->GetAI = &GetAI_mob_greyheart_spellbinder; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_inner_demon"; newscript->GetAI = &GetAI_mob_inner_demon; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp index 1146cf96b24..a9fbf6a2506 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp @@ -13,19 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_the_lurker_below SD%Complete: 80 SDComment: Coilfang Frenzy, find out how could we fishing in the strangepool SDCategory: The Lurker Below EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" #include "simple_ai.h" #include "Spell.h" - #define SPELL_SPOUT 37433 #define SPELL_SPOUT_ANIM 42835 #define SPELL_SPOUT_BREATH 37431 @@ -35,22 +32,16 @@ EndScriptData */ #define SPELL_WATERBOLT 37138 #define SPELL_SUBMERGE 37550 #define SPELL_EMERGE 20568 - #define EMOTE_SPOUT "The Lurker Below takes a deep breath." - #define SPOUT_DIST 100 - #define MOB_COILFANG_GUARDIAN 21873 #define MOB_COILFANG_AMBUSHER 21865 - //Ambusher spells #define SPELL_SPREAD_SHOT 37790 #define SPELL_SHOOT 37770 - //Guardian spells #define SPELL_ARCINGSMASH 38761 // Wrong SpellId. Can't find the right one. #define SPELL_HAMSTRING 26211 - float AddPos[9][3] = { {2.8553810, -459.823914, -19.182686}, //MOVE_AMBUSHER_1 X, Y, Z @@ -63,7 +54,6 @@ float AddPos[9][3] = {14.388216, -423.468018, -19.625271}, //MOVE_GUARDIAN_2 X, Y, Z {42.471519, -445.115295, -19.769423} //MOVE_GUARDIAN_3 X, Y, Z }; - struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI { boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature) @@ -77,10 +67,8 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI TempSpell->Effect[2] = 0; } } - ScriptedInstance* pInstance; SummonList Summons; - bool Spawned; bool Submerged; bool InRange; @@ -95,8 +83,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI uint32 CheckTimer; uint32 WaitTimer; uint32 WaitTimer2; - - bool CheckCanStart()//check if players fished + bool CheckCanStart() //check if players fished { if(pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED) return false; @@ -115,14 +102,11 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI CheckTimer = 15000;//give time to get in range when fight starts WaitTimer = 60000;//never reached WaitTimer2 = 60000;//never reached - Submerged = true;//will be false at combat start Spawned = false; InRange = false; CanStartEvent = false; - Summons.DespawnAll(); - if (pInstance) { pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); @@ -133,25 +117,21 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); - Summons.DespawnAll(); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); Scripted_NoMovementAI::EnterCombat(who); } - void MoveInLineOfSight(Unit *who) { - if(!CanStartEvent)//boss is invisible, don't attack + if(!CanStartEvent) //boss is invisible, don't attack return; if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who))) { @@ -162,16 +142,14 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI } } } - void MovementInform(uint32 type, uint32 id) { if(type == ROTATE_MOTION_TYPE) me->SetReactState(REACT_AGGRESSIVE); } - void UpdateAI(const uint32 diff) { - if(!CanStartEvent)//boss is invisible, don't attack + if(!CanStartEvent) //boss is invisible, don't attack { if(CheckCanStart()) { @@ -181,7 +159,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI Submerged = false; WaitTimer2 = 500; } - if(!Submerged && WaitTimer2 < diff)//wait 500ms before emerge anim + if(!Submerged && WaitTimer2 < diff) //wait 500ms before emerge anim { m_creature->RemoveAllAuras(); m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); @@ -189,8 +167,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI WaitTimer2 = 60000;//never reached WaitTimer = 3000; }else WaitTimer2 -= diff; - - if(WaitTimer < diff)//wait 3secs for emerge anim, then attack + if(WaitTimer < diff) //wait 3secs for emerge anim, then attack { WaitTimer = 3000; CanStartEvent=true;//fresh fished from pool @@ -201,9 +178,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI return; } - - - if(m_creature->getThreatManager().getThreatList().empty())//check if should evade + if(m_creature->getThreatManager().getThreatList().empty()) //check if should evade { if(m_creature->isInCombat()) EnterEvadeMode(); @@ -218,7 +193,6 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI PhaseTimer = 60000;//60secs submerged Submerged = true; }else PhaseTimer-=diff; - if (SpoutTimer < diff) { m_creature->MonsterTextEmote(EMOTE_SPOUT,0,true); @@ -229,15 +203,13 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI RotTimer = 20000; return; }else SpoutTimer -= diff; - //Whirl directly after a Spout and at random times if (WhirlTimer < diff) { WhirlTimer = 18000; DoCast(m_creature,SPELL_WHIRL); }else WhirlTimer -= diff; - - if(CheckTimer < diff)//check if there are players in melee range + if(CheckTimer < diff) //check if there are players in melee range { InRange = false; Map* pMap = m_creature->GetMap(); @@ -252,7 +224,6 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI } CheckTimer = 2000; }else CheckTimer -= diff; - if(RotTimer) { Map* pMap = m_creature->GetMap(); @@ -265,20 +236,17 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI DoCast(i->getSource(),SPELL_SPOUT,true);//only knock back palyers in arc, in 100yards, not in water } } - if(SpoutAnimTimer < diff) { DoCast(m_creature,SPELL_SPOUT_ANIM,true); SpoutAnimTimer = 1000; }else SpoutAnimTimer -= diff; - if(RotTimer < diff) { RotTimer = 0; }else RotTimer -= diff; return; } - if (GeyserTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1); @@ -288,8 +256,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI DoCast(target,SPELL_GEYSER,true); GeyserTimer = rand()%5000 + 15000; }else GeyserTimer -= diff; - - if(!InRange)//if on players in melee range cast Waterbolt + if(!InRange) //if on players in melee range cast Waterbolt { if (WaterboltTimer < diff) { @@ -301,12 +268,9 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI WaterboltTimer = 3000; }else WaterboltTimer -= diff; } - if (!UpdateCombatState()) return; - DoMeleeAttackIfReady(); - }else//submerged { if (PhaseTimer < diff) @@ -322,15 +286,13 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI PhaseTimer = 120000; return; }else PhaseTimer-=diff; - - if(m_creature->getThreatManager().getThreatList().empty())//check if should evade + if(m_creature->getThreatManager().getThreatList().empty()) //check if should evade { EnterEvadeMode(); return; } if (!m_creature->isInCombat()) DoZoneInCombat(); - if (!Spawned) { m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); @@ -341,7 +303,6 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI if (i < 6) Summoned = m_creature->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); else Summoned = m_creature->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Summoned) Summons.Summon(Summoned); } @@ -350,26 +311,21 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI } } }; - CreatureAI* GetAI_mob_coilfang_guardian(Creature* pCreature) { SimpleAI* ai = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = SPELL_ARCINGSMASH; ai->Spell[0].Cooldown = 15000; ai->Spell[0].First_Cast = 5000; ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->Spell[1].Enabled = true; ai->Spell[1].Spell_Id = SPELL_HAMSTRING; ai->Spell[1].Cooldown = 10000; ai->Spell[1].First_Cast = 2000; ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - return ai; } - struct TRINITY_DLL_DECL mob_coilfang_ambusherAI : public Scripted_NoMovementAI { mob_coilfang_ambusherAI(Creature *c) : Scripted_NoMovementAI(c) @@ -378,43 +334,33 @@ struct TRINITY_DLL_DECL mob_coilfang_ambusherAI : public Scripted_NoMovementAI if (TempSpell) TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg } - uint32 MultiShotTimer; uint32 ShootBowTimer; - void Reset() { MultiShotTimer = 10000; ShootBowTimer = 4000; - } - void EnterCombat(Unit *who) { - } - void MoveInLineOfSight(Unit *who) { if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who) && m_creature->IsWithinDistInMap(who, 45)) { AttackStart(who); } } - void UpdateAI(const uint32 diff) { if (MultiShotTimer < diff) { if (m_creature->getVictim()) DoCast(m_creature->getVictim(), SPELL_SPREAD_SHOT, true); - MultiShotTimer = 10000+rand()%10000; ShootBowTimer += 1500;//add global cooldown }else MultiShotTimer -= diff; - if (ShootBowTimer < diff) { Unit* target = NULL; @@ -427,17 +373,14 @@ struct TRINITY_DLL_DECL mob_coilfang_ambusherAI : public Scripted_NoMovementAI }else ShootBowTimer -= diff; } }; - CreatureAI* GetAI_mob_coilfang_ambusher(Creature* pCreature) { return new mob_coilfang_ambusherAI (pCreature); } - CreatureAI* GetAI_boss_the_lurker_below(Creature* pCreature) { return new boss_the_lurker_belowAI (pCreature); } - void AddSC_boss_the_lurker_below() { Script *newscript; @@ -445,16 +388,13 @@ void AddSC_boss_the_lurker_below() newscript->Name = "boss_the_lurker_below"; newscript->GetAI = &GetAI_boss_the_lurker_below; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_coilfang_guardian"; newscript->GetAI = &GetAI_mob_coilfang_guardian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_coilfang_ambusher"; newscript->GetAI = &GetAI_mob_coilfang_ambusher; newscript->RegisterSelf(); } - diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp index b624f5ba827..5715ef78e6c 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Morogrim_Tidewalker SD%Complete: 90 SDComment: Water globules don't explode properly, remove hacks SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" - #define SAY_AGGRO -1548030 #define SAY_SUMMON1 -1548031 #define SAY_SUMMON2 -1548032 @@ -36,12 +33,10 @@ EndScriptData */ #define EMOTE_WATERY_GRAVE -1548039 #define EMOTE_EARTHQUAKE -1548040 #define EMOTE_WATERY_GLOBULES -1548041 - #define SPELL_TIDAL_WAVE 37730 #define SPELL_WATERY_GRAVE 38049 #define SPELL_EARTHQUAKE 37764 #define SPELL_WATERY_GRAVE_EXPLOSION 37852 - #define WATERY_GRAVE_X1 334.64 #define WATERY_GRAVE_Y1 -728.89 #define WATERY_GRAVE_Z1 -14.42 @@ -54,29 +49,24 @@ EndScriptData */ #define WATERY_GRAVE_X4 372.93 #define WATERY_GRAVE_Y4 -690.96 #define WATERY_GRAVE_Z4 -14.44 - #define SPELL_WATERY_GRAVE_1 38023 #define SPELL_WATERY_GRAVE_2 38024 #define SPELL_WATERY_GRAVE_3 38025 #define SPELL_WATERY_GRAVE_4 37850 - #define SPELL_SUMMON_WATER_GLOBULE_1 37854 #define SPELL_SUMMON_WATER_GLOBULE_2 37858 #define SPELL_SUMMON_WATER_GLOBULE_3 37860 #define SPELL_SUMMON_WATER_GLOBULE_4 37861 - /*#define SPELL_SUMMON_MURLOC_A6 39813 #define SPELL_SUMMON_MURLOC_A7 39814 #define SPELL_SUMMON_MURLOC_A8 39815 #define SPELL_SUMMON_MURLOC_A9 39816 #define SPELL_SUMMON_MURLOC_A10 39817 - #define SPELL_SUMMON_MURLOC_B6 39818 #define SPELL_SUMMON_MURLOC_B7 39819 #define SPELL_SUMMON_MURLOC_B8 39820 #define SPELL_SUMMON_MURLOC_B9 39821 #define SPELL_SUMMON_MURLOC_B10 39822*/ - float MurlocCords[10][5] = { {21920, 424.36, -715.4, -7.14, 0.124}, @@ -90,11 +80,9 @@ float MurlocCords[10][5] = {21920, 321.05, -718.73, -13.15, 0.124}, {21920, 321.05, -714.24, -13.15, 0.124} }; - //Creatures #define WATER_GLOBULE 21913 #define TIDEWALKER_LURKER 21920 - //Morogrim Tidewalker AI struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI { @@ -102,11 +90,8 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - Map::PlayerList const *PlayerList; - uint32 TidalWave_Timer; uint32 WateryGrave_Timer; uint32 Earthquake_Timer; @@ -114,10 +99,8 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI uint32 globulespell[4]; int8 Playercount; int8 counter; - bool Earthquake; bool Phase2; - void Reset() { TidalWave_Timer = 10000; @@ -128,42 +111,33 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI globulespell[1] = SPELL_SUMMON_WATER_GLOBULE_2; globulespell[2] = SPELL_SUMMON_WATER_GLOBULE_3; globulespell[3] = SPELL_SUMMON_WATER_GLOBULE_4; - Earthquake = false; Phase2 = false; - if (pInstance) pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, NOT_STARTED); } - void StartEvent() { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, IN_PROGRESS); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, DONE); } - void EnterCombat(Unit *who) { PlayerList = &m_creature->GetMap()->GetPlayers(); Playercount = PlayerList->getSize(); StartEvent(); } - void ApplyWateryGrave(Unit* pPlayer, uint8 i) { switch(i) @@ -174,13 +148,11 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI case 3: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_4, true); break; } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Earthquake_Timer if (Earthquake_Timer < diff) { @@ -193,8 +165,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI else { DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature); - - for(uint8 i = 0; i < 10; ++i) + for (uint8 i = 0; i < 10; ++i) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); @@ -206,14 +177,12 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI Earthquake_Timer = 40000+rand()%5000; } }else Earthquake_Timer -= diff; - //TidalWave_Timer if (TidalWave_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_TIDAL_WAVE); TidalWave_Timer = 20000; }else TidalWave_Timer -= diff; - if (!Phase2) { //WateryGrave_Timer @@ -224,7 +193,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI using std::set; setlist; set::iterator itr; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { counter = 0; do{target = SelectTarget(SELECT_TARGET_RANDOM, 1, 50, true); //target players only @@ -237,13 +206,10 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI ApplyWateryGrave(target, i); } } - DoScriptText(RAND(SAY_SUMMON_BUBL1,SAY_SUMMON_BUBL2), m_creature); - DoScriptText(EMOTE_WATERY_GRAVE, m_creature); WateryGrave_Timer = 30000; }else WateryGrave_Timer -= diff; - //Start Phase2 if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25) Phase2 = true; @@ -273,36 +239,27 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI WateryGlobules_Timer = 25000; }else WateryGlobules_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - //Water Globule AI #define SPELL_GLOBULE_EXPLOSION 37871 - struct TRINITY_DLL_DECL mob_water_globuleAI : public ScriptedAI { mob_water_globuleAI(Creature *c) : ScriptedAI(c) {} - uint32 Check_Timer; - void Reset() { Check_Timer = 1000; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(14); } - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit *who) { if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { //no attack radius check - it attacks the first target that moves in his los @@ -310,30 +267,25 @@ struct TRINITY_DLL_DECL mob_water_globuleAI : public ScriptedAI AttackStart(who); } } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Check_Timer < diff) { if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 5)) { DoCast(m_creature->getVictim(), SPELL_GLOBULE_EXPLOSION); - //despawn m_creature->ForcedDespawn(); return; } Check_Timer = 500; }else Check_Timer -= diff; - //do NOT deal any melee damage to the target. } }; - CreatureAI* GetAI_boss_morogrim_tidewalker(Creature* pCreature) { return new boss_morogrim_tidewalkerAI (pCreature); @@ -342,16 +294,13 @@ CreatureAI* GetAI_mob_water_globule(Creature* pCreature) { return new mob_water_globuleAI (pCreature); } - void AddSC_boss_morogrim_tidewalker() { Script *newscript; - newscript = new Script; newscript->Name = "boss_morogrim_tidewalker"; newscript->GetAI = &GetAI_boss_morogrim_tidewalker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_water_globule"; newscript->GetAI = &GetAI_mob_water_globule; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h index adfa39dc7e0..64ea603c15b 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h @@ -1,7 +1,6 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SERPENT_SHRINE_H #define DEF_SERPENT_SHRINE_H enum LurkerEventState diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp index bd917a6e5c7..f3a89b1a185 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp @@ -13,29 +13,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Serpent_Shrine SD%Complete: 100 SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Serpent Shrine Scripts SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ - #include "precompiled.h" #include "def_serpent_shrine.h" - #define MAX_ENCOUNTER 6 #define SPELL_SCALDINGWATER 37284 #define MOB_COILFANG_FRENZY 21508 #define TRASHMOB_COILFANG_PRIESTESS 21220 //6*2 #define TRASHMOB_COILFANG_SHATTERER 21301 //6*3 - #define MIN_KILLS 30 - //NOTE: there are 6 platforms //there should be 3 shatterers and 2 priestess on all platforms, total of 30 elites, else it won't work! //delete all other elites not on platforms! these mobs should only be on those platforms nowhere else. - /* Serpentshrine cavern encounters: 0 - Hydross The Unstable event 1 - Leotheras The Blind Event @@ -44,24 +38,18 @@ EndScriptData */ 4 - Morogrim Tidewalker Event 5 - Lady Vashj Event */ - bool GOHello_go_bridge_console(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = pGo->GetInstanceData(); - if (!pInstance) return false; - if (pInstance) pInstance->SetData(DATA_CONTROL_CONSOLE, DONE); - return true; } - struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { instance_serpentshrine_cavern(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 LurkerBelow; uint64 Sharkkis; uint64 Tidalvess; @@ -71,7 +59,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance uint64 KarathressEvent_Starter; uint64 LeotherasTheBlind; uint64 LeotherasEventStarter; - uint64 ControlConsole; uint64 BridgePart[3]; uint32 StrangePool; @@ -81,15 +68,12 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance uint32 FrenzySpawnTimer; uint32 Water; uint32 TrashCount; - bool ShieldGeneratorDeactivated[4]; uint32 m_auiEncounter[MAX_ENCOUNTER]; bool DoSpawnFrenzy; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - LurkerBelow = 0; Sharkkis = 0; Tidalvess = 0; @@ -99,14 +83,12 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance KarathressEvent_Starter = 0; LeotherasTheBlind = 0; LeotherasEventStarter = 0; - ControlConsole = 0; BridgePart[0] = 0; BridgePart[1] = 0; BridgePart[2] = 0; StrangePool = 0; Water = WATERSTATE_FRENZY; - ShieldGeneratorDeactivated[0] = false; ShieldGeneratorDeactivated[1] = false; ShieldGeneratorDeactivated[2] = false; @@ -117,17 +99,13 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance FrenzySpawnTimer = 2000; DoSpawnFrenzy = false; TrashCount = 0; - } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void Update (uint32 diff) { //Lurker Fishing event @@ -146,7 +124,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance Water = WATERSTATE_SCALDING; else Water = WATERSTATE_FRENZY; - Map::PlayerList const &PlayerList = instance->GetPlayers(); if (PlayerList.isEmpty()) return; @@ -158,7 +135,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { if(Water == WATERSTATE_SCALDING) { - if(!pPlayer->HasAura(SPELL_SCALDINGWATER)) { pPlayer->CastSpell(pPlayer, SPELL_SCALDINGWATER,true); @@ -180,7 +156,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance if(!pPlayer->IsInWater()) pPlayer->RemoveAurasDueToSpell(SPELL_SCALDINGWATER); } - } WaterCheckTimer = 500;//remove stress from core }else WaterCheckTimer -= diff; @@ -190,7 +165,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance FrenzySpawnTimer = 2000; }else FrenzySpawnTimer -= diff; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -199,17 +173,14 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance ControlConsole = pGo->GetGUID(); pGo->setActive(true); break; - case 184203: BridgePart[0] = pGo->GetGUID(); pGo->setActive(true); break; - case 184204: BridgePart[1] = pGo->GetGUID(); pGo->setActive(true); break; - case 184205: BridgePart[2] = pGo->GetGUID(); pGo->setActive(true); @@ -223,7 +194,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -242,7 +212,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance break;*/ } } - void SetData64(uint32 type, uint64 data) { if (type == DATA_KARATHRESSEVENT_STARTER) @@ -250,7 +219,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance if (type == DATA_LEOTHERAS_EVENT_STARTER) LeotherasEventStarter = data; } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -267,7 +235,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -315,11 +282,9 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false; break; case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false; break; } - if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -357,7 +322,6 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance } return NULL; } - void Load(const char* in) { if (!in) @@ -369,27 +333,23 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance std::istringstream stream(in); stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> TrashCount; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_serpentshrine_cavern(Map* pMap) { return new instance_serpentshrine_cavern(pMap); } - void AddSC_instance_serpentshrine_cavern() { Script *newscript; - newscript = new Script; newscript->Name = "instance_serpent_shrine"; newscript->GetInstanceData = &GetInstanceData_instance_serpentshrine_cavern; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_bridge_console"; newscript->pGOHello = &GOHello_go_bridge_console; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp index fc23f175931..eaba84be358 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hydromancer_Thespia SD%Complete: 80 SDComment: Needs additional adjustments (when instance script is adjusted) SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ - /* ContentData boss_hydromancer_thespia mob_coilfang_waterelemental EndContentData */ - #include "precompiled.h" #include "def_steam_vault.h" - #define SAY_SUMMON -1545000 #define SAY_AGGRO_1 -1545001 #define SAY_AGGRO_2 -1545002 @@ -36,11 +32,9 @@ EndContentData */ #define SAY_SLAY_1 -1545004 #define SAY_SLAY_2 -1545005 #define SAY_DEAD -1545006 - #define SPELL_LIGHTNING_CLOUD 25033 #define SPELL_LUNG_BURST 31481 #define SPELL_ENVELOPING_WINDS 31718 - struct TRINITY_DLL_DECL boss_thespiaAI : public ScriptedAI { boss_thespiaAI(Creature *c) : ScriptedAI(c) @@ -48,50 +42,39 @@ struct TRINITY_DLL_DECL boss_thespiaAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = m_creature->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; bool HeroicMode; - uint32 LightningCloud_Timer; uint32 LungBurst_Timer; uint32 EnvelopingWinds_Timer; - void Reset() { LightningCloud_Timer = 15000; LungBurst_Timer = 7000; EnvelopingWinds_Timer = 9000; - if (pInstance) pInstance->SetData(TYPE_HYDROMANCER_THESPIA, NOT_STARTED); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEAD, m_creature); - if (pInstance) pInstance->SetData(TYPE_HYDROMANCER_THESPIA, DONE); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); - if (pInstance) pInstance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //LightningCloud_Timer if (LightningCloud_Timer < diff) { @@ -103,7 +86,6 @@ struct TRINITY_DLL_DECL boss_thespiaAI : public ScriptedAI DoCast(target, SPELL_LIGHTNING_CLOUD); LightningCloud_Timer = 15000+rand()%10000; }else LightningCloud_Timer -=diff; - //LungBurst_Timer if (LungBurst_Timer < diff) { @@ -111,7 +93,6 @@ struct TRINITY_DLL_DECL boss_thespiaAI : public ScriptedAI DoCast(target, SPELL_LUNG_BURST); LungBurst_Timer = 7000+rand()%5000; }else LungBurst_Timer -=diff; - //EnvelopingWinds_Timer if (EnvelopingWinds_Timer < diff) { @@ -123,63 +104,49 @@ struct TRINITY_DLL_DECL boss_thespiaAI : public ScriptedAI DoCast(target, SPELL_ENVELOPING_WINDS); EnvelopingWinds_Timer = 10000+rand()%5000; }else EnvelopingWinds_Timer -=diff; - DoMeleeAttackIfReady(); } }; - #define SPELL_WATER_BOLT_VOLLEY 34449 #define H_SPELL_WATER_BOLT_VOLLEY 37924 - struct TRINITY_DLL_DECL mob_coilfang_waterelementalAI : public ScriptedAI { mob_coilfang_waterelementalAI(Creature *c) : ScriptedAI(c) {} - bool HeroicMode; uint32 WaterBoltVolley_Timer; - void Reset() { HeroicMode = m_creature->GetMap()->IsHeroic(); WaterBoltVolley_Timer = 3000+rand()%3000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (WaterBoltVolley_Timer < diff) { DoCast(m_creature, HEROIC(SPELL_WATER_BOLT_VOLLEY, H_SPELL_WATER_BOLT_VOLLEY)); WaterBoltVolley_Timer = 7000+rand()%5000; }else WaterBoltVolley_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_thespiaAI(Creature* pCreature) { return new boss_thespiaAI (pCreature); } - CreatureAI* GetAI_mob_coilfang_waterelementalAI(Creature* pCreature) { return new mob_coilfang_waterelementalAI (pCreature); } - void AddSC_boss_hydromancer_thespia() { Script *newscript; - newscript = new Script; newscript->Name = "boss_hydromancer_thespia"; newscript->GetAI = &GetAI_boss_thespiaAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_coilfang_waterelemental"; newscript->GetAI = &GetAI_mob_coilfang_waterelementalAI; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp index d24279be1ec..14dd8c90afb 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Mekgineer_Steamrigger SD%Complete: 60 SDComment: Mechanics' interrrupt heal doesn't work very well, also a proper movement needs to be implemented -> summon further away and move towards target to repair. SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ - /* ContentData boss_mekgineer_steamrigger mob_steamrigger_mechanic EndContentData */ - #include "precompiled.h" #include "def_steam_vault.h" - #define SAY_MECHANICS -1545007 #define SAY_AGGRO_1 -1545008 #define SAY_AGGRO_2 -1545009 @@ -38,14 +34,11 @@ EndContentData */ #define SAY_SLAY_2 -1545013 #define SAY_SLAY_3 -1545014 #define SAY_DEATH -1545015 - #define SPELL_SUPER_SHRINK_RAY 31485 #define SPELL_SAW_BLADE 31486 #define SPELL_ELECTRIFIED_NET 35107 #define H_SPELL_ENRAGE 1 //corrent enrage spell not known - #define ENTRY_STREAMRIGGER_MECHANIC 17951 - struct TRINITY_DLL_DECL boss_mekgineer_steamriggerAI : public ScriptedAI { boss_mekgineer_steamriggerAI(Creature *c) : ScriptedAI(c) @@ -53,95 +46,76 @@ struct TRINITY_DLL_DECL boss_mekgineer_steamriggerAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; bool HeroicMode; - uint32 Shrink_Timer; uint32 Saw_Blade_Timer; uint32 Electrified_Net_Timer; bool Summon75; bool Summon50; bool Summon25; - void Reset() { Shrink_Timer = 20000; Saw_Blade_Timer = 15000; Electrified_Net_Timer = 10000; - Summon75 = false; Summon50 = false; Summon25 = false; - if (pInstance) pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, NOT_STARTED); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, DONE); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); - if (pInstance) pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, IN_PROGRESS); } - //no known summon spells exist void SummonMechanichs() { DoScriptText(SAY_MECHANICS, m_creature); - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - if (rand()%2) DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,-7,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); if (rand()%2) DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,7,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Shrink_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUPER_SHRINK_RAY); Shrink_Timer = 20000; }else Shrink_Timer -= diff; - if (Saw_Blade_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,SPELL_SAW_BLADE); else DoCast(m_creature->getVictim(),SPELL_SAW_BLADE); - Saw_Blade_Timer = 15000; } else Saw_Blade_Timer -= diff; - if (Electrified_Net_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ELECTRIFIED_NET); Electrified_Net_Timer = 10000; } else Electrified_Net_Timer -= diff; - if (!Summon75) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 75) @@ -150,7 +124,6 @@ struct TRINITY_DLL_DECL boss_mekgineer_steamriggerAI : public ScriptedAI Summon75 = true; } } - if (!Summon50) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) @@ -159,7 +132,6 @@ struct TRINITY_DLL_DECL boss_mekgineer_steamriggerAI : public ScriptedAI Summon50 = true; } } - if (!Summon25) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25) @@ -168,23 +140,18 @@ struct TRINITY_DLL_DECL boss_mekgineer_steamriggerAI : public ScriptedAI Summon25 = true; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_mekgineer_steamrigger(Creature* pCreature) { return new boss_mekgineer_steamriggerAI (pCreature); } - #define SPELL_DISPEL_MAGIC 17201 #define SPELL_REPAIR 31532 #define H_SPELL_REPAIR 37936 - #define MAX_REPAIR_RANGE (13.0f) //we should be at least at this range for repair #define MIN_REPAIR_RANGE (7.0f) //we can stop movement at this range to repair but not required - struct TRINITY_DLL_DECL mob_steamrigger_mechanicAI : public ScriptedAI { mob_steamrigger_mechanicAI(Creature *c) : ScriptedAI(c) @@ -192,25 +159,19 @@ struct TRINITY_DLL_DECL mob_steamrigger_mechanicAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint32 Repair_Timer; - void Reset() { Repair_Timer = 2000; } - void MoveInLineOfSight(Unit* who) { //react only if attacked return; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (Repair_Timer < diff) @@ -226,7 +187,6 @@ struct TRINITY_DLL_DECL mob_steamrigger_mechanicAI : public ScriptedAI { //m_creature->GetMotionMaster()->MovementExpired(); //m_creature->GetMotionMaster()->MoveIdle(); - DoCast(m_creature,HEROIC(SPELL_REPAIR, H_SPELL_REPAIR), true); } Repair_Timer = 5000; @@ -239,28 +199,22 @@ struct TRINITY_DLL_DECL mob_steamrigger_mechanicAI : public ScriptedAI } }else Repair_Timer = 5000; }else Repair_Timer -= diff; - if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_steamrigger_mechanic(Creature* pCreature) { return new mob_steamrigger_mechanicAI (pCreature); } - void AddSC_boss_mekgineer_steamrigger() { Script *newscript; - newscript = new Script; newscript->Name = "boss_mekgineer_steamrigger"; newscript->GetAI = &GetAI_boss_mekgineer_steamrigger; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_steamrigger_mechanic"; newscript->GetAI = &GetAI_mob_steamrigger_mechanic; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp index f3a0be3bcfb..ce6302a04eb 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warlord_Kalithres SD%Complete: 65 SDComment: Contains workarounds regarding warlord's rage spells not acting as expected. Both scripts here require review and fine tuning. SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ - #include "precompiled.h" #include "def_steam_vault.h" - #define SAY_INTRO -1545016 #define SAY_REGEN -1545017 #define SAY_AGGRO1 -1545018 @@ -32,28 +29,22 @@ EndScriptData */ #define SAY_SLAY1 -1545021 #define SAY_SLAY2 -1545022 #define SAY_DEATH -1545023 - #define SPELL_SPELL_REFLECTION 31534 #define SPELL_IMPALE 39061 #define SPELL_WARLORDS_RAGE 37081 #define SPELL_WARLORDS_RAGE_NAGA 31543 - #define SPELL_WARLORDS_RAGE_PROC 36453 - struct TRINITY_DLL_DECL mob_naga_distillerAI : public ScriptedAI { mob_naga_distillerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //hack, due to really weird spell behaviour :( if (pInstance) { @@ -64,20 +55,15 @@ struct TRINITY_DLL_DECL mob_naga_distillerAI : public ScriptedAI } } } - void EnterCombat(Unit *who) { } - void StartRageGen(Unit *caster) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoCast(m_creature,SPELL_WARLORDS_RAGE_NAGA,true); - if (pInstance) pInstance->SetData(TYPE_DISTILLER,IN_PROGRESS); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (m_creature->GetHealth() <= damage) @@ -85,45 +71,36 @@ struct TRINITY_DLL_DECL mob_naga_distillerAI : public ScriptedAI pInstance->SetData(TYPE_DISTILLER,DONE); } }; - struct TRINITY_DLL_DECL boss_warlord_kalithreshAI : public ScriptedAI { boss_warlord_kalithreshAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 Reflection_Timer; uint32 Impale_Timer; uint32 Rage_Timer; bool CanRage; - void Reset() { Reflection_Timer = 10000; Impale_Timer = 7000+rand()%7000; Rage_Timer = 45000; CanRage = false; - if (pInstance) pInstance->SetData(TYPE_WARLORD_KALITHRESH, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); - if (pInstance) pInstance->SetData(TYPE_WARLORD_KALITHRESH, IN_PROGRESS); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void SpellHit(Unit *caster, const SpellEntry *spell) { //hack :( @@ -132,20 +109,16 @@ struct TRINITY_DLL_DECL boss_warlord_kalithreshAI : public ScriptedAI if (pInstance->GetData(TYPE_DISTILLER) == DONE) m_creature->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(TYPE_WARLORD_KALITHRESH, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Rage_Timer < diff) { if (Creature* distiller = me->FindNearestCreature(17954, 100.0f)) @@ -156,46 +129,37 @@ struct TRINITY_DLL_DECL boss_warlord_kalithreshAI : public ScriptedAI } Rage_Timer = 3000+rand()%15000; }else Rage_Timer -= diff; - //Reflection_Timer if (Reflection_Timer < diff) { DoCast(m_creature, SPELL_SPELL_REFLECTION); Reflection_Timer = 15000+rand()%10000; }else Reflection_Timer -= diff; - //Impale_Timer if (Impale_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_IMPALE); - Impale_Timer = 7500+rand()%5000; }else Impale_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_naga_distiller(Creature* pCreature) { return new mob_naga_distillerAI (pCreature); } - CreatureAI* GetAI_boss_warlord_kalithresh(Creature* pCreature) { return new boss_warlord_kalithreshAI (pCreature); } - void AddSC_boss_warlord_kalithresh() { Script *newscript; - newscript = new Script; newscript->Name = "mob_naga_distiller"; newscript->GetAI = &GetAI_mob_naga_distiller; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_warlord_kalithresh"; newscript->GetAI = &GetAI_boss_warlord_kalithresh; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/def_steam_vault.h b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/def_steam_vault.h index 4b407ac4816..8ee0f69acb8 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/def_steam_vault.h +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/def_steam_vault.h @@ -1,15 +1,12 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_STEAM_VAULT_H #define DEF_STEAM_VAULT_H - #define TYPE_HYDROMANCER_THESPIA 1 #define TYPE_MEKGINEER_STEAMRIGGER 2 #define TYPE_WARLORD_KALITHRESH 3 #define TYPE_DISTILLER 4 - #define DATA_MEKGINEERSTEAMRIGGER 5 #define DATA_KALITRESH 6 #define DATA_THESPIA 7 diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/instance_steam_vault.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/instance_steam_vault.cpp index 1ee00f2ef81..4af96fb71b6 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/instance_steam_vault.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/steam_vault/instance_steam_vault.cpp @@ -13,63 +13,47 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Steam_Vault SD%Complete: 80 SDComment: Instance script and access panel GO SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ - #include "precompiled.h" #include "def_steam_vault.h" - #define MAX_ENCOUNTER 4 - #define MAIN_CHAMBERS_DOOR 183049 #define ACCESS_PANEL_HYDRO 184125 #define ACCESS_PANEL_MEK 184126 - /* Steam Vaults encounters: 1 - Hydromancer Thespia Event 2 - Mekgineer Steamrigger Event 3 - Warlord Kalithresh Event */ - bool GOHello_go_main_chambers_access_panel(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = pGo->GetInstanceData(); - if (!pInstance) return false; - if (pGo->GetEntry() == ACCESS_PANEL_HYDRO && (pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE || pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)) pInstance->SetData(TYPE_HYDROMANCER_THESPIA,SPECIAL); - if (pGo->GetEntry() == ACCESS_PANEL_MEK && (pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE || pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)) pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER,SPECIAL); - return true; } - struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance { instance_steam_vault(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 ThespiaGUID; uint64 MekgineerGUID; uint64 KalithreshGUID; - uint64 MainChambersDoor; uint64 AccessPanelHydro; uint64 AccessPanelMek; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - ThespiaGUID = 0; MekgineerGUID = 0; KalithreshGUID = 0; @@ -77,16 +61,13 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance AccessPanelHydro = 0; AccessPanelMek = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -96,7 +77,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance case 17798: KalithreshGUID = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -106,7 +86,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance case ACCESS_PANEL_MEK: AccessPanelMek = pGo->GetGUID(); break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -115,10 +94,8 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance if (data == SPECIAL) { HandleGameObject(AccessPanelHydro, true); - if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) HandleGameObject(MainChambersDoor, true); - debug_log("TSCR: Instance Steamvault: Access panel used."); } m_auiEncounter[0] = data; @@ -127,10 +104,8 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance if (data == SPECIAL) { HandleGameObject(AccessPanelMek, true); - if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) HandleGameObject(MainChambersDoor, true); - debug_log("TSCR: Instance Steamvault: Access panel used."); } m_auiEncounter[1] = data; @@ -142,11 +117,9 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance m_auiEncounter[3] = data; break; } - if (data == DONE || data == SPECIAL) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -162,7 +135,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -176,7 +148,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance } return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -191,7 +162,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance } return NULL; } - void Load(const char* in) { if (!in) @@ -202,27 +172,23 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_steam_vault(Map* pMap) { return new instance_steam_vault(pMap); } - void AddSC_instance_steam_vault() { Script *newscript; - newscript = new Script; newscript->Name = "go_main_chambers_access_panel"; newscript->pGOHello = &GOHello_go_main_chambers_access_panel; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "instance_steam_vault"; newscript->GetInstanceData = &GetInstanceData_instance_steam_vault; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_hungarfen.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_hungarfen.cpp index c8337023b78..fb5570f4fd9 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_hungarfen.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_hungarfen.cpp @@ -13,47 +13,38 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Hungarfen SD%Complete: 95 SDComment: Need confirmation if spell data are same in both modes. Summons should have faster rate in heroic SDCategory: Coilfang Resevoir, Underbog EndScriptData */ - #include "precompiled.h" - #define SPELL_FOUL_SPORES 31673 #define SPELL_ACID_GEYSER 38739 - struct TRINITY_DLL_DECL boss_hungarfenAI : public ScriptedAI { boss_hungarfenAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; bool Root; uint32 Mushroom_Timer; uint32 AcidGeyser_Timer; - void Reset() { Root = false; Mushroom_Timer = 5000; // 1 mushroom after 5s, then one per 10s. This should be different in heroic mode AcidGeyser_Timer = 10000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 20) { if (!Root) @@ -62,24 +53,20 @@ struct TRINITY_DLL_DECL boss_hungarfenAI : public ScriptedAI Root = true; } } - if (Mushroom_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) m_creature->SummonCreature(17990, target->GetPositionX()+(rand()%8), target->GetPositionY()+(rand()%8), target->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); else m_creature->SummonCreature(17990, m_creature->GetPositionX()+(rand()%8), m_creature->GetPositionY()+(rand()%8), m_creature->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); - Mushroom_Timer = 10000; }else Mushroom_Timer -= diff; - if (AcidGeyser_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_ACID_GEYSER); AcidGeyser_Timer = 10000+rand()%7500; }else AcidGeyser_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -87,46 +74,35 @@ CreatureAI* GetAI_boss_hungarfen(Creature* pCreature) { return new boss_hungarfenAI (pCreature); } - #define SPELL_SPORE_CLOUD 34168 #define SPELL_PUTRID_MUSHROOM 31690 #define SPELL_GROW 31698 - struct TRINITY_DLL_DECL mob_underbog_mushroomAI : public ScriptedAI { mob_underbog_mushroomAI(Creature *c) : ScriptedAI(c) {} - bool Stop; uint32 Grow_Timer; uint32 Shrink_Timer; - void Reset() { Stop = false; Grow_Timer = 0; Shrink_Timer = 20000; - DoCast(m_creature,SPELL_PUTRID_MUSHROOM,true); DoCast(m_creature,SPELL_SPORE_CLOUD,true); } - void MoveInLineOfSight(Unit *who) { return; } - void AttackStart(Unit* who) { return; } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (Stop) return; - if (Grow_Timer <= diff) { DoCast(m_creature,SPELL_GROW); Grow_Timer = 3000; }else Grow_Timer -= diff; - if (Shrink_Timer <= diff) { m_creature->RemoveAurasDueToSpell(SPELL_GROW); @@ -138,16 +114,13 @@ CreatureAI* GetAI_mob_underbog_mushroom(Creature* pCreature) { return new mob_underbog_mushroomAI (pCreature); } - void AddSC_boss_hungarfen() { Script *newscript; - newscript = new Script; newscript->Name = "boss_hungarfen"; newscript->GetAI = &GetAI_boss_hungarfen; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_underbog_mushroom"; newscript->GetAI = &GetAI_mob_underbog_mushroom; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp index 1b76860cf60..44adb9b39bc 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_the_black_stalker SD%Complete: 95 SDComment: Timers may be incorrect SDCategory: Coilfang Resevoir, Underbog EndScriptData */ - #include "precompiled.h" - #define SPELL_LEVITATE 31704 #define SPELL_SUSPENSION 31719 #define SPELL_LEVITATION_PULSE 31701 @@ -30,16 +27,13 @@ EndScriptData */ #define SPELL_CHAIN_LIGHTNING 31717 #define SPELL_STATIC_CHARGE 31715 #define SPELL_SUMMON_SPORE_STRIDER 38755 - #define ENTRY_SPORE_STRIDER 22299 - struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI { boss_the_black_stalkerAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; uint32 SporeStriders_Timer; uint32 Levitate_Timer; @@ -50,7 +44,6 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI bool InAir; uint32 check_Timer; std::list Striders; - void Reset() { Levitate_Timer = 12000; @@ -62,9 +55,7 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI LevitatedTarget_Timer = 0; Striders.clear(); } - void EnterCombat(Unit *who) {} - void JustSummoned(Creature *summon) { if (summon && summon->GetEntry() == ENTRY_SPORE_STRIDER) @@ -77,19 +68,16 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI summon->AI()->AttackStart(m_creature->getVictim()); } } - void JustDied(Unit *who) { - for(std::list::iterator i = Striders.begin(); i != Striders.end(); ++i) + for (std::list::iterator i = Striders.begin(); i != Striders.end(); ++i) if (Creature *strider = Unit::GetCreature(*m_creature, *i)) strider->DisappearAndDie(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - // Evade if too far if (check_Timer < diff) { @@ -102,14 +90,12 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI } check_Timer = 1000; }else check_Timer -= diff; - // Spore Striders if (HeroicMode && SporeStriders_Timer < diff) { DoCast(m_creature,SPELL_SUMMON_SPORE_STRIDER); SporeStriders_Timer = 10000+rand()%5000; }else SporeStriders_Timer -= diff; - // Levitate if (LevitatedTarget) { @@ -149,7 +135,6 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI } Levitate_Timer = 12000+rand()%3000; }else Levitate_Timer -= diff; - // Chain Lightning if (ChainLightning_Timer < diff) { @@ -157,7 +142,6 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightning_Timer = 7000; }else ChainLightning_Timer -= diff; - // Static Charge if (StaticCharge_Timer < diff) { @@ -165,20 +149,16 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI DoCast(target, SPELL_STATIC_CHARGE); StaticCharge_Timer = 10000; }else StaticCharge_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_the_black_stalker(Creature* pCreature) { return new boss_the_black_stalkerAI (pCreature); } - void AddSC_boss_the_black_stalker() { Script *newscript; - newscript = new Script; newscript->Name = "boss_the_black_stalker"; newscript->GetAI = &GetAI_boss_the_black_stalker; diff --git a/src/bindings/scripts/scripts/outland/gruuls_lair/boss_gruul.cpp b/src/bindings/scripts/scripts/outland/gruuls_lair/boss_gruul.cpp index 97de7ab4149..3a5a61a00af 100644 --- a/src/bindings/scripts/scripts/outland/gruuls_lair/boss_gruul.cpp +++ b/src/bindings/scripts/scripts/outland/gruuls_lair/boss_gruul.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gruul SD%Complete: 60 SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to mangos) SDCategory: Gruul's Lair EndScriptData */ - #include "precompiled.h" #include "def_gruuls_lair.h" - enum eEnums { SAY_AGGRO = -1565010, @@ -35,41 +32,32 @@ enum eEnums SAY_SLAY2 = -1565016, SAY_SLAY3 = -1565017, SAY_DEATH = -1565018, - EMOTE_GROW = -1565019, - SPELL_GROWTH = 36300, SPELL_CAVE_IN = 36240, SPELL_GROUND_SLAM = 33525, //AoE Ground Slam applying Ground Slam to everyone with a script effect (most likely the knock back, we can code it to a set knockback) SPELL_REVERBERATION = 36297, SPELL_SHATTER = 33654, - SPELL_SHATTER_EFFECT = 33671, SPELL_HURTFUL_STRIKE = 33813, SPELL_STONED = 33652, //Spell is self cast by target - SPELL_MAGNETIC_PULL = 28337, SPELL_KNOCK_BACK = 24199, //Knockback spell until correct implementation is made }; - struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI { boss_gruulAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 m_uiGrowth_Timer; uint32 m_uiCaveIn_Timer; uint32 m_uiCaveIn_StaticTimer; uint32 m_uiGroundSlamTimer; uint32 m_uiHurtfulStrike_Timer; uint32 m_uiReverberation_Timer; - bool m_bPerformingGroundSlam; - void Reset() { m_uiGrowth_Timer= 30000; @@ -79,35 +67,28 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI m_bPerformingGroundSlam= false; m_uiHurtfulStrike_Timer= 8000; m_uiReverberation_Timer= 60000+45000; - if (pInstance) pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS); } - void KilledUnit() { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) { pInstance->SetData(DATA_GRUULEVENT, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_GRUULDOOR), true); // Open the encounter door } } - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) { //This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction @@ -123,21 +104,17 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } } } - //this part should be in mangos if (pSpell->Id == SPELL_SHATTER) { //this spell must have custom handling in mangos, dealing damage based on distance pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true); - if (pTarget->HasAura(SPELL_STONED)) pTarget->RemoveAurasDueToSpell(SPELL_STONED); - //clear this, if we are still performing if (m_bPerformingGroundSlam) { m_bPerformingGroundSlam = false; - //and correct movement, if not already if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) { @@ -147,13 +124,11 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } } } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - // Growth // Gruul can cast this spell up to 30 times if (m_uiGrowth_Timer < uiDiff) @@ -164,17 +139,14 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } else m_uiGrowth_Timer -= uiDiff; - if (m_bPerformingGroundSlam) { if (m_uiGroundSlamTimer < uiDiff) { m_uiGroundSlamTimer =120000; m_uiHurtfulStrike_Timer= 8000; - if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter m_uiReverberation_Timer += 10000; - DoCast(m_creature, SPELL_SHATTER); } else @@ -186,17 +158,14 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI if (m_uiHurtfulStrike_Timer < uiDiff) { Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,1); - if (target && m_creature->IsWithinMeleeRange(m_creature->getVictim())) DoCast(target,SPELL_HURTFUL_STRIKE); else DoCast(m_creature->getVictim(),SPELL_HURTFUL_STRIKE); - m_uiHurtfulStrike_Timer= 8000; } else m_uiHurtfulStrike_Timer -= uiDiff; - // Reverberation if (m_uiReverberation_Timer < uiDiff) { @@ -205,45 +174,36 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } else m_uiReverberation_Timer -= uiDiff; - // Cave In if (m_uiCaveIn_Timer < uiDiff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_CAVE_IN); - if (m_uiCaveIn_StaticTimer >= 4000) m_uiCaveIn_StaticTimer -= 2000; - m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; } else m_uiCaveIn_Timer -= uiDiff; - // Ground Slam, Gronn Lord's Grasp, Stoned, Shatter if (m_uiGroundSlamTimer < uiDiff) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); - m_bPerformingGroundSlam= true; m_uiGroundSlamTimer = 10000; - DoCast(m_creature, SPELL_GROUND_SLAM); } else m_uiGroundSlamTimer -= uiDiff; - DoMeleeAttackIfReady(); } } }; - CreatureAI* GetAI_boss_gruul(Creature* pCreature) { return new boss_gruulAI (pCreature); } - void AddSC_boss_gruul() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp b/src/bindings/scripts/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp index 849712ab336..148f7b1ff1d 100644 --- a/src/bindings/scripts/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp +++ b/src/bindings/scripts/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_High_King_Maulgar SD%Complete: 90 SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing SDCategory: Gruul's Lair EndScriptData */ - #include "precompiled.h" #include "def_gruuls_lair.h" - #define SAY_AGGRO -1565000 #define SAY_ENRAGE -1565001 #define SAY_OGRE_DEATH1 -1565002 @@ -34,7 +31,6 @@ EndScriptData */ #define SAY_SLAY2 -1565007 #define SAY_SLAY3 -1565008 #define SAY_DEATH -1565009 - // High King Maulgar #define SPELL_ARCING_SMASH 39144 #define SPELL_MIGHTY_BLOW 33230 @@ -43,88 +39,70 @@ EndScriptData */ #define SPELL_ROAR 16508 #define SPELL_FLURRY 33232 #define SPELL_DUAL_WIELD 29651 //used in phase - // Olm the Summoner #define SPELL_DARK_DECAY 33129 #define SPELL_DEATH_COIL 33130 #define SPELL_SUMMON_WFH 33131 - //Kiggler the Craed #define SPELL_GREATER_POLYMORPH 33173 #define SPELL_LIGHTNING_BOLT 36152 #define SPELL_ARCANE_SHOCK 33175 #define SPELL_ARCANE_EXPLOSION 33237 - //Blindeye the Seer #define SPELL_GREATER_PW_SHIELD 33147 #define SPELL_HEAL 33144 #define SPELL_PRAYER_OH 33152 - //Krosh Firehand #define SPELL_GREATER_FIREBALL 33051 #define SPELL_SPELLSHIELD 33054 #define SPELL_BLAST_WAVE 33061 - bool CheckAllBossDied(ScriptedInstance* pInstance, Creature* m_creature) { if (!pInstance || !m_creature) return false; - uint64 MaulgarGUID = 0; uint64 KigglerGUID = 0; uint64 BlindeyeGUID = 0; uint64 OlmGUID = 0; uint64 KroshGUID = 0; - Creature* Maulgar = NULL; Creature* Kiggler = NULL; Creature* Blindeye = NULL; Creature* Olm = NULL; Creature* Krosh = NULL; - MaulgarGUID = pInstance->GetData64(DATA_MAULGAR); KigglerGUID = pInstance->GetData64(DATA_KIGGLERTHECRAZED); BlindeyeGUID = pInstance->GetData64(DATA_BLINDEYETHESEER); OlmGUID = pInstance->GetData64(DATA_OLMTHESUMMONER); KroshGUID = pInstance->GetData64(DATA_KROSHFIREHAND); - Maulgar = (Unit::GetCreature((*m_creature), MaulgarGUID)); Kiggler = (Unit::GetCreature((*m_creature), KigglerGUID)); Blindeye = (Unit::GetCreature((*m_creature), BlindeyeGUID)); Olm = (Unit::GetCreature((*m_creature), OlmGUID)); Krosh = (Unit::GetCreature((*m_creature), KroshGUID)); - if (!Maulgar || !Kiggler || !Blindeye || !Olm || !Krosh) return false; - if (!Maulgar->isAlive() && !Kiggler->isAlive() && !Blindeye->isAlive() && !Olm->isAlive() && !Krosh->isAlive()) return true; - return false; } - //High King Maulgar AI struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI { boss_high_king_maulgarAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) Council[i] = 0; } - ScriptedInstance* pInstance; - uint32 ArcingSmash_Timer; uint32 MightyBlow_Timer; uint32 Whirlwind_Timer; uint32 Charging_Timer; uint32 Roar_Timer; - bool Phase2; - uint64 Council[4]; - void Reset() { ArcingSmash_Timer = 10000; @@ -132,13 +110,10 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI Whirlwind_Timer = 30000; Charging_Timer = 0; Roar_Timer = 0; - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, false); - Phase2 = false; - Creature *pCreature = NULL; - for(uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 4; ++i) { if (Council[i]) { @@ -150,36 +125,29 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI } } } - //reset encounter if (pInstance) pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - void KilledUnit() { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (CheckAllBossDied(pInstance, m_creature)) pInstance->SetData(DATA_MAULGAREVENT, DONE); } - void AddDeath() { DoScriptText(RAND(SAY_OGRE_DEATH1,SAY_OGRE_DEATH2,SAY_OGRE_DEATH3,SAY_OGRE_DEATH4), m_creature); } - void EnterCombat(Unit *who) { StartEvent(who); } - void GetCouncil() { if(pInstance) @@ -191,79 +159,64 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI Council[3] = pInstance->GetData64(DATA_KROSHFIREHAND); } } - void StartEvent(Unit *who) { if (!pInstance) return; - GetCouncil(); - DoScriptText(SAY_AGGRO, m_creature); - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); - DoZoneInCombat(); } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - if (target) { AttackStart(target); GetCouncil(); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } - //ArcingSmash_Timer if (ArcingSmash_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCING_SMASH); ArcingSmash_Timer = 10000; }else ArcingSmash_Timer -= diff; - //Whirlwind_Timer if (Whirlwind_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_WHIRLWIND); Whirlwind_Timer = 55000; }else Whirlwind_Timer -= diff; - //MightyBlow_Timer if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MIGHTY_BLOW); MightyBlow_Timer = 30000+rand()%10000; }else MightyBlow_Timer -= diff; - //Entering Phase 2 if (!Phase2 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) { Phase2 = true; DoScriptText(SAY_ENRAGE, m_creature); - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); } - if (Phase2) { //Charging_Timer @@ -278,7 +231,6 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI } Charging_Timer = 20000; }else Charging_Timer -= diff; - //Intimidating Roar if (Roar_Timer < diff) { @@ -286,11 +238,9 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI Roar_Timer = 40000+(rand()%10000); }else Roar_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - //Olm The Summoner AI struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI { @@ -298,39 +248,31 @@ struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 DarkDecay_Timer; uint32 Summon_Timer; uint32 DeathCoil_Timer; - ScriptedInstance* pInstance; - void Reset() { DarkDecay_Timer = 10000; Summon_Timer = 15000; DeathCoil_Timer = 20000; - //reset encounter if (pInstance) pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - void AttackStart(Unit* pWho) { if (!pWho) return; - if (m_creature->Attack(pWho, true)) { m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - m_creature->GetMotionMaster()->MoveChase(pWho, 30.0f); } } - void EnterCombat(Unit *who) { if (pInstance) @@ -339,60 +281,50 @@ struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (pInstance) { Creature *Maulgar = NULL; Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR))); - if (Maulgar) CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - if (CheckAllBossDied(pInstance, m_creature)) pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } - //DarkDecay_Timer if (DarkDecay_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_DARK_DECAY); DarkDecay_Timer = 20000; }else DarkDecay_Timer -= diff; - //Summon_Timer if (Summon_Timer < diff) { DoCast(m_creature, SPELL_SUMMON_WFH); Summon_Timer = 30000; }else Summon_Timer -= diff; - //DeathCoil Timer /need correct timer if (DeathCoil_Timer < diff) { @@ -403,11 +335,9 @@ struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI DeathCoil_Timer = 20000; }else DeathCoil_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Kiggler The Crazed AI struct TRINITY_DLL_DECL boss_kiggler_the_crazedAI : public ScriptedAI { @@ -415,26 +345,21 @@ struct TRINITY_DLL_DECL boss_kiggler_the_crazedAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 GreaterPolymorph_Timer; uint32 LightningBolt_Timer; uint32 ArcaneShock_Timer; uint32 ArcaneExplosion_Timer; - ScriptedInstance* pInstance; - void Reset() { GreaterPolymorph_Timer = 5000; LightningBolt_Timer = 10000; ArcaneShock_Timer = 20000; ArcaneExplosion_Timer = 30000; - //reset encounter if (pInstance) pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance) @@ -443,81 +368,67 @@ struct TRINITY_DLL_DECL boss_kiggler_the_crazedAI : public ScriptedAI pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (pInstance) { Creature *Maulgar = NULL; Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR))); - if (Maulgar) CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - if (CheckAllBossDied(pInstance, m_creature)) pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } - //GreaterPolymorph_Timer if (GreaterPolymorph_Timer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_GREATER_POLYMORPH); - GreaterPolymorph_Timer = 15000 + rand()%5000; }else GreaterPolymorph_Timer -= diff; - //LightningBolt_Timer if (LightningBolt_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_LIGHTNING_BOLT); LightningBolt_Timer = 15000; }else LightningBolt_Timer -= diff; - //ArcaneShock_Timer if (ArcaneShock_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_SHOCK); ArcaneShock_Timer = 20000; }else ArcaneShock_Timer -= diff; - //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION); ArcaneExplosion_Timer = 30000; }else ArcaneExplosion_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Blindeye The Seer AI struct TRINITY_DLL_DECL boss_blindeye_the_seerAI : public ScriptedAI { @@ -525,24 +436,19 @@ struct TRINITY_DLL_DECL boss_blindeye_the_seerAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 GreaterPowerWordShield_Timer; uint32 Heal_Timer; uint32 PrayerofHealing_Timer; - ScriptedInstance* pInstance; - void Reset() { GreaterPowerWordShield_Timer = 5000; Heal_Timer = 25000 + rand()%15000; PrayerofHealing_Timer = 45000 + rand()%10000; - //reset encounter if (pInstance) pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance) @@ -551,71 +457,59 @@ struct TRINITY_DLL_DECL boss_blindeye_the_seerAI : public ScriptedAI pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (pInstance) { Creature *Maulgar = NULL; Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR))); - if (Maulgar) CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - if (CheckAllBossDied(pInstance, m_creature)) pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } - //GreaterPowerWordShield_Timer if (GreaterPowerWordShield_Timer < diff) { DoCast(m_creature, SPELL_GREATER_PW_SHIELD); GreaterPowerWordShield_Timer = 40000; }else GreaterPowerWordShield_Timer -= diff; - //Heal_Timer if (Heal_Timer < diff) { DoCast(m_creature, SPELL_HEAL); Heal_Timer = 15000 + rand()%25000; }else Heal_Timer -= diff; - //PrayerofHealing_Timer if (PrayerofHealing_Timer < diff) { DoCast(m_creature, SPELL_PRAYER_OH); PrayerofHealing_Timer = 35000 + rand()%15000; }else PrayerofHealing_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Krosh Firehand AI struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI { @@ -623,24 +517,19 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI { pInstance = c->GetInstanceData(); } - uint32 GreaterFireball_Timer; uint32 SpellShield_Timer; uint32 BlastWave_Timer; - ScriptedInstance* pInstance; - void Reset() { GreaterFireball_Timer = 1000; SpellShield_Timer = 5000; BlastWave_Timer = 20000; - //reset encounter if (pInstance) pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance) @@ -649,53 +538,44 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - void JustDied(Unit* Killer) { if (pInstance) { Creature *Maulgar = NULL; Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR))); - if (Maulgar) CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - if (CheckAllBossDied(pInstance, m_creature)) pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!m_creature->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - if (target) { AttackStart(target); } } - //Return since we have no target if (!UpdateVictim()) return; - //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } - //GreaterFireball_Timer if (GreaterFireball_Timer < diff || m_creature->IsWithinDist(m_creature->getVictim(), 30)) { DoCast(m_creature->getVictim(), SPELL_GREATER_FIREBALL); GreaterFireball_Timer = 2000; }else GreaterFireball_Timer -= diff; - //SpellShield_Timer if (SpellShield_Timer < diff) { @@ -703,14 +583,13 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_SPELLSHIELD); SpellShield_Timer = 30000; }else SpellShield_Timer -= diff; - //BlastWave_Timer if (BlastWave_Timer < diff) { Unit *target; std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //15 yard radius minimum @@ -720,63 +599,51 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI } if (target_list.size()) target = *(target_list.begin()+rand()%target_list.size()); - m_creature->InterruptNonMeleeSpells(false); DoCast(target, SPELL_BLAST_WAVE); BlastWave_Timer = 60000; }else BlastWave_Timer -= diff; } }; - CreatureAI* GetAI_boss_high_king_maulgar(Creature* pCreature) { return new boss_high_king_maulgarAI (pCreature); } - CreatureAI* GetAI_boss_olm_the_summoner(Creature* pCreature) { return new boss_olm_the_summonerAI (pCreature); } - CreatureAI *GetAI_boss_kiggler_the_crazed(Creature* pCreature) { return new boss_kiggler_the_crazedAI (pCreature); } - CreatureAI *GetAI_boss_blindeye_the_seer(Creature* pCreature) { return new boss_blindeye_the_seerAI (pCreature); } - CreatureAI *GetAI_boss_krosh_firehand(Creature* pCreature) { return new boss_krosh_firehandAI (pCreature); } - void AddSC_boss_high_king_maulgar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_high_king_maulgar"; newscript->GetAI = &GetAI_boss_high_king_maulgar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_kiggler_the_crazed"; newscript->GetAI = &GetAI_boss_kiggler_the_crazed; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_blindeye_the_seer"; newscript->GetAI = &GetAI_boss_blindeye_the_seer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_olm_the_summoner"; newscript->GetAI = &GetAI_boss_olm_the_summoner; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_krosh_firehand"; newscript->GetAI = &GetAI_boss_krosh_firehand; diff --git a/src/bindings/scripts/scripts/outland/gruuls_lair/def_gruuls_lair.h b/src/bindings/scripts/scripts/outland/gruuls_lair/def_gruuls_lair.h index 7003dcb1e26..f2ffa525311 100644 --- a/src/bindings/scripts/scripts/outland/gruuls_lair/def_gruuls_lair.h +++ b/src/bindings/scripts/scripts/outland/gruuls_lair/def_gruuls_lair.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_GRUULS_LAIR_H #define DEF_GRUULS_LAIR_H - #define DATA_BLINDEYETHESEER 1 #define DATA_GRUULEVENT 2 #define DATA_KIGGLERTHECRAZED 3 @@ -15,7 +13,6 @@ #define DATA_MAULGARDOOR 8 #define DATA_GRUULDOOR 9 #define DATA_MAULGAR 10 - #define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Gruul's Lair instance (map 565). Encounters will be buggy." #endif diff --git a/src/bindings/scripts/scripts/outland/gruuls_lair/instance_gruuls_lair.cpp b/src/bindings/scripts/scripts/outland/gruuls_lair/instance_gruuls_lair.cpp index 0ac5cbcaf7a..b52887990db 100644 --- a/src/bindings/scripts/scripts/outland/gruuls_lair/instance_gruuls_lair.cpp +++ b/src/bindings/scripts/scripts/outland/gruuls_lair/instance_gruuls_lair.cpp @@ -13,63 +13,49 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Gruuls_Lair SD%Complete: 100 SDComment: SDCategory: Gruul's Lair EndScriptData */ - #include "precompiled.h" #include "def_gruuls_lair.h" - #define MAX_ENCOUNTER 2 - /* Gruuls Lair encounters: 1 - High King Maulgar event 2 - Gruul event */ - struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance { instance_gruuls_lair(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 MaulgarEvent_Tank; uint64 KigglerTheCrazed; uint64 BlindeyeTheSeer; uint64 OlmTheSummoner; uint64 KroshFirehand; uint64 Maulgar; - uint64 MaulgarDoor; uint64 GruulDoor; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - MaulgarEvent_Tank = 0; KigglerTheCrazed = 0; BlindeyeTheSeer = 0; OlmTheSummoner = 0; KroshFirehand = 0; Maulgar = 0; - MaulgarDoor = 0; GruulDoor = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -81,7 +67,6 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance case 18831: Maulgar = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -93,13 +78,11 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance case 184662: GruulDoor = pGo->GetGUID(); break; } } - void SetData64(uint32 type, uint64 data) { if (type == DATA_MAULGAREVENT_TANK) MaulgarEvent_Tank = data; } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -115,7 +98,6 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -128,11 +110,9 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance else HandleGameObject(GruulDoor, true); m_auiEncounter[1] = data; break; } - if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -142,7 +122,6 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance } return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -155,10 +134,8 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance OUT_SAVE_INST_DATA_COMPLETE; return out; } - return NULL; } - void Load(const char* in) { if (!in) @@ -166,22 +143,19 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> m_auiEncounter[0] >> m_auiEncounter[1]; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_gruuls_lair(Map* pMap) { return new instance_gruuls_lair(pMap); } - void AddSC_instance_gruuls_lair() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp index d359c9c25f7..3ee5c895546 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp @@ -13,41 +13,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Broggok SD%Complete: 70 SDComment: pre-event not made SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ - #include "precompiled.h" #include "def_blood_furnace.h" - enum eEnums { SAY_AGGRO = -1542008, - SPELL_SLIME_SPRAY = 30913, SPELL_POISON_CLOUD = 30916, SPELL_POISON_BOLT = 30917, - SPELL_POISON = 30914 }; - struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI { boss_broggokAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AcidSpray_Timer; uint32 PoisonSpawn_Timer; uint32 PoisonBolt_Timer; - void Reset() { AcidSpray_Timer = 10000; @@ -59,7 +50,6 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR4), true); } } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); @@ -69,7 +59,6 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR4), false); } } - void JustSummoned(Creature *summoned) { summoned->setFaction(16); @@ -77,33 +66,27 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summoned->CastSpell(summoned,SPELL_POISON,false,0,0,m_creature->GetGUID()); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (AcidSpray_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SLIME_SPRAY); AcidSpray_Timer = 4000+rand()%8000; }else AcidSpray_Timer -=diff; - if (PoisonBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_POISON_BOLT); PoisonBolt_Timer = 4000+rand()%8000; }else PoisonBolt_Timer -=diff; - if (PoisonSpawn_Timer < diff) { DoCast(m_creature,SPELL_POISON_CLOUD); PoisonSpawn_Timer = 20000; }else PoisonSpawn_Timer -=diff; - DoMeleeAttackIfReady(); } - void JustDied(Unit* who) { if (pInstance) @@ -113,14 +96,11 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI pInstance->SetData(TYPE_BROGGOK_EVENT, DONE); } } - }; - CreatureAI* GetAI_boss_broggok(Creature* pCreature) { return new boss_broggokAI (pCreature); } - void AddSC_boss_broggok() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index d47c3eecceb..fb782f94322 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kelidan_The_Breaker SD%Complete: 100 SDComment: SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ - /* ContentData boss_kelidan_the_breaker mob_shadowmoon_channeler EndContentData */ - #include "precompiled.h" #include "def_blood_furnace.h" - enum eKelidan { SAY_WAKE = -1542000, @@ -39,23 +35,17 @@ enum eKelidan SAY_KILL_2 = -1542005, SAY_NOVA = -1542006, SAY_DIE = -1542007, - SPELL_CORRUPTION = 30938, SPELL_EVOCATION = 30935, - SPELL_FIRE_NOVA = 33132, H_SPELL_FIRE_NOVA = 37371, - SPELL_SHADOW_BOLT_VOLLEY = 28599, H_SPELL_SHADOW_BOLT_VOLLEY = 40070, - SPELL_BURNING_NOVA = 30940, SPELL_VORTEX = 37370, - ENTRY_KELIDAN = 17377, ENTRY_CHANNELER = 17653 }; - const float ShadowmoonChannelers[5][4]= { {302,-87,-24.4,0.157}, @@ -64,20 +54,17 @@ const float ShadowmoonChannelers[5][4]= {344,-103.5,-24.5,2.356}, {316,-109,-24.6,1.257} }; - struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI { boss_kelidan_the_breakerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) Channelers[i] = 0; } - ScriptedInstance* pInstance; bool HeroicMode; - uint32 ShadowVolley_Timer; uint32 BurningNova_Timer; uint32 Firenova_Timer; @@ -86,7 +73,6 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI bool Firenova; bool addYell; uint64 Channelers[5]; - void Reset() { ShadowVolley_Timer = 1000; @@ -99,7 +85,6 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI if (pInstance) pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { DoScriptText(SAY_WAKE, m_creature); @@ -109,15 +94,12 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI if (pInstance) pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, IN_PROGRESS); } - void KilledUnit(Unit* victim) { if (rand()%2) return; - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void ChannelerEngaged(Unit* who) { if (who && !addYell) @@ -125,33 +107,30 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI addYell = true; DoScriptText(RAND(SAY_ADD_AGGRO_1,SAY_ADD_AGGRO_2,SAY_ADD_AGGRO_3), m_creature); } - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) { Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]); if (who && channeler && !channeler->isInCombat()) channeler->AI()->AttackStart(who); } } - void ChannelerDied(Unit* killer) { - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) { Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]); if (channeler && channeler->isAlive()) return; } - if (killer) m_creature->AI()->AttackStart(killer); } - uint64 GetChanneled(Creature *channeler1) { SummonChannelers(); if (!channeler1) return NULL; uint8 i; - for(i=0; i<5; ++i) + for (i=0; i<5; ++i) { Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]); if (channeler && channeler->GetGUID() == channeler1->GetGUID()) @@ -159,10 +138,9 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI } return Channelers[(i+2)%5]; } - void SummonChannelers() { - for(uint8 i=0; i<5; ++i) + for (uint8 i=0; i<5; ++i) { Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]); if (!channeler || channeler->isDead()) @@ -173,19 +151,15 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI Channelers[i] = 0; } } - void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); - if (!pInstance) return; - pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR1), true); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR6), true); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -198,7 +172,6 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI }else check_Timer -= diff; return; } - if (Firenova) { if (Firenova_Timer < diff) @@ -207,29 +180,23 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI Firenova = false; ShadowVolley_Timer = 2000; }else Firenova_Timer -=diff; - return; } - if (ShadowVolley_Timer < diff) { DoCast(m_creature, HEROIC(SPELL_SHADOW_BOLT_VOLLEY, H_SPELL_SHADOW_BOLT_VOLLEY)); ShadowVolley_Timer = 5000+rand()%8000; }else ShadowVolley_Timer -=diff; - if (Corruption_Timer < diff) { DoCast(m_creature,SPELL_CORRUPTION); Corruption_Timer = 30000+rand()%20000; }else Corruption_Timer -=diff; - if (BurningNova_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - DoScriptText(SAY_NOVA, m_creature); - if (SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA)) { uint8 eff_mask=0; @@ -241,51 +208,39 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI } m_creature->AddAura(new Aura(nova, eff_mask, me, me, me)); } - if (HeroicMode) DoTeleportAll(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation()); - BurningNova_Timer = 20000+rand()%8000; Firenova_Timer= 5000; Firenova = true; }else BurningNova_Timer -=diff; - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_boss_kelidan_the_breaker(Creature* pCreature) { return new boss_kelidan_the_breakerAI (pCreature); } - /*###### ## mob_shadowmoon_channeler ######*/ - enum eShadowmoon { SPELL_SHADOW_BOLT = 12739, H_SPELL_SHADOW_BOLT = 15472, - SPELL_MARK_OF_SHADOW = 30937, SPELL_CHANNELING = 39123 }; - struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI { mob_shadowmoon_channelerAI(Creature *c) : ScriptedAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 ShadowBolt_Timer; uint32 MarkOfShadow_Timer; uint32 check_Timer; - void Reset() { ShadowBolt_Timer = 1000+rand()%1000; @@ -294,7 +249,6 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); } - void EnterCombat(Unit* who) { if (Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) @@ -303,13 +257,11 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI m_creature->InterruptNonMeleeSpells(true); DoStartMovement(who); } - void JustDied(Unit* Killer) { if (Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(Killer); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -327,38 +279,31 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI }else check_Timer -= diff; return; } - if (MarkOfShadow_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_MARK_OF_SHADOW); MarkOfShadow_Timer = 15000+rand()%5000; }else MarkOfShadow_Timer -=diff; - if (ShadowBolt_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); ShadowBolt_Timer = 5000+rand()%1000; }else ShadowBolt_Timer -=diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_shadowmoon_channeler(Creature* pCreature) { return new mob_shadowmoon_channelerAI (pCreature); } - void AddSC_boss_kelidan_the_breaker() { Script *newscript; - newscript = new Script; newscript->Name = "boss_kelidan_the_breaker"; newscript->GetAI = &GetAI_boss_kelidan_the_breaker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_shadowmoon_channeler"; newscript->GetAI = &GetAI_mob_shadowmoon_channeler; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_the_maker.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_the_maker.cpp index 9c19888c92c..44fa1ea95ff 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_the_maker.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_the_maker.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_The_Maker SD%Complete: 80 SDComment: Mind control no support SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ - #include "precompiled.h" #include "def_blood_furnace.h" - enum eEnums { SAY_AGGRO_1 = -1542009, @@ -32,116 +29,91 @@ enum eEnums SAY_KILL_1 = -1542012, SAY_KILL_2 = -1542013, SAY_DIE = -1542014, - SPELL_ACID_SPRAY = 38153, // heroic 38973 ??? 38153 SPELL_EXPLODING_BREAKER = 30925, SPELL_KNOCKDOWN = 20276, SPELL_DOMINATION = 25772 // ??? }; - struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI { boss_the_makerAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 AcidSpray_Timer; uint32 ExplodingBreaker_Timer; uint32 Domination_Timer; uint32 Knockdown_Timer; - void Reset() { AcidSpray_Timer = 15000; ExplodingBreaker_Timer = 6000; Domination_Timer = 120000; Knockdown_Timer = 10000; - if (!pInstance) return; - pInstance->SetData(TYPE_THE_MAKER_EVENT, NOT_STARTED); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR2), true); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); - if (!pInstance) return; - pInstance->SetData(TYPE_THE_MAKER_EVENT, IN_PROGRESS); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR2), false); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); - if (!pInstance) return; - pInstance->SetData(TYPE_THE_MAKER_EVENT, DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR2), true); pInstance->HandleGameObject(pInstance->GetData64(DATA_DOOR3), true); - } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (AcidSpray_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ACID_SPRAY); AcidSpray_Timer = 15000+rand()%8000; }else AcidSpray_Timer -=diff; - if (ExplodingBreaker_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_EXPLODING_BREAKER); ExplodingBreaker_Timer = 4000+rand()%8000; }else ExplodingBreaker_Timer -=diff; - /* // Disabled until Core Support for mind control if (domination_timer_timer < diff) { Unit* target; target = SelectUnit(SELECT_TARGET_RANDOM,0); - DoCast(target,SPELL_DOMINATION); - domination_timer = 120000; }else domination_timer -=diff; */ - if (Knockdown_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN); Knockdown_Timer = 4000+rand()%8000; }else Knockdown_Timer -=diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_the_makerAI(Creature* pCreature) { return new boss_the_makerAI (pCreature); } - void AddSC_boss_the_maker() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/def_blood_furnace.h b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/def_blood_furnace.h index b845c66823f..9774cb7a00c 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/def_blood_furnace.h +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/def_blood_furnace.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_BLOOD_FURNACE_H #define DEF_BLOOD_FURNACE_H - #define DATA_THE_MAKER 1 #define DATA_BROGGOK 2 #define DATA_KELIDAN_THE_MAKER 3 diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp index 5a18ded0c08..4e980eec361 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp @@ -13,36 +13,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Blood_Furnace SD%Complete: 85 SDComment: SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ - #include "precompiled.h" #include "def_blood_furnace.h" - #define ENTRY_SEWER1 181823 #define ENTRY_SEWER2 181766 #define MAX_ENCOUNTER 3 - struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance { instance_blood_furnace(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 The_MakerGUID; uint64 BroggokGUID; uint64 Kelidan_The_BreakerGUID; - uint64 Door1GUID; uint64 Door2GUID; uint64 Door3GUID; uint64 Door4GUID; uint64 Door5GUID; uint64 Door6GUID; - uint64 PrisonCell1GUID; uint64 PrisonCell2GUID; uint64 PrisonCell3GUID; @@ -51,25 +44,20 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance uint64 PrisonCell6GUID; uint64 PrisonCell7GUID; uint64 PrisonCell8GUID; - uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - The_MakerGUID = 0; BroggokGUID = 0; Kelidan_The_BreakerGUID = 0; - Door1GUID = 0; Door2GUID = 0; Door3GUID = 0; Door4GUID = 0; Door5GUID = 0; Door6GUID = 0; - PrisonCell1GUID = 0; PrisonCell2GUID = 0; PrisonCell3GUID = 0; @@ -80,12 +68,10 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance PrisonCell8GUID = 0; } - void OnCreatureCreate(Creature* pCreature, bool add) { if (!add) return; - switch(pCreature->GetEntry()) { case 17381: The_MakerGUID = pCreature->GetGUID(); break; @@ -93,12 +79,10 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance case 17377: Kelidan_The_BreakerGUID = pCreature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { if (!add) return; - if (pGo->GetEntry() == 181766) //Final exit door Door1GUID = pGo->GetGUID(); if (pGo->GetEntry() == 181811) //The Maker Front door @@ -111,7 +95,6 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance Door5GUID = pGo->GetGUID(); if (pGo->GetEntry() == 181823) //Kelidan exit door Door6GUID = pGo->GetGUID(); - if (pGo->GetEntry() == 181813) //The Maker prison cell front right PrisonCell1GUID = pGo->GetGUID(); if (pGo->GetEntry() == 181814) //The Maker prison cell back right @@ -129,7 +112,6 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance if (pGo->GetEntry() == 181817) //Broggok prison cell back left PrisonCell8GUID = pGo->GetGUID(); } - uint64 GetData64(uint32 data) { switch(data) @@ -152,10 +134,8 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance case DATA_PRISON_CELL7: return PrisonCell7GUID; case DATA_PRISON_CELL8: return PrisonCell8GUID; } - return 0; } - void SetData(uint32 type, uint32 data) { switch(data) @@ -164,21 +144,16 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance case TYPE_BROGGOK_EVENT: m_auiEncounter[1] = data; break; case TYPE_KELIDAN_THE_BREAKER_EVENT: m_auiEncounter[2] = data; break; } - if (data == DONE) { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2]; - str_data = saveStream.str(); - SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } } - uint32 GetData(uint32 data) { switch(data) @@ -187,15 +162,12 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance case TYPE_BROGGOK_EVENT: return m_auiEncounter[1]; case TYPE_KELIDAN_THE_BREAKER_EVENT: return m_auiEncounter[2]; } - return 0; } - const char* Save() { return str_data.c_str(); } - void Load(const char* in) { if (!in) @@ -203,26 +175,20 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance OUT_LOAD_INST_DATA_FAIL; return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS || m_auiEncounter[i] == FAIL) m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_blood_furnace(Map* pMap) { return new instance_blood_furnace(pMap); } - void AddSC_instance_blood_furnace() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp index d1ec8b79b57..f2ab659f93c 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Omar_The_Unscarred SD%Complete: 90 SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core support before making it more proper. SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO_1 -1543009 #define SAY_AGGRO_2 -1543010 #define SAY_AGGRO_3 -1543011 @@ -31,7 +28,6 @@ EndScriptData */ #define SAY_KILL_1 -1543014 #define SAY_DIE -1543015 #define SAY_WIPE -1543016 - #define SPELL_ORBITAL_STRIKE 30637 #define SPELL_SHADOW_WHIP 30638 #define SPELL_TREACHEROUS_AURA 30695 @@ -40,7 +36,6 @@ EndScriptData */ #define SPELL_SHADOW_BOLT 30686 #define H_SPELL_SHADOW_BOLT 39297 #define SPELL_SUMMON_FIENDISH_HOUND 30707 - struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI { boss_omor_the_unscarredAI(Creature *c) : ScriptedAI(c) @@ -48,9 +43,7 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI SetCombatMovement(false); HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 OrbitalStrike_Timer; uint32 ShadowWhip_Timer; uint32 Aura_Timer; @@ -60,11 +53,9 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI uint32 SummonedCount; uint64 PlayerGUID; bool CanPullBack; - void Reset() { DoScriptText(SAY_WIPE, m_creature); - OrbitalStrike_Timer = 25000; ShadowWhip_Timer = 2000; Aura_Timer = 10000; @@ -75,40 +66,31 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI PlayerGUID = 0; CanPullBack = false; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void KilledUnit(Unit* victim) { if (rand()%2) return; - DoScriptText(SAY_KILL_1, m_creature); } - void JustSummoned(Creature* summoned) { DoScriptText(SAY_SUMMON, m_creature); - if (Unit* random = SelectUnit(SELECT_TARGET_RANDOM,0)) summoned->AI()->AttackStart(random); - ++SummonedCount; } - void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //only two may be wrong, perhaps increase timer and spawn periodically instead. if (SummonedCount < 2) { @@ -119,7 +101,6 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI Summon_Timer = 15000+rand()%15000; }else Summon_Timer -= diff; } - if (CanPullBack) { if (ShadowWhip_Timer < diff) @@ -144,18 +125,15 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) temp = m_creature->getVictim(); else temp = SelectUnit(SELECT_TARGET_RANDOM,0); - if (temp && temp->GetTypeId() == TYPEID_PLAYER) { DoCast(temp,SPELL_ORBITAL_STRIKE); OrbitalStrike_Timer = 14000+rand()%2000; PlayerGUID = temp->GetGUID(); - if (PlayerGUID) CanPullBack = true; } }else OrbitalStrike_Timer -= diff; - if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20) { if (DemonicShield_Timer < diff) @@ -164,43 +142,35 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI DemonicShield_Timer = 15000; }else DemonicShield_Timer -= diff; } - if (Aura_Timer < diff) { DoScriptText(SAY_CURSE, m_creature); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { DoCast(target,HEROIC(SPELL_TREACHEROUS_AURA, H_SPELL_BANE_OF_TREACHERY)); Aura_Timer = 8000+rand()%8000; } }else Aura_Timer -= diff; - if (Shadowbolt_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { if (target) target = m_creature->getVictim(); - DoCast(target,HEROIC(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); Shadowbolt_Timer = 4000+rand()%2500; } }else Shadowbolt_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_omor_the_unscarredAI(Creature* pCreature) { return new boss_omor_the_unscarredAI (pCreature); } - void AddSC_boss_omor_the_unscarred() { Script *newscript; - newscript = new Script; newscript->Name = "boss_omor_the_unscarred"; newscript->GetAI = &GetAI_boss_omor_the_unscarredAI; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp index 667c672c97d..fc793b83c8e 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData Name: Boss_Vazruden_the_Herald %Complete: 90 Comment: Category: Hellfire Citadel, Hellfire Ramparts EndScriptData */ - #include "precompiled.h" - #define SPELL_FIREBALL (HeroicMode?36920:34653) #define SPELL_CONE_OF_FIRE (HeroicMode?36921:30926) #define SPELL_SUMMON_LIQUID_FIRE (HeroicMode?30928:23971) @@ -30,14 +27,12 @@ EndScriptData */ #define SPELL_REVENGE (HeroicMode?40392:19130) #define SPELL_KIDNEY_SHOT 30621 #define SPELL_FIRE_NOVA_VISUAL 19823 - #define ENTRY_HELLFIRE_SENTRY 17517 #define ENTRY_VAZRUDEN_HERALD 17307 #define ENTRY_VAZRUDEN 17537 #define ENTRY_NAZAN 17536 #define ENTRY_LIQUID_FIRE 22515 #define ENTRY_REINFORCED_FEL_IRON_CHEST (HeroicMode?185169:185168) - #define SAY_INTRO -1543017 #define SAY_WIPE -1543018 #define SAY_AGGRO_1 -1543019 @@ -47,16 +42,13 @@ EndScriptData */ #define SAY_KILL_2 -1543023 #define SAY_DIE -1543024 #define EMOTE -1543025 - #define PATH_ENTRY 2081 - const float VazrudenMiddle[3] = {-1406.5, 1746.5, 81.2}; const float VazrudenRing[2][3] = { {-1430, 1705, 112}, {-1377, 1760, 112} }; - struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI { boss_nazanAI(Creature *c) : ScriptedAI(c) @@ -65,7 +57,6 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI VazrudenGUID = 0; flight = true; } - uint32 Fireball_Timer; uint32 ConeOfFire_Timer; uint32 BellowingRoar_Timer; @@ -76,7 +67,6 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI uint64 VazrudenGUID; bool HeroicMode; SpellEntry *liquid_fire; - void Reset() { Fireball_Timer = 4000; @@ -84,9 +74,7 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI Turn_Timer = 0; UnsummonCheck = 5000; } - void EnterCombat(Unit* who) {} - void JustSummoned(Creature *summoned) { if (summoned && summoned->GetEntry() == ENTRY_LIQUID_FIRE) @@ -97,13 +85,11 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI summoned->CastSpell(summoned,SPELL_FIRE_NOVA_VISUAL,true); } } - void SpellHitTarget(Unit* target, const SpellEntry* entry) { if (target && entry->Id == SPELL_FIREBALL) m_creature->SummonCreature(ENTRY_LIQUID_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),target->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,30000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -114,14 +100,12 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI UnsummonCheck -= diff; return; } - if (Fireball_Timer < diff) { if (Unit *victim = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(victim, SPELL_FIREBALL,true); Fireball_Timer = urand(4000,7000); } else Fireball_Timer -= diff; - if (flight) // phase 1 - the flight { Creature *Vazruden = Unit::GetCreature(*m_creature,VazrudenGUID); @@ -139,7 +123,6 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI DoScriptText(EMOTE, m_creature); return; }else Fly_Timer -= diff; - if (Turn_Timer < diff) { uint32 waypoint = (Fly_Timer/10000)%2; @@ -156,54 +139,45 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; - if (HeroicMode && BellowingRoar_Timer < diff) { DoCast(m_creature, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; - DoMeleeAttackIfReady(); } } }; - struct TRINITY_DLL_DECL boss_vazrudenAI : public ScriptedAI { boss_vazrudenAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 Revenge_Timer; bool HeroicMode; bool WipeSaid; uint32 UnsummonCheck; - void Reset() { Revenge_Timer = 4000; UnsummonCheck = 2000; WipeSaid = false; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void KilledUnit(Unit* who) { if (who && who->GetEntry()!=ENTRY_VAZRUDEN) DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void JustDied(Unit* who) { if (who && who != m_creature) DoScriptText(SAY_DIE, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -219,18 +193,15 @@ struct TRINITY_DLL_DECL boss_vazrudenAI : public ScriptedAI } else UnsummonCheck -= diff; return; } - if (Revenge_Timer < diff) { if (Unit *victim = m_creature->getVictim()) DoCast(victim, SPELL_REVENGE); Revenge_Timer = 5000; } else Revenge_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI { boss_vazruden_the_heraldAI(Creature *c) : ScriptedAI(c) @@ -241,7 +212,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI VazrudenGUID = 0; HeroicMode = m_creature->GetMap()->IsHeroic(); } - uint32 phase; uint32 waypoint; uint32 check; @@ -250,7 +220,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI uint64 VazrudenGUID; bool summoned; bool HeroicMode; - void Reset() { phase = 0; @@ -259,7 +228,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI UnsummonAdds(); m_creature->GetMotionMaster()->MovePath(PATH_ENTRY, true); } - void UnsummonAdds() { if (summoned) @@ -281,7 +249,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); } } - void SummonAdds() { if (!summoned) @@ -295,7 +262,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI m_creature->addUnitState(UNIT_STAT_ROOT); } } - void EnterCombat(Unit *who) { if (phase==0) @@ -305,7 +271,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI DoScriptText(SAY_INTRO, m_creature); } } - void JustSummoned(Creature *summoned) { if (!summoned) return; @@ -321,7 +286,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI else if (victim) summoned->AI()->AttackStart(victim); } - void SentryDownBy(Unit* killer) { if (sentryDown) @@ -332,7 +296,6 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI else sentryDown = true; } - void UpdateAI(const uint32 diff) { switch(phase) @@ -385,63 +348,50 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI } } }; - struct TRINITY_DLL_DECL mob_hellfire_sentryAI : public ScriptedAI { mob_hellfire_sentryAI(Creature *c) : ScriptedAI(c) {} - uint32 KidneyShot_Timer; - void Reset() { KidneyShot_Timer = urand(3000,7000); } - void EnterCombat(Unit* who) {} - void JustDied(Unit* who) { if (Creature *herald = me->FindNearestCreature(ENTRY_VAZRUDEN_HERALD,150)) CAST_AI(boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(who); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (KidneyShot_Timer < diff) { if (Unit *victim = m_creature->getVictim()) DoCast(victim, SPELL_KIDNEY_SHOT); KidneyShot_Timer = 20000; } else KidneyShot_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_vazruden_the_herald(Creature* pCreature) { return new boss_vazruden_the_heraldAI (pCreature); } - CreatureAI* GetAI_boss_vazruden(Creature* pCreature) { return new boss_vazrudenAI (pCreature); } - CreatureAI* GetAI_boss_nazan(Creature* pCreature) { return new boss_nazanAI (pCreature); } - CreatureAI* GetAI_mob_hellfire_sentry(Creature* pCreature) { return new mob_hellfire_sentryAI (pCreature); } - void AddSC_boss_vazruden_the_herald() { Script *newscript; @@ -449,17 +399,14 @@ void AddSC_boss_vazruden_the_herald() newscript->Name = "boss_vazruden_the_herald"; newscript->GetAI = &GetAI_boss_vazruden_the_herald; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_vazruden"; newscript->GetAI = &GetAI_boss_vazruden; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_nazan"; newscript->GetAI = &GetAI_boss_nazan; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_hellfire_sentry"; newscript->GetAI = &GetAI_mob_hellfire_sentry; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp index aa8fe3e20e9..e746e3d6259 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Watchkeeper_Gargolmar SD%Complete: 80 SDComment: Missing adds to heal him. Surge should be used on target furthest away, not random. SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ - #include "precompiled.h" - #define SAY_TAUNT -1543000 #define SAY_HEAL -1543001 #define SAY_SURGE -1543002 @@ -32,50 +29,40 @@ EndScriptData */ #define SAY_KILL_1 -1543006 #define SAY_KILL_2 -1543007 #define SAY_DIE -1543008 - #define SPELL_MORTAL_WOUND 30641 #define H_SPELL_MORTAL_WOUND 36814 #define SPELL_SURGE 34645 #define SPELL_RETALIATION 22857 - struct TRINITY_DLL_DECL boss_watchkeeper_gargolmarAI : public ScriptedAI { boss_watchkeeper_gargolmarAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 Surge_Timer; uint32 MortalWound_Timer; uint32 Retaliation_Timer; - bool HasTaunted; bool YelledForHeal; - void Reset() { Surge_Timer = 5000; MortalWound_Timer = 4000; Retaliation_Timer = 0; - HasTaunted = false; YelledForHeal = false; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void MoveInLineOfSight(Unit* who) { if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) { if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) { @@ -89,38 +76,30 @@ struct TRINITY_DLL_DECL boss_watchkeeper_gargolmarAI : public ScriptedAI } } } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (MortalWound_Timer < diff) { DoCast(m_creature->getVictim(),HEROIC(SPELL_MORTAL_WOUND, H_SPELL_MORTAL_WOUND)); MortalWound_Timer = 5000+rand()%8000; }else MortalWound_Timer -= diff; - if (Surge_Timer < diff) { DoScriptText(SAY_SURGE, m_creature); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_SURGE); - Surge_Timer = 5000+rand()%8000; }else Surge_Timer -= diff; - if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20) { if (Retaliation_Timer < diff) @@ -129,7 +108,6 @@ struct TRINITY_DLL_DECL boss_watchkeeper_gargolmarAI : public ScriptedAI Retaliation_Timer = 30000; }else Retaliation_Timer -= diff; } - if (!YelledForHeal) { if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 40) @@ -138,16 +116,13 @@ struct TRINITY_DLL_DECL boss_watchkeeper_gargolmarAI : public ScriptedAI YelledForHeal = true; } } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_watchkeeper_gargolmarAI(Creature* pCreature) { return new boss_watchkeeper_gargolmarAI (pCreature); } - void AddSC_boss_watchkeeper_gargolmar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h index 3c453949baa..d6227237bca 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h @@ -1,16 +1,12 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_RAMPARTS_H #define DEF_RAMPARTS_H - #define MAX_ENCOUNTER 2 - enum eEnums { TYPE_VAZRUDEN = 1, TYPE_NAZAN = 2 }; - #endif diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp index 5942f0142ef..26e8c9c9195 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp @@ -13,33 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Hellfire_Ramparts SD%Complete: 50 SDComment: SDCategory: Hellfire Ramparts EndScriptData */ - #include "precompiled.h" #include "def_hellfire_ramparts.h" - struct TRINITY_DLL_DECL instance_ramparts : public ScriptedInstance { instance_ramparts(Map* pMap) : ScriptedInstance(pMap) {Initialize();} - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint64 m_uiChestNGUID; uint64 m_uiChestHGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiChestNGUID = 0; m_uiChestHGUID = 0; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -48,11 +41,9 @@ struct TRINITY_DLL_DECL instance_ramparts : public ScriptedInstance case 185169: m_uiChestHGUID = pGo->GetGUID(); break; } } - void SetData(uint32 uiType, uint32 uiData) { debug_log("TSCR: Instance Ramparts: SetData received for type %u with data %u",uiType,uiData); - switch(uiType) { case TYPE_VAZRUDEN: @@ -68,12 +59,10 @@ struct TRINITY_DLL_DECL instance_ramparts : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_ramparts(Map* pMap) { return new instance_ramparts(pMap); } - void AddSC_instance_ramparts() { Script* pNewScript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp index 3f2dba74aa8..239eec11480 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Magtheridon SD%Complete: 60 SDComment: In Development SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ - #include "precompiled.h" #include "def_magtheridons_lair.h" - struct Yell { int32 id; }; - static Yell RandomTaunt[]= { {-1544000}, @@ -38,23 +34,19 @@ static Yell RandomTaunt[]= {-1544004}, {-1544005}, }; - #define SAY_FREED -1544006 #define SAY_AGGRO -1544007 #define SAY_BANISH -1544008 #define SAY_CHAMBER_DESTROY -1544009 #define SAY_PLAYER_KILLED -1544010 #define SAY_DEATH -1544011 - #define EMOTE_BERSERK -1544012 #define EMOTE_BLASTNOVA -1544013 #define EMOTE_BEGIN -1544014 - #define MOB_MAGTHERIDON 17257 #define MOB_ROOM 17516 #define MOB_CHANNELLER 17256 #define MOB_ABYSSAL 17454 - #define SPELL_BLASTNOVA 30616 #define SPELL_CLEAVE 30619 #define SPELL_QUAKE_TRIGGER 30657 // must be cast with 30561 as the proc spell @@ -66,28 +58,21 @@ static Yell RandomTaunt[]= #define SPELL_DEBRIS_DAMAGE 30631 // core bug, does not support target 8 #define SPELL_CAMERA_SHAKE 36455 #define SPELL_BERSERK 27680 - #define SPELL_SHADOW_CAGE 30168 #define SPELL_SHADOW_GRASP 30410 #define SPELL_SHADOW_GRASP_VISUAL 30166 #define SPELL_MIND_EXHAUSTION 44032 //Casted by the cubes when channeling ends - #define SPELL_SHADOW_CAGE_C 30205 #define SPELL_SHADOW_GRASP_C 30207 - #define SPELL_SHADOW_BOLT_VOLLEY 30510 #define SPELL_DARK_MENDING 30528 #define SPELL_FEAR 30530 //39176 #define SPELL_BURNING_ABYSSAL 30511 #define SPELL_SOUL_TRANSFER 30531 // core bug, does not support target 7 - #define SPELL_FIRE_BLAST 37110 - // count of clickers needed to interrupt blast nova #define CLICKERS_COUNT 5 - typedef std::map CubeMap; - struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI { mob_abyssalAI(Creature *c) : ScriptedAI(c) @@ -95,16 +80,13 @@ struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI trigger = 0; Despawn_Timer = 60000; } - uint32 FireBlast_Timer; uint32 Despawn_Timer; uint32 trigger; - void Reset() { FireBlast_Timer = 6000; } - void SpellHit(Unit*, const SpellEntry *spell) { if (trigger == 2 && spell->Id == SPELL_BLAZE_TARGET) @@ -114,7 +96,6 @@ struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI Despawn_Timer = 130000; } } - void SetTrigger(uint32 _trigger) { trigger = _trigger; @@ -127,11 +108,9 @@ struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI Despawn_Timer = 10000; } } - void EnterCombat(Unit* who) {DoZoneInCombat();} void AttackStart(Unit *who) {if (!trigger) ScriptedAI::AttackStart(who);} void MoveInLineOfSight(Unit *who) {if (!trigger) ScriptedAI::MoveInLineOfSight(who);} - void UpdateAI(const uint32 diff) { if (trigger) @@ -146,25 +125,20 @@ struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI } return; } - if (Despawn_Timer < diff) { m_creature->ForcedDespawn(); }else Despawn_Timer -= diff; - if (!UpdateVictim()) return; - if (FireBlast_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_FIRE_BLAST); FireBlast_Timer = 5000+rand()%10000; }else FireBlast_Timer -= diff; - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI { boss_magtheridonAI(Creature *c) : ScriptedAI(c) @@ -172,7 +146,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI pInstance = c->GetInstanceData(); m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); m_creature->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - // target 7, random target with certain entry spell, need core fix SpellEntry *TempSpell; TempSpell = GET_SPELL(SPELL_BLAZE_TARGET); @@ -187,11 +160,8 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI TempSpell->EffectTriggerSpell[0] = SPELL_QUAKE_KNOCKBACK; } } - CubeMap Cube; - ScriptedInstance* pInstance; - uint32 Berserk_Timer; uint32 Quake_Timer; uint32 Cleave_Timer; @@ -199,10 +169,8 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI uint32 Blaze_Timer; uint32 Debris_Timer; uint32 RandChat_Timer; - bool Phase3; bool NeedCheckCube; - void Reset() { Berserk_Timer = 1320000; @@ -212,17 +180,14 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI BlastNova_Timer = 60000; Cleave_Timer = 15000; RandChat_Timer = 90000; - Phase3 = false; NeedCheckCube = false; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); m_creature->addUnitState(UNIT_STAT_STUNNED); m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE_C, true); } - void JustReachedHome() { if (pInstance) @@ -231,7 +196,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI pInstance->SetData(DATA_COLLAPSE, false); } } - void SetClicker(uint64 cubeGUID, uint64 clickerGUID) { // to avoid multiclicks from 1 cube @@ -240,24 +204,21 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI Cube[cubeGUID] = clickerGUID; NeedCheckCube = true; } - //function to interrupt channeling and debuff clicker with mind exh(used if second person clicks with same cube or after dispeling/ending shadow grasp DoT) void DebuffClicker(Unit *clicker) { if (!clicker || !clicker->isAlive()) return; - clicker->RemoveAurasDueToSpell(SPELL_SHADOW_GRASP); // cannot interrupt triggered spells clicker->InterruptNonMeleeSpells(false); clicker->CastSpell(clicker, SPELL_MIND_EXHAUSTION, true); } - void NeedCheckCubeStatus() { uint32 ClickerNum = 0; // now checking if every clicker has debuff from manticron(it is dispelable atm rev 6110 : S) // if not - apply mind exhaustion and delete from clicker's list - for(CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i) + for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i) { Unit *clicker = Unit::GetUnit(*m_creature, (*i).second); if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP)) @@ -266,7 +227,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI (*i).second = 0; }else ClickerNum++; } - // if 5 clickers from other cubes apply shadow cage if (ClickerNum >= CLICKERS_COUNT && !m_creature->HasAura(SPELL_SHADOW_CAGE)) { @@ -275,43 +235,33 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI } else if (ClickerNum < CLICKERS_COUNT && m_creature->HasAura(SPELL_SHADOW_CAGE)) m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); - if (!ClickerNum) NeedCheckCube = false; } - void KilledUnit(Unit* victim) { DoScriptText(SAY_PLAYER_KILLED, m_creature); } - void JustDied(Unit* Killer) { if (pInstance) pInstance->SetData(DATA_MAGTHERIDON_EVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit *who) { if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) ScriptedAI::AttackStart(who); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_MAGTHERIDON_EVENT, IN_PROGRESS); DoZoneInCombat(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE_C); - DoScriptText(SAY_FREED, m_creature); } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat()) @@ -322,25 +272,20 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI RandChat_Timer = 90000; }else RandChat_Timer -= diff; } - if (!UpdateVictim()) return; - if (NeedCheckCube) NeedCheckCubeStatus(); - if (Berserk_Timer < diff) { m_creature->CastSpell(m_creature, SPELL_BERSERK, true); DoScriptText(EMOTE_BERSERK, m_creature); Berserk_Timer = 60000; }else Berserk_Timer -= diff; - if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = 10000; }else Cleave_Timer -= diff; - if (BlastNova_Timer < diff) { // to avoid earthquake interruption @@ -351,7 +296,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI BlastNova_Timer = 60000; } }else BlastNova_Timer -= diff; - if (Quake_Timer < diff) { // to avoid blastnova interruption @@ -361,7 +305,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI Quake_Timer = 50000; } }else Quake_Timer -= diff; - if (Blaze_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -378,7 +321,6 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI } Blaze_Timer = 20000 + rand()%20000; }else Blaze_Timer -= diff; - if (!Phase3 && m_creature->GetHealth()*10 < m_creature->GetMaxHealth()*3 && !m_creature->IsNonMeleeSpellCasted(false) // blast nova && !m_creature->hasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake @@ -387,11 +329,9 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI DoScriptText(SAY_CHAMBER_DESTROY, m_creature); m_creature->CastSpell(m_creature, SPELL_CAMERA_SHAKE, true); m_creature->CastSpell(m_creature, SPELL_DEBRIS_KNOCKDOWN, true); - if (pInstance) pInstance->SetData(DATA_COLLAPSE, true); } - if (Phase3) { if (Debris_Timer < diff) @@ -406,107 +346,86 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI Debris_Timer = 10000; }else Debris_Timer -= diff; } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_hellfire_channelerAI : public ScriptedAI { mob_hellfire_channelerAI(Creature *c) : ScriptedAI(c) { pInstance =m_creature->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 ShadowBoltVolley_Timer; uint32 DarkMending_Timer; uint32 Fear_Timer; uint32 Infernal_Timer; - uint32 Check_Timer; - void Reset() { ShadowBoltVolley_Timer = 8000 + rand()%2000; DarkMending_Timer = 10000; Fear_Timer = 15000 + rand()%5000; Infernal_Timer = 10000 + rand()%40000; - Check_Timer = 5000; } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_CHANNELER_EVENT, IN_PROGRESS); - m_creature->InterruptNonMeleeSpells(false); DoZoneInCombat(); } - void JustReachedHome() { if (pInstance) pInstance->SetData(DATA_CHANNELER_EVENT, NOT_STARTED); - m_creature->CastSpell(m_creature, SPELL_SHADOW_GRASP_C, false); } - void JustSummoned(Creature *summon) { summon->AI()->AttackStart(m_creature->getVictim()); } - void DamageTaken(Unit*, uint32 &damage) { if (damage >= m_creature->GetHealth()) m_creature->CastSpell(m_creature, SPELL_SOUL_TRANSFER, true); } - void JustDied(Unit* who) { if (pInstance) pInstance->SetData(DATA_CHANNELER_EVENT, DONE); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ShadowBoltVolley_Timer < diff) { DoCast(m_creature, SPELL_SHADOW_BOLT_VOLLEY); ShadowBoltVolley_Timer = 10000 + rand()%10000; }else ShadowBoltVolley_Timer -= diff; - if (DarkMending_Timer < diff) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) DoCast(m_creature, SPELL_DARK_MENDING); DarkMending_Timer = 10000 +(rand() % 10000); }else DarkMending_Timer -= diff; - if (Fear_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_FEAR); Fear_Timer = 25000 + rand()%15000; }else Fear_Timer -= diff; - if (Infernal_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) m_creature->CastSpell(target, SPELL_BURNING_ABYSSAL, true); Infernal_Timer = 30000 + rand()%10000; }else Infernal_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Manticron Cube bool GOHello_go_Manticron_Cube(Player* pPlayer, GameObject* pGo) { @@ -516,33 +435,27 @@ bool GOHello_go_Manticron_Cube(Player* pPlayer, GameObject* pGo) if (pInstance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; Creature *Magtheridon =Unit::GetCreature(*pGo, pInstance->GetData64(DATA_MAGTHERIDON)); if (!Magtheridon || !Magtheridon->isAlive()) return true; - // if exhausted or already channeling return if (pPlayer->HasAura(SPELL_MIND_EXHAUSTION) || pPlayer->HasAura(SPELL_SHADOW_GRASP)) return true; - pPlayer->InterruptNonMeleeSpells(false); pPlayer->CastSpell(pPlayer, SPELL_SHADOW_GRASP, true); pPlayer->CastSpell(pPlayer, SPELL_SHADOW_GRASP_VISUAL, false); CAST_AI(boss_magtheridonAI, Magtheridon->AI())->SetClicker(pGo->GetGUID(), pPlayer->GetGUID()); return true; } - CreatureAI* GetAI_boss_magtheridon(Creature* pCreature) { return new boss_magtheridonAI(pCreature); } - CreatureAI* GetAI_mob_hellfire_channeler(Creature* pCreature) { return new mob_hellfire_channelerAI(pCreature); } - CreatureAI* GetAI_mob_abyssalAI(Creature* pCreature) { return new mob_abyssalAI(pCreature); } - void AddSC_boss_magtheridon() { Script *newscript; @@ -550,21 +463,17 @@ void AddSC_boss_magtheridon() newscript->Name = "boss_magtheridon"; newscript->GetAI = &GetAI_boss_magtheridon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_hellfire_channeler"; newscript->GetAI = &GetAI_mob_hellfire_channeler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_manticron_cube"; newscript->pGOHello = &GOHello_go_Manticron_Cube; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_abyssal"; newscript->GetAI = &GetAI_mob_abyssalAI; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h index c5469acaea0..2fb87069fa9 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_MAGTHERIDONS_LAIR_H #define DEF_MAGTHERIDONS_LAIR_H - #define DATA_MAGTHERIDON_EVENT 1 #define DATA_MAGTHERIDON 3 #define DATA_CHANNELER_EVENT 2 diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp index 33946926976..2acdae10f37 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp @@ -13,65 +13,50 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Magtheridons_Lair SD%Complete: 100 SDComment: SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ - #include "precompiled.h" #include "def_magtheridons_lair.h" - #define SPELL_SOUL_TRANSFER 30531 // core bug, does not support target 7 #define SPELL_BLAZE_TARGET 30541 // core bug, does not support target 7 - #define CHAMBER_CENTER_X -15.14 #define CHAMBER_CENTER_Y 1.8 #define CHAMBER_CENTER_Z -0.4 - #define MAX_ENCOUNTER 2 - #define EMOTE_BONDS_WEAKEN "'s bonds begin to weaken!" - struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance { instance_magtheridons_lair(Map* pMap) : ScriptedInstance(pMap) { Initialize(); } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 MagtheridonGUID; std::set ChannelerGUID; uint64 DoorGUID; std::set ColumnGUID; - uint32 CageTimer; uint32 RespawnTimer; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - MagtheridonGUID = 0; ChannelerGUID.clear(); DoorGUID = 0; ColumnGUID.clear(); - CageTimer = 0; RespawnTimer = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -84,7 +69,6 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance break; } } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -106,7 +90,6 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance break; } } - uint64 GetData64(uint32 type) { switch(type) @@ -116,7 +99,6 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -135,7 +117,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance if (m_auiEncounter[1] != NOT_STARTED) { m_auiEncounter[1] = NOT_STARTED; - for(std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature *Channeler = instance->GetCreature(*i)) { @@ -153,7 +135,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance { m_auiEncounter[1] = IN_PROGRESS; // Let all five channelers aggro. - for(std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature *Channeler = instance->GetCreature(*i); if (Channeler && Channeler->isAlive()) @@ -169,7 +151,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance HandleGameObject(DoorGUID, false); }break; case DONE: // Add buff and check if all channelers are dead. - for(std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature *Channeler = instance->GetCreature(*i); if (Channeler && Channeler->isAlive()) @@ -184,21 +166,19 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance break; case DATA_COLLAPSE: // true - collapse / false - reset - for(std::set::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) + for (std::set::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) DoUseDoorOrButton(*i); break; default: break; } } - uint32 GetData(uint32 type) { if (type == DATA_MAGTHERIDON_EVENT) return m_auiEncounter[0]; return 0; } - void Update(uint32 diff) { if (CageTimer) @@ -214,12 +194,11 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance CageTimer = 0; }else CageTimer -= diff; } - if (RespawnTimer) { if (RespawnTimer <= diff) { - for(std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature *Channeler = instance->GetCreature(*i)) { @@ -234,12 +213,10 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_magtheridons_lair(Map* pMap) { return new instance_magtheridons_lair(pMap); } - void AddSC_instance_magtheridons_lair() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp index 4ae379d988e..c29269bd7ab 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp @@ -13,28 +13,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Grand_Warlock_Nethekurse SD%Complete: 75 SDComment: encounter not fully completed. missing part where boss kill minions. SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ - /* ContentData boss_grand_warlock_nethekurse mob_fel_orc_convert mob_lesser_shadow_fissure EndContentData */ - #include "precompiled.h" #include "def_shattered_halls.h" - struct Say { int32 id; }; - static Say PeonAttacked[]= { {-1540001}, @@ -49,7 +44,6 @@ static Say PeonDies[]= {-1540007}, {-1540008}, }; - #define SAY_INTRO -1540000 #define SAY_TAUNT_1 -1540009 #define SAY_TAUNT_2 -1540010 @@ -60,19 +54,14 @@ static Say PeonDies[]= #define SAY_SLAY_1 -1540015 #define SAY_SLAY_2 -1540016 #define SAY_DIE -1540017 - #define SPELL_DEATH_COIL 30500 #define SPELL_DARK_SPIN 30502 // core bug spell attack caster :D #define SPELL_SHADOW_FISSURE 30496 // Summon the ShadowFissure NPC - #define SPELL_SHADOW_CLEAVE 30495 #define H_SPELL_SHADOW_SLAM 35953 - #define SPELL_HEMORRHAGE 30478 - #define SPELL_CONSUMPTION 30497 #define SPELL_TEMPORARY_VISUAL 39312 // this is wrong, a temporary solution. spell consumption already has the purple visual, but doesn't display as it should - struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI { boss_grand_warlock_nethekurseAI(Creature *c) : ScriptedAI(c) @@ -80,62 +69,49 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - bool IntroOnce; bool IsIntroEvent; bool IsMainEvent; bool SpinOnce; //bool HasTaunted; bool Phase; - uint32 PeonEngagedCount; uint32 PeonKilledCount; - uint32 IntroEvent_Timer; uint32 DeathCoil_Timer; uint32 ShadowFissure_Timer; uint32 Cleave_Timer; - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - IsIntroEvent = false; IntroOnce = false; IsMainEvent = false; //HasTaunted = false; SpinOnce = false; Phase = false; - PeonEngagedCount = 0; PeonKilledCount = 0; - IntroEvent_Timer = 90000; //how long before getting bored and kills his minions? DeathCoil_Timer = 20000; ShadowFissure_Timer = 8000; Cleave_Timer = 5000; } - void DoYellForPeonAggro() { if (PeonEngagedCount >= 4) return; - DoScriptText(PeonAttacked[PeonEngagedCount].id, m_creature); ++PeonEngagedCount; } - void DoYellForPeonDeath() { if (PeonKilledCount >= 4) return; - DoScriptText(PeonDies[PeonKilledCount].id, m_creature); ++PeonKilledCount; - if (PeonKilledCount == 4) { IsIntroEvent = false; @@ -143,11 +119,9 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } } - void DoTauntPeons() { DoScriptText(RAND(SAY_TAUNT_1,SAY_TAUNT_2,SAY_TAUNT_3), m_creature); - //TODO: kill the peons first IsIntroEvent = false; PeonEngagedCount = 4; @@ -155,12 +129,10 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI IsMainEvent = true; m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void AttackStart(Unit* who) { if (IsIntroEvent || !IsMainEvent) return; - if (m_creature->Attack(who, true)) { if (Phase) @@ -169,67 +141,53 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI DoStartMovement(who); } } - void MoveInLineOfSight(Unit *who) { if (!IntroOnce && m_creature->IsWithinDistInMap(who, 50.0f)) { if (who->GetTypeId() != TYPEID_PLAYER) return; - DoScriptText(SAY_INTRO, m_creature); IntroOnce = true; IsIntroEvent = true; - if (pInstance) pInstance->SetData(TYPE_NETHEKURSE,IN_PROGRESS); } - if (IsIntroEvent || !IsMainEvent) return; - ScriptedAI::MoveInLineOfSight(who); } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), m_creature); } - void JustSummoned(Creature *summoned) { summoned->setFaction(16); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //triggered spell of consumption does not properly show it's SpellVisual, wrong spellid? summoned->CastSpell(summoned,SPELL_TEMPORARY_VISUAL,true); summoned->CastSpell(summoned,SPELL_CONSUMPTION,false,0,0,m_creature->GetGUID()); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); - if (!pInstance) return; - pInstance->SetData(TYPE_NETHEKURSE,DONE); pInstance->HandleGameObject(pInstance->GetData64(DATA_NETHEKURSE_DOOR), true); } - void UpdateAI(const uint32 diff) { if (IsIntroEvent) { if (!pInstance) return; - if (pInstance->GetData(TYPE_NETHEKURSE) == IN_PROGRESS) { if (IntroEvent_Timer < diff) @@ -238,13 +196,10 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI IntroEvent_Timer -= diff; } } - if (!UpdateVictim()) return; - if (!IsMainEvent) return; - if (Phase) { if (!SpinOnce) @@ -252,7 +207,6 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_DARK_SPIN); SpinOnce = true; } - if (Cleave_Timer < diff) { DoCast(m_creature->getVictim(),HEROIC(SPELL_SHADOW_CLEAVE, H_SPELL_SHADOW_SLAM)); @@ -267,42 +221,34 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI DoCast(target,SPELL_SHADOW_FISSURE); ShadowFissure_Timer = urand(7500,15000); } else ShadowFissure_Timer -= diff; - if (DeathCoil_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_DEATH_COIL); DeathCoil_Timer = urand(15000,20000); } else DeathCoil_Timer -= diff; - if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 20) Phase = true; - DoMeleeAttackIfReady(); } } }; - struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI { mob_fel_orc_convertAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; uint32 Hemorrhage_Timer; - void Reset() { m_creature->SetNoCallAssistance(true); //we don't want any assistance (WE R HEROZ!) Hemorrhage_Timer = 3000; } - void MoveInLineOfSight(Unit *who) { } - void EnterCombat(Unit* who) { if (pInstance) @@ -313,7 +259,6 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI if (pKurse && m_creature->IsWithinDist(pKurse, 45.0f)) { CAST_AI(boss_grand_warlock_nethekurseAI, pKurse->AI())->DoYellForPeonAggro(); - if (pInstance->GetData(TYPE_NETHEKURSE) == IN_PROGRESS) return; else @@ -322,7 +267,6 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI } } } - void JustDied(Unit* Killer) { if (pInstance) @@ -334,62 +278,50 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI CAST_AI(boss_grand_warlock_nethekurseAI, pKurse->AI())->DoYellForPeonDeath(); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Hemorrhage_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_HEMORRHAGE); Hemorrhage_Timer = 15000; }else Hemorrhage_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //NOTE: this Creature are also summoned by other spells, for different creatures struct TRINITY_DLL_DECL mob_lesser_shadow_fissureAI : public ScriptedAI { mob_lesser_shadow_fissureAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } void MoveInLineOfSight(Unit *who) { } void AttackStart(Unit* who) { } void EnterCombat(Unit* who) { } }; - CreatureAI* GetAI_boss_grand_warlock_nethekurse(Creature* pCreature) { return new boss_grand_warlock_nethekurseAI (pCreature); } - CreatureAI* GetAI_mob_fel_orc_convert(Creature* pCreature) { return new mob_fel_orc_convertAI (pCreature); } - CreatureAI* GetAI_mob_lesser_shadow_fissure(Creature* pCreature) { return new mob_lesser_shadow_fissureAI (pCreature); } - void AddSC_boss_grand_warlock_nethekurse() { Script *newscript; - newscript = new Script; newscript->Name = "boss_grand_warlock_nethekurse"; newscript->GetAI = &GetAI_boss_grand_warlock_nethekurse; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_fel_orc_convert"; newscript->GetAI = &GetAI_mob_fel_orc_convert; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_lesser_shadow_fissure"; newscript->GetAI = &GetAI_mob_lesser_shadow_fissure; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp index 2fe6fec2684..d715b1ea5fc 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp @@ -13,45 +13,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warbringer_Omrogg SD%Complete: 85 SDComment: Heroic enabled. Spell timing may need additional tweaks SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ - /* ContentData mob_omrogg_heads boss_warbringer_omrogg EndContentData */ - #include "precompiled.h" #include "def_shattered_halls.h" - enum eEnums { YELL_DIE_L = -1540039, YELL_DIE_R = -1540040, EMOTE_ENRAGE = -1540041, - SPELL_BLAST_WAVE = 30600, SPELL_FEAR = 30584, SPELL_THUNDERCLAP = 30633, - SPELL_BURNING_MAUL = 30598, H_SPELL_BURNING_MAUL = 36056, - NPC_LEFT_HEAD = 19523, NPC_RIGHT_HEAD = 19524 }; - struct Yell { int32 id; uint32 creature; }; - static Yell GoCombat[]= { {-1540018, NPC_LEFT_HEAD}, @@ -64,7 +55,6 @@ static Yell GoCombatDelay[]= {-1540022, NPC_RIGHT_HEAD}, {-1540023, NPC_RIGHT_HEAD}, }; - static Yell Threat[]= { {-1540024, NPC_LEFT_HEAD}, @@ -86,7 +76,6 @@ static Yell ThreatDelay2[]= {-1540034, NPC_LEFT_HEAD}, {-1540035, NPC_LEFT_HEAD}, }; - static Yell Killing[]= { {-1540036, NPC_LEFT_HEAD}, @@ -97,31 +86,25 @@ static Yell KillingDelay[]= {-1540038, NPC_RIGHT_HEAD}, {-1000000, NPC_LEFT_HEAD}, }; - struct TRINITY_DLL_DECL mob_omrogg_headsAI : public ScriptedAI { mob_omrogg_headsAI(Creature *c) : ScriptedAI(c) {} - bool DeathYell; uint32 Death_Timer; - void Reset() { Death_Timer = 4000; DeathYell = false; } void EnterCombat(Unit* who) { } - void DoDeathYell() { DeathYell = true; } - void UpdateAI(const uint32 diff) { if (!DeathYell) return; - if (Death_Timer < diff) { DoScriptText(YELL_DIE_R, m_creature); @@ -130,7 +113,6 @@ struct TRINITY_DLL_DECL mob_omrogg_headsAI : public ScriptedAI }else Death_Timer -= diff; } }; - struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI { boss_warbringer_omroggAI(Creature *c) : ScriptedAI(c) @@ -140,21 +122,17 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; bool HeroicMode; - uint64 LeftHeadGUID; uint64 RightHeadGUID; int iaggro; int ithreat; int ikilling; - bool AggroYell; bool ThreatYell; bool ThreatYell2; bool KillingYell; - uint32 Delay_Timer; uint32 BlastWave_Timer; uint32 BlastCount; @@ -162,7 +140,6 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI uint32 BurningMaul_Timer; uint32 ThunderClap_Timer; uint32 ResetThreat_Timer; - void Reset() { if (Unit* pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID)) @@ -170,19 +147,16 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI pLeftHead->setDeathState(JUST_DIED); LeftHeadGUID = 0; } - if (Unit* pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID)) { pRightHead->setDeathState(JUST_DIED); RightHeadGUID = 0; } - AggroYell = false; ThreatYell = false; ThreatYell2 = false; KillingYell = false; - Delay_Timer = 4000; BlastWave_Timer = 0; BlastCount = 0; @@ -190,74 +164,54 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI BurningMaul_Timer = 25000; ThunderClap_Timer = 15000; ResetThreat_Timer = 30000; - if (pInstance) pInstance->SetData(TYPE_OMROGG, NOT_STARTED); //End boss can use this later. O'mrogg must be defeated(DONE) or he will come to aid. } - void DoYellForThreat() { Unit *pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID); Unit *pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID); - if (!pLeftHead || !pRightHead) return; - ithreat = rand()%4; - Unit *source = (pLeftHead->GetEntry() == Threat[ithreat].creature ? pLeftHead : pRightHead); - DoScriptText(Threat[ithreat].id, source); - Delay_Timer = 3500; ThreatYell = true; } - void EnterCombat(Unit *who) { m_creature->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); m_creature->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Unit *pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID)) { iaggro = rand()%3; - DoScriptText(GoCombat[iaggro].id, pLeftHead); - Delay_Timer = 3500; AggroYell = true; } - if (pInstance) pInstance->SetData(TYPE_OMROGG, IN_PROGRESS); } - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == NPC_LEFT_HEAD) LeftHeadGUID = summoned->GetGUID(); - if (summoned->GetEntry() == NPC_RIGHT_HEAD) RightHeadGUID = summoned->GetGUID(); - //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summoned->SetVisibility(VISIBILITY_OFF); } - void KilledUnit(Unit* victim) { Unit* pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID); Unit* pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID); - if (!pLeftHead || !pRightHead) return; - ikilling = rand()%2; - Unit *source = (pLeftHead->GetEntry() == Killing[ikilling].creature ? pLeftHead : pRightHead); - switch(ikilling) { case 0: @@ -271,80 +225,61 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI break; } } - void JustDied(Unit* Killer) { Unit* pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID); Unit* pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID); - if (!pLeftHead || !pRightHead) return; - DoScriptText(YELL_DIE_L, pLeftHead); - CAST_AI(mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell(); - if (pInstance) pInstance->SetData(TYPE_OMROGG, DONE); } - void UpdateAI(const uint32 diff) { if (Delay_Timer < diff) { Delay_Timer = 3500; - Unit* pLeftHead = Unit::GetUnit(*m_creature,LeftHeadGUID); Unit* pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID); - if (!pLeftHead || !pRightHead) return; - if (AggroYell) { DoScriptText(GoCombatDelay[iaggro].id, pRightHead); AggroYell = false; } - if (ThreatYell2) { Unit *source = (pLeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? pLeftHead : pRightHead); - DoScriptText(ThreatDelay2[ithreat].id, source); ThreatYell2 = false; } - if (ThreatYell) { Unit *source = (pLeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? pLeftHead : pRightHead); - DoScriptText(ThreatDelay1[ithreat].id, source); ThreatYell = false; ThreatYell2 = true; } - if (KillingYell) { Unit *source = (pLeftHead->GetEntry() == KillingDelay[ikilling].creature ? pLeftHead : pRightHead); - DoScriptText(KillingDelay[ikilling].id, source); KillingYell = false; } }else Delay_Timer -= diff; - if (!UpdateVictim()) return; - if (BlastCount && BlastWave_Timer <= diff) { DoCast(m_creature,SPELL_BLAST_WAVE); BlastWave_Timer = 5000; ++BlastCount; - if (BlastCount == 3) BlastCount = 0; }else BlastWave_Timer -= diff; - if (BurningMaul_Timer < diff) { DoScriptText(EMOTE_ENRAGE, m_creature); @@ -353,7 +288,6 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI BlastWave_Timer = 16000; BlastCount = 1; }else BurningMaul_Timer -= diff; - if (ResetThreat_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) @@ -364,42 +298,34 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI } ResetThreat_Timer = 25000+rand()%15000; }else ResetThreat_Timer -= diff; - if (Fear_Timer < diff) { DoCast(m_creature,SPELL_FEAR); Fear_Timer = 15000+rand()%20000; }else Fear_Timer -= diff; - if (ThunderClap_Timer < diff) { DoCast(m_creature,SPELL_THUNDERCLAP); ThunderClap_Timer = 15000+rand()%15000; }else ThunderClap_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_warbringer_omrogg(Creature* pCreature) { return new boss_warbringer_omroggAI (pCreature); } - CreatureAI* GetAI_mob_omrogg_heads(Creature* pCreature) { return new mob_omrogg_headsAI (pCreature); } - void AddSC_boss_warbringer_omrogg() { Script *newscript; - newscript = new Script; newscript->Name = "boss_warbringer_omrogg"; newscript->GetAI = &GetAI_boss_warbringer_omrogg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_omrogg_heads"; newscript->GetAI = &GetAI_mob_omrogg_heads; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp index 98a5cea12c3..f01cf7ebad2 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp @@ -13,89 +13,68 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warchief_Kargath_Bladefist SD%Complete: 90 SDComment: SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ - /* ContentData boss_warchief_kargath_bladefist EndContentData */ - #include "precompiled.h" - #define SAY_AGGRO1 -1540042 #define SAY_AGGRO2 -1540043 #define SAY_AGGRO3 -1540044 #define SAY_SLAY1 -1540045 #define SAY_SLAY2 -1540046 #define SAY_DEATH -1540047 - #define SPELL_BLADE_DANCE 30739 #define H_SPELL_CHARGE 25821 - #define TARGET_NUM 5 - #define MOB_SHATTERED_ASSASSIN 17695 #define MOB_HEARTHEN_GUARD 17621 #define MOB_SHARPSHOOTER_GUARD 17622 #define MOB_REAVER_GUARD 17623 - float AssassEntrance[3] = {275.136,-84.29,2.3}; // y -8 float AssassExit[3] = {184.233,-84.29,2.3}; // y -8 float AddsEntrance[3] = {306.036,-84.29,1.93}; - struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI { boss_warchief_kargath_bladefistAI(Creature *c) : ScriptedAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - std::vector adds; std::vector assassins; - uint32 Charge_timer; uint32 Blade_Dance_Timer; uint32 Summon_Assistant_Timer; uint32 resetcheck_timer; uint32 Wait_Timer; - uint32 Assassins_Timer; - uint32 summoned; bool InBlade; - uint32 target_num; - void Reset() { removeAdds(); - m_creature->SetSpeed(MOVE_RUN,2); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - summoned = 2; InBlade = false; Wait_Timer = 0; - Charge_timer = 0; Blade_Dance_Timer = 45000; Summon_Assistant_Timer = 30000; Assassins_Timer = 5000; resetcheck_timer = 5000; } - void EnterCombat(Unit *who) { DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature); } - void JustSummoned(Creature *summoned) { switch(summoned->GetEntry()) @@ -111,7 +90,6 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI break; } } - void KilledUnit(Unit *victim) { if (victim->GetTypeId() == TYPEID_PLAYER) @@ -119,23 +97,19 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); removeAdds(); } - void MovementInform(uint32 type, uint32 id) { if (InBlade) { if (type != POINT_MOTION_TYPE) return; - if (id != 1) return; - if (target_num > 0) // to prevent loops { Wait_Timer = 1; @@ -144,10 +118,9 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI } } } - void removeAdds() { - for(std::vector::iterator itr = adds.begin(); itr!= adds.end(); ++itr) + for (std::vector::iterator itr = adds.begin(); itr!= adds.end(); ++itr) { Unit* temp = Unit::GetUnit((*m_creature),*itr); if (temp && temp->isAlive()) @@ -158,8 +131,7 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI } } adds.clear(); - - for(std::vector::iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) + for (std::vector::iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { Unit* temp = Unit::GetUnit((*m_creature),*itr); if (temp && temp->isAlive()) @@ -178,20 +150,17 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI m_creature->SummonCreature(MOB_SHATTERED_ASSASSIN,AssassExit[0],AssassExit[1]+8, AssassExit[2], 0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); m_creature->SummonCreature(MOB_SHATTERED_ASSASSIN,AssassExit[0],AssassExit[1]-8, AssassExit[2], 0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Assassins_Timer) if (Assassins_Timer <= diff) { SpawnAssassin(); Assassins_Timer = 0; }else Assassins_Timer -= diff; - if (InBlade) { if (Wait_Timer) @@ -233,19 +202,16 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI m_creature->SetSpeed(MOVE_RUN,4); return; }else Blade_Dance_Timer -= diff; - if (Charge_timer) if (Charge_timer <= diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM,0),H_SPELL_CHARGE); Charge_timer = 0; }else Charge_timer -= diff; - if (Summon_Assistant_Timer < diff) { Unit* target = NULL; - - for(uint8 i = 0; i < summoned; ++i) + for (uint8 i = 0; i < summoned; ++i) { switch(rand()%3) { @@ -257,10 +223,8 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI if (rand()%100 < 20) summoned++; Summon_Assistant_Timer = 25000 + (rand()%10000) ; }else Summon_Assistant_Timer -= diff; - DoMeleeAttackIfReady(); } - if (resetcheck_timer < diff) { uint32 tempx,tempy; @@ -275,12 +239,10 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI }else resetcheck_timer -= diff; } }; - CreatureAI* GetAI_boss_warchief_kargath_bladefist(Creature* pCreature) { return new boss_warchief_kargath_bladefistAI (pCreature); } - void AddSC_boss_warchief_kargath_bladefist() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/def_shattered_halls.h b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/def_shattered_halls.h index cbfa23ec4e0..91815f29de6 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/def_shattered_halls.h +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/def_shattered_halls.h @@ -1,14 +1,11 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_SHATTERED_H #define DEF_SHATTERED_H - #define TYPE_NETHEKURSE 1 #define DATA_NETHEKURSE 2 #define DATA_NETHEKURSE_DOOR 3 - #define TYPE_OMROGG 4 #endif diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp index 864a49a84ba..f8d47c4c3f2 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp @@ -13,37 +13,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Shattered_Halls SD%Complete: 50 SDComment: currently missing info about door. instance not complete SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ - #include "precompiled.h" #include "def_shattered_halls.h" - #define MAX_ENCOUNTER 2 - #define DOOR_NETHEKURSE 1 - struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance { instance_shattered_halls(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; uint64 nethekurseGUID; uint64 nethekurseDoorGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - nethekurseGUID = 0; nethekurseDoorGUID = 0; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -51,7 +42,6 @@ struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance case DOOR_NETHEKURSE: nethekurseDoorGUID = pGo->GetGUID(); break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -59,7 +49,6 @@ struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance case 16807: nethekurseGUID = pCreature->GetGUID(); break; } } - void SetData(uint32 type, uint32 data) { switch(type) @@ -72,7 +61,6 @@ struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance break; } } - uint32 GetData(uint32 type) { switch(type) @@ -84,7 +72,6 @@ struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -97,12 +84,10 @@ struct TRINITY_DLL_DECL instance_shattered_halls : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_shattered_halls(Map* pMap) { return new instance_shattered_halls(pMap); } - void AddSC_instance_shattered_halls() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp index fe0a52e2c47..077ac13e1de 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Hellfire_Peninsula SD%Complete: 100 SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) SDCategory: Hellfire Peninsula EndScriptData */ - /* ContentData npc_aeranas npc_ancestral_wolf @@ -30,48 +28,36 @@ npc_tracy_proudwell npc_trollbane npc_wounded_blood_elf EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_aeranas ######*/ - enum eAeranas { SAY_SUMMON = -1000138, SAY_FREE = -1000139, - FACTION_HOSTILE = 16, FACTION_FRIENDLY = 35, - SPELL_ENVELOPING_WINDS = 15535, SPELL_SHOCK = 12553, - C_AERANAS = 17085 }; - struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI { npc_aeranasAI(Creature* c) : ScriptedAI(c) {} - uint32 Faction_Timer; uint32 EnvelopingWinds_Timer; uint32 Shock_Timer; - void Reset() { Faction_Timer = 8000; EnvelopingWinds_Timer = 9000; Shock_Timer = 5000; - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); m_creature->setFaction(FACTION_FRIENDLY); - DoScriptText(SAY_SUMMON, m_creature); } - void UpdateAI(const uint32 diff) { if (Faction_Timer) @@ -82,10 +68,8 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI Faction_Timer = 0; }else Faction_Timer -= diff; } - if (!UpdateVictim()) return; - if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 30) { m_creature->setFaction(FACTION_FRIENDLY); @@ -96,43 +80,34 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI DoScriptText(SAY_FREE, m_creature); return; } - if (Shock_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHOCK); Shock_Timer = 10000; }else Shock_Timer -= diff; - if (EnvelopingWinds_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ENVELOPING_WINDS); EnvelopingWinds_Timer = 25000; }else EnvelopingWinds_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_aeranas(Creature* pCreature) { return new npc_aeranasAI (pCreature); } - /*###### ## npc_ancestral_wolf ######*/ - enum eAncestralWolf { EMOTE_WOLF_LIFT_HEAD = -1000496, EMOTE_WOLF_HOWL = -1000497, SAY_WOLF_WELCOME = -1000498, - SPELL_ANCESTRAL_WOLF_BUFF = 29981, - NPC_RYGA = 17123 }; - struct TRINITY_DLL_DECL npc_ancestral_wolfAI : public npc_escortAI { npc_ancestral_wolfAI(Creature* pCreature) : npc_escortAI(pCreature) @@ -141,27 +116,21 @@ struct TRINITY_DLL_DECL npc_ancestral_wolfAI : public npc_escortAI Start(false, false, pCreature->GetOwner()->GetGUID()); else error_log("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); - pCreature->SetSpeed(MOVE_WALK, 1.5f); Reset(); } - Unit* pRyga; - void Reset() { pRyga = NULL; m_creature->CastSpell(m_creature, SPELL_ANCESTRAL_WOLF_BUFF, true); } - void MoveInLineOfSight(Unit* pWho) { if (!pRyga && pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_RYGA && m_creature->IsWithinDistInMap(pWho, 15.0f)) pRyga = pWho; - npc_escortAI::MoveInLineOfSight(pWho); } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) @@ -179,80 +148,62 @@ struct TRINITY_DLL_DECL npc_ancestral_wolfAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_ancestral_wolf(Creature* pCreature) { return new npc_ancestral_wolfAI(pCreature); } - /*###### ## go_haaleshi_altar ######*/ - bool GOHello_go_haaleshi_altar(Player* pPlayer, GameObject* pGo) { pGo->SummonCreature(C_AERANAS,-1321.79, 4043.80, 116.24, 1.25, TEMPSUMMON_TIMED_DESPAWN, 180000); return false; } - /*###### ## npc_naladu ######*/ - #define GOSSIP_NALADU_ITEM1 "Why don't you escape?" - enum eNaladu { GOSSIP_TEXTID_NALADU1 = 9788 }; - bool GossipHello_npc_naladu(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NALADU_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_naladu(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, pCreature->GetGUID()); - return true; } - /*###### ## npc_tracy_proudwell ######*/ - #define GOSSIP_TEXT_REDEEM_MARKS "I have marks to redeem!" #define GOSSIP_TRACY_PROUDWELL_ITEM1 "I heard that your dog Fei Fei took Klatu's prayer beads..." #define GOSSIP_TRACY_PROUDWELL_ITEM2 "" - enum eTracy { GOSSIP_TEXTID_TRACY_PROUDWELL1 = 10689, QUEST_DIGGING_FOR_PRAYER_BEADS = 10916 }; - bool GossipHello_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_REDEEM_MARKS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pPlayer->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -268,36 +219,29 @@ bool GossipSelect_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature, uint pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break; } - return true; } - /*###### ## npc_trollbane ######*/ - #define GOSSIP_TROLLBANE_ITEM1 "Tell me of the Sons of Lothar." #define GOSSIP_TROLLBANE_ITEM2 "" #define GOSSIP_TROLLBANE_ITEM3 "Tell me of your homeland." - enum eTrollbane { GOSSIP_TEXTID_TROLLBANE1 = 9932, GOSSIP_TEXTID_TROLLBANE2 = 9933, GOSSIP_TEXTID_TROLLBANE3 = 8772 }; - bool GossipHello_npc_trollbane(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_trollbane(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -313,14 +257,11 @@ bool GossipSelect_npc_trollbane(Player* pPlayer, Creature* pCreature, uint32 uiS pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE3, pCreature->GetGUID()); break; } - return true; } - /*###### ## npc_wounded_blood_elf ######*/ - enum eWoundedBloodElf { SAY_ELF_START = -1000117, @@ -329,21 +270,16 @@ enum eWoundedBloodElf SAY_ELF_SUMMON2 = -1000120, SAY_ELF_COMPLETE = -1000121, SAY_ELF_AGGRO = -1000122, - QUEST_ROAD_TO_FALCON_WATCH = 9375 }; - struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI { npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch (i) { case 0: @@ -371,77 +307,62 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI break; } } - void Reset() { } - void EnterCombat(Unit* who) { if (HasEscortState(STATE_ESCORT_ESCORTING)) DoScriptText(SAY_ELF_AGGRO, m_creature); } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } }; - CreatureAI* GetAI_npc_wounded_blood_elf(Creature* pCreature) { return new npc_wounded_blood_elfAI(pCreature); } - bool QuestAccept_npc_wounded_blood_elf(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) { if (npc_escortAI* pEscortAI = CAST_AI(npc_wounded_blood_elfAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); - // Change faction so mobs attack pCreature->setFaction(775); } - return true; } - void AddSC_hellfire_peninsula() { Script *newscript; - newscript = new Script; newscript->Name = "npc_aeranas"; newscript->GetAI = &GetAI_npc_aeranas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ancestral_wolf"; newscript->GetAI = &GetAI_npc_ancestral_wolf; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_haaleshi_altar"; newscript->pGOHello = &GOHello_go_haaleshi_altar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_naladu"; newscript->pGossipHello = &GossipHello_npc_naladu; newscript->pGossipSelect = &GossipSelect_npc_naladu; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tracy_proudwell"; newscript->pGossipHello = &GossipHello_npc_tracy_proudwell; newscript->pGossipSelect = &GossipSelect_npc_tracy_proudwell; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_trollbane"; newscript->pGossipHello = &GossipHello_npc_trollbane; newscript->pGossipSelect = &GossipSelect_npc_trollbane; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_wounded_blood_elf"; newscript->GetAI = &GetAI_npc_wounded_blood_elf; diff --git a/src/bindings/scripts/scripts/outland/nagrand.cpp b/src/bindings/scripts/scripts/outland/nagrand.cpp index f4f3792283f..c589677f1f7 100644 --- a/src/bindings/scripts/scripts/outland/nagrand.cpp +++ b/src/bindings/scripts/scripts/outland/nagrand.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Nagrand SD%Complete: 90 SDComment: Quest support: 9849, 9868, 9918, 9874, 9991, 10107, 10108, 10044, 10172, 10646, 10085, 10987. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) SDCategory: Nagrand EndScriptData */ - /* ContentData mob_shattered_rumbler mob_lump @@ -32,27 +30,20 @@ npc_maghar_captive npc_creditmarker_visit_with_ancestors mob_sparrowhawk EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## mob_shattered_rumbler - this should be done with ACID ######*/ - struct TRINITY_DLL_DECL mob_shattered_rumblerAI : public ScriptedAI { bool Spawn; - mob_shattered_rumblerAI(Creature *c) : ScriptedAI(c) {} - void Reset() { Spawn = false; } - void EnterCombat(Unit* who) {} - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { if (Spellkind->Id == 32001 && !Spawn) @@ -60,7 +51,6 @@ struct TRINITY_DLL_DECL mob_shattered_rumblerAI : public ScriptedAI float x = m_creature->GetPositionX(); float y = m_creature->GetPositionY(); float z = m_creature->GetPositionZ(); - Hitter->SummonCreature(18181,x+(0.7 * (rand()%30)),y+(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); Hitter->SummonCreature(18181,x+(rand()%5),y-(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); Hitter->SummonCreature(18181,x-(rand()%5),y+(0.5 *(rand()%60)),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); @@ -74,54 +64,41 @@ CreatureAI* GetAI_mob_shattered_rumbler(Creature* pCreature) { return new mob_shattered_rumblerAI (pCreature); } - /*###### ## mob_lump ######*/ - #define SPELL_VISUAL_SLEEP 16093 #define SPELL_SPEAR_THROW 32248 - #define LUMP_SAY0 -1000293 #define LUMP_SAY1 -1000294 - #define LUMP_DEFEAT -1000295 - #define GOSSIP_HL "I need answers, ogre!" #define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory." #define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar." #define GOSSIP_SL3 "This means war, Lump! War I say!" - struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI { mob_lumpAI(Creature *c) : ScriptedAI(c) { bReset = false; } - uint32 Reset_Timer; uint32 Spear_Throw_Timer; bool bReset; - void Reset() { Reset_Timer = 60000; Spear_Throw_Timer = 2000; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void AttackedBy(Unit* pAttacker) { if (m_creature->getVictim()) return; - if (m_creature->IsFriendlyTo(pAttacker)) return; - AttackStart(pAttacker); } - void DamageTaken(Unit *done_by, uint32 & damage) { if (done_by->GetTypeId() == TYPEID_PLAYER && (m_creature->GetHealth() - damage)*100 / m_creature->GetMaxHealth() < 30) @@ -130,7 +107,6 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI { //Take 0 damage damage = 0; - CAST_PLR(done_by)->AttackStop(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveAllAuras(); @@ -139,23 +115,18 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI m_creature->setFaction(1080); //friendly m_creature->SetStandState(UNIT_STAND_STATE_SIT); DoScriptText(LUMP_DEFEAT, m_creature); - bReset = true; } } } - void EnterCombat(Unit *who) { if (m_creature->HasAura(SPELL_VISUAL_SLEEP)) m_creature->RemoveAura(SPELL_VISUAL_SLEEP); - if (!m_creature->IsStandState()) m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(RAND(LUMP_SAY0,LUMP_SAY1), m_creature); } - void UpdateAI(const uint32 diff) { //check if we waiting for a reset @@ -170,37 +141,29 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI } else Reset_Timer -= diff; } - //Return since we have no target if (!UpdateVictim()) return; - //Spear_Throw_Timer if (Spear_Throw_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SPEAR_THROW); Spear_Throw_Timer = 20000; }else Spear_Throw_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_lump(Creature* pCreature) { return new mob_lumpAI(pCreature); } - bool GossipHello_mob_lump(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9352, pCreature->GetGUID()); - return true; } - bool GossipSelect_mob_lump(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -224,23 +187,18 @@ bool GossipSelect_mob_lump(Player* pPlayer, Creature* pCreature, uint32 uiSender } return true; } - /*#### # mob_sunspring_villager - should be done with ACID ####*/ - struct TRINITY_DLL_DECL mob_sunspring_villagerAI : public ScriptedAI { mob_sunspring_villagerAI(Creature *c) : ScriptedAI(c) {} - void Reset() { m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); } - void EnterCombat(Unit *who) {} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (spell->Id == 32146) @@ -254,44 +212,34 @@ CreatureAI* GetAI_mob_sunspring_villager(Creature* pCreature) { return new mob_sunspring_villagerAI (pCreature); } - /*###### ## npc_altruis_the_sufferer ######*/ - #define GOSSIP_HATS1 "I see twisted steel and smell sundered earth." #define GOSSIP_HATS2 "Well...?" #define GOSSIP_HATS3 "[PH] Story about Illidan's Pupil" - #define GOSSIP_SATS1 "Legion?" #define GOSSIP_SATS2 "And now?" #define GOSSIP_SATS3 "How do you see them now?" #define GOSSIP_SATS4 "Forge camps?" #define GOSSIP_SATS5 "Ok." #define GOSSIP_SATS6 "[PH] Story done" - bool GossipHello_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - //gossip before obtaining Survey the Land if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_NONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); - //gossip when Survey the Land is incomplete (technically, after the flight) if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - //wowwiki.com/Varedis if (pPlayer->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); - pPlayer->SEND_GOSSIP_MENU(9419, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -315,7 +263,6 @@ bool GossipSelect_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, case GOSSIP_ACTION_INFO_DEF+14: pPlayer->SEND_GOSSIP_MENU(9424, pCreature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+20: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); pPlayer->SEND_GOSSIP_MENU(9427, pCreature->GetGUID()); @@ -324,7 +271,6 @@ bool GossipSelect_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->AreaExploredOrEventHappens(9991); break; - case GOSSIP_ACTION_INFO_DEF+30: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); pPlayer->SEND_GOSSIP_MENU(384, pCreature->GetGUID()); @@ -336,7 +282,6 @@ bool GossipSelect_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, } return true; } - bool QuestAccept_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, Quest const *quest) { if (!pPlayer->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991 @@ -346,14 +291,11 @@ bool QuestAccept_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, } return true; } - /*###### ## npc_greatmother_geyah ######*/ - #define GOSSIP_HGG1 "Hello, Greatmother. Garrosh told me that you wanted to speak with me." #define GOSSIP_HGG2 "Garrosh is beyond redemption, Greatmother. I fear that in helping the Mag'har, I have convinced Garrosh that he is unfit to lead." - #define GOSSIP_SGG1 "You raised all of the orcs here, Greatmother?" #define GOSSIP_SGG2 "Do you believe that?" #define GOSSIP_SGG3 "What can be done? I have tried many different things. I have done my best to help the people of Nagrand. Each time I have approached Garrosh, he has dismissed me." @@ -365,13 +307,11 @@ bool QuestAccept_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, #define GOSSIP_SGG9 "Greatmother, I never had the honor. Durotan died long before my time, but his heroics are known to all on my world. The orcs of Azeroth reside in a place known as Durotar, named after your son. And ... (You take a moment to breathe and think through what you are about to tell the Greatmother.)" #define GOSSIP_SGG10 "It is my Warchief, Greatmother. The leader of my people. From my world. He ... He is the son of Durotan. He is your grandchild." #define GOSSIP_SGG11 "I will return to Azeroth at once, Greatmother." - //all the textId's for the below is unknown, but i do believe the gossip item texts are proper. bool GossipHello_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -383,12 +323,9 @@ bool GossipHello_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -421,7 +358,6 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui pPlayer->AreaExploredOrEventHappens(10044); pPlayer->CLOSE_GOSSIP_MENU(); break; - case GOSSIP_ACTION_INFO_DEF + 10: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); @@ -449,11 +385,9 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui } return true; } - /*###### ## npc_lantresor_of_the_blade ######*/ - #define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear." #define GOSSIP_SLB1 "Should I know? You look like an orc to me." #define GOSSIP_SLB2 "And the other half?" @@ -462,20 +396,15 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui #define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces." #define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people." #define GOSSIP_SLB7 "What do I need to do?" - bool GossipHello_npc_lantresor_of_the_blade(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9361, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_lantresor_of_the_blade(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -518,11 +447,9 @@ bool GossipSelect_npc_lantresor_of_the_blade(Player* pPlayer, Creature* pCreatur } return true; } - /*##### ## npc_maghar_captive #####*/ - enum eMagharCaptive { SAY_MAG_START = -1000482, @@ -532,99 +459,77 @@ enum eMagharCaptive SAY_MAG_LIGHTNING = -1000486, SAY_MAG_SHOCK = -1000487, SAY_MAG_COMPLETE = -1000488, - SPELL_CHAIN_LIGHTNING = 16006, SPELL_EARTHBIND_TOTEM = 15786, SPELL_FROST_SHOCK = 12548, SPELL_HEALING_WAVE = 12491, - QUEST_TOTEM_KARDASH_H = 9868, - NPC_MURK_RAIDER = 18203, NPC_MURK_BRUTE = 18211, NPC_MURK_SCAVENGER = 18207, NPC_MURK_PUTRIFIER = 18202 }; - static float m_afAmbushA[]= {-1568.805786, 8533.873047, 1.958}; static float m_afAmbushB[]= {-1491.554321, 8506.483398, 1.248}; - struct TRINITY_DLL_DECL npc_maghar_captiveAI : public npc_escortAI { npc_maghar_captiveAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); } - uint32 m_uiChainLightningTimer; uint32 m_uiHealTimer; uint32 m_uiFrostShockTimer; - void Reset() { m_uiChainLightningTimer = 1000; m_uiHealTimer = 0; m_uiFrostShockTimer = 6000; } - void Aggro(Unit* pWho) { m_creature->CastSpell(m_creature, SPELL_EARTHBIND_TOTEM, false); } - void WaypointReached(uint32 uiPointId) { switch(uiPointId) { case 7: DoScriptText(SAY_MAG_MORE, m_creature); - if (Creature* pTemp = m_creature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0], m_afAmbushB[1], m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) DoScriptText(SAY_MAG_MORE_REPLY, pTemp); - m_creature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; case 16: DoScriptText(SAY_MAG_COMPLETE, m_creature); - if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_TOTEM_KARDASH_H, m_creature); - SetRun(); break; } } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == NPC_MURK_BRUTE) DoScriptText(SAY_MAG_NO_ESCAPE, pSummoned); - if (pSummoned->isTotem()) return; - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pSummoned->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); pSummoned->AI()->AttackStart(m_creature); - } - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) { if (pSpell->Id == SPELL_CHAIN_LIGHTNING) { if (rand()%10) return; - DoScriptText(SAY_MAG_LIGHTNING, m_creature); } } - void UpdateEscortAI(const uint32 uiDiff) { if (/*!m_creature->SelectHostilTarget() ||*/ !m_creature->getVictim()) return; - if (m_uiChainLightningTimer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING); @@ -632,7 +537,6 @@ struct TRINITY_DLL_DECL npc_maghar_captiveAI : public npc_escortAI } else m_uiChainLightningTimer -= uiDiff; - if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*30) { if (m_uiHealTimer < uiDiff) @@ -643,7 +547,6 @@ struct TRINITY_DLL_DECL npc_maghar_captiveAI : public npc_escortAI else m_uiHealTimer -= uiDiff; } - if (m_uiFrostShockTimer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_FROST_SHOCK); @@ -651,11 +554,9 @@ struct TRINITY_DLL_DECL npc_maghar_captiveAI : public npc_escortAI } else m_uiFrostShockTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; - bool QuestAccept_npc_maghar_captive(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_TOTEM_KARDASH_H) @@ -664,11 +565,8 @@ bool QuestAccept_npc_maghar_captive(Player* pPlayer, Creature* pCreature, const { pCreature->SetStandState(UNIT_STAND_STATE_STAND); pCreature->setFaction(232); - pEscortAI->Start(true, false, pPlayer->GetGUID(), pQuest); - DoScriptText(SAY_MAG_START, pCreature); - pCreature->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0]+2.5f, m_afAmbushA[1]-2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); pCreature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0]-2.5f, m_afAmbushA[1]+2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); pCreature->SummonCreature(NPC_MURK_BRUTE, m_afAmbushA[0], m_afAmbushA[1], m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); @@ -676,29 +574,22 @@ bool QuestAccept_npc_maghar_captive(Player* pPlayer, Creature* pCreature, const } return true; } - CreatureAI* GetAI_npc_maghar_captive(Creature* pCreature) { return new npc_maghar_captiveAI(pCreature); } - /*###### ## npc_creditmarker_visist_with_ancestors ######*/ - struct TRINITY_DLL_DECL npc_creditmarker_visit_with_ancestorsAI : public ScriptedAI { npc_creditmarker_visit_with_ancestorsAI(Creature* c) : ScriptedAI(c) {} - void Reset() {} - void EnterCombat(Unit* who) {} - void MoveInLineOfSight(Unit *who) { if (!who) return; - if (who->GetTypeId() == TYPEID_PLAYER) { if (CAST_PLR(who)->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE) @@ -714,28 +605,21 @@ struct TRINITY_DLL_DECL npc_creditmarker_visit_with_ancestorsAI : public Scripte } } }; - CreatureAI* GetAI_npc_creditmarker_visit_with_ancestors(Creature* pCreature) { return new npc_creditmarker_visit_with_ancestorsAI (pCreature); } - /*###### ## mob_sparrowhawk ######*/ - #define SPELL_SPARROWHAWK_NET 39810 #define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812 - struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI { - mob_sparrowhawkAI(Creature *c) : ScriptedAI(c) {} - uint32 Check_Timer; uint64 PlayerGUID; bool fleeing; - void Reset() { m_creature->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET); @@ -747,26 +631,20 @@ struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI { if (PlayerGUID) return; - ScriptedAI::AttackStart(who); } - void EnterCombat(Unit* who) {} - void MoveInLineOfSight(Unit *who) { if (!who || PlayerGUID) return; - if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); return; } - ScriptedAI::MoveInLineOfSight(who); } - void UpdateAI(const uint32 diff) { if (Check_Timer < diff) @@ -775,7 +653,6 @@ struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI { if (fleeing && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) fleeing = false; - Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (pPlayer && m_creature->IsWithinDistInMap(pPlayer, 30)) { @@ -795,13 +672,10 @@ struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI } Check_Timer = 1000; } else Check_Timer -= diff; - if (PlayerGUID) return; - ScriptedAI::UpdateAI(diff); } - void SpellHit(Unit *caster, const SpellEntry *spell) { if (caster->GetTypeId() == TYPEID_PLAYER) @@ -816,67 +690,55 @@ struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI return; } }; - CreatureAI* GetAI_mob_sparrowhawk(Creature* pCreature) { return new mob_sparrowhawkAI (pCreature); } - /*#### # ####*/ - void AddSC_nagrand() { Script *newscript; - newscript = new Script; newscript->Name = "mob_shattered_rumbler"; newscript->GetAI = &GetAI_mob_shattered_rumbler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_lump"; newscript->GetAI = &GetAI_mob_lump; newscript->pGossipHello = &GossipHello_mob_lump; newscript->pGossipSelect = &GossipSelect_mob_lump; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_sunspring_villager"; newscript->GetAI = &GetAI_mob_sunspring_villager; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_altruis_the_sufferer"; newscript->pGossipHello = &GossipHello_npc_altruis_the_sufferer; newscript->pGossipSelect = &GossipSelect_npc_altruis_the_sufferer; newscript->pQuestAccept = &QuestAccept_npc_altruis_the_sufferer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_greatmother_geyah"; newscript->pGossipHello = &GossipHello_npc_greatmother_geyah; newscript->pGossipSelect = &GossipSelect_npc_greatmother_geyah; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lantresor_of_the_blade"; newscript->pGossipHello = &GossipHello_npc_lantresor_of_the_blade; newscript->pGossipSelect = &GossipSelect_npc_lantresor_of_the_blade; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_maghar_captive"; newscript->GetAI = &GetAI_npc_maghar_captive; newscript->pQuestAccept = &QuestAccept_npc_maghar_captive; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_creditmarker_visit_with_ancestors"; newscript->GetAI = &GetAI_npc_creditmarker_visit_with_ancestors; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_sparrowhawk"; newscript->GetAI = &GetAI_mob_sparrowhawk; diff --git a/src/bindings/scripts/scripts/outland/netherstorm.cpp b/src/bindings/scripts/scripts/outland/netherstorm.cpp index d648c26b571..5a8cb6399ec 100644 --- a/src/bindings/scripts/scripts/outland/netherstorm.cpp +++ b/src/bindings/scripts/scripts/outland/netherstorm.cpp @@ -13,28 +13,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Netherstorm SD%Complete: 75 SDComment: Quest support: 10337, 10438, 10652 (special flight paths), 10299,10321,10322,10323,10329,10330,10338,10365(Shutting Down Manaforge), 10198 SDCategory: Netherstorm EndScriptData */ - /* ContentData npc_manaforge_control_console go_manaforge_control_console npc_commander_dawnforge npc_bessy EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_manaforge_control_console ######*/ - //used by 20209,20417,20418,20440, signed for 20209 #define EMOTE_START -1000296 #define EMOTE_60 -1000297 @@ -42,27 +37,21 @@ EndContentData */ #define EMOTE_10 -1000299 #define EMOTE_COMPLETE -1000300 #define EMOTE_ABORT -1000301 - #define ENTRY_BNAAR_C_CONSOLE 20209 #define ENTRY_CORUU_C_CONSOLE 20417 #define ENTRY_DURO_C_CONSOLE 20418 #define ENTRY_ARA_C_CONSOLE 20440 - #define ENTRY_SUNFURY_TECH 20218 #define ENTRY_SUNFURY_PROT 20436 - #define ENTRY_ARA_TECH 20438 #define ENTRY_ARA_ENGI 20439 #define ENTRY_ARA_GORKLONN 20460 - #define SPELL_DISABLE_VISUAL 35031 #define SPELL_INTERRUPT_1 35016 //ACID mobs should cast this #define SPELL_INTERRUPT_2 35176 //ACID mobs should cast this (Manaforge Ara-version) - struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI { npc_manaforge_control_consoleAI(Creature *c) : ScriptedAI(c) {} - uint32 Event_Timer; uint32 Wave_Timer; uint32 Phase; @@ -70,7 +59,6 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI uint64 someplayer; uint64 goConsole; Creature* add; - void Reset() { Event_Timer = 3000; @@ -81,9 +69,7 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI goConsole = 0; Creature* add = NULL; } - void EnterCombat(Unit *who) { return; } - /*void SpellHit(Unit *caster, const SpellEntry *spell) { //we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds @@ -91,11 +77,9 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI if (spell->Id == SPELL_INTERRUPT_1) DoSay("Silence! I kill you!",LANG_UNIVERSAL, NULL); }*/ - void JustDied(Unit* killer) { DoScriptText(EMOTE_ABORT, m_creature); - if (someplayer) { Unit* p = Unit::GetUnit((*m_creature),someplayer); @@ -122,14 +106,12 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI } } } - if (goConsole) { if (GameObject* pGo = GameObject::GetGameObject((*m_creature),goConsole)) pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } } - void DoWaveSpawnForCreature(Creature* pCreature) { switch(pCreature->GetEntry()) @@ -216,7 +198,6 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI break; } } - void UpdateAI(const uint32 diff) { if (Event_Timer < diff) @@ -268,7 +249,6 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI break; } } else Event_Timer -= diff; - if (Wave) { if (Wave_Timer < diff) @@ -282,11 +262,9 @@ CreatureAI* GetAI_npc_manaforge_control_console(Creature* pCreature) { return new npc_manaforge_control_consoleAI (pCreature); } - /*###### ## go_manaforge_control_console ######*/ - //TODO: clean up this workaround when Trinity adds support to do it properly (with gossip selections instead of instant summon) bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) { @@ -295,10 +273,8 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) pPlayer->PrepareQuestMenu(pGo->GetGUID()); pPlayer->SendPreparedQuest(pGo->GetGUID()); } - Creature* manaforge; manaforge = NULL; - switch(pGo->GetAreaId()) { case 3726: //b'naar @@ -322,7 +298,6 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) manaforge = pPlayer->SummonCreature(ENTRY_ARA_C_CONSOLE,4013.71,4028.76,192.10,1.25,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); break; } - if (manaforge) { CAST_AI(npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = pPlayer->GetGUID(); @@ -331,11 +306,9 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) } return true; } - /*###### ## npc_commander_dawnforge ######*/ - // The Speech of Dawnforge, Ardonis & Pathaleon #define SAY_COMMANDER_DAWNFORGE_1 -1000128 #define SAY_ARCANIST_ARDONIS_1 -1000129 @@ -348,10 +321,8 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) #define SAY_COMMANDER_DAWNFORGE_4 -1000136 #define SAY_ARCANIST_ARDONIS_2 -1000136 #define SAY_COMMANDER_DAWNFORGE_5 -1000137 - #define QUEST_INFO_GATHERING 10198 #define SPELL_SUNFURY_DISGUISE 34603 - // Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image const uint32 CreatureEntry[3] = { @@ -359,96 +330,77 @@ const uint32 CreatureEntry[3] = 19831, // Dawnforge 21504 // Pathaleon }; - struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI { npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); } - uint64 PlayerGUID; uint64 ardonisGUID; uint64 pathaleonGUID; - uint32 Phase; uint32 PhaseSubphase; uint32 Phase_Timer; bool isEvent; - float angle_dawnforge; float angle_ardonis; - void Reset() { PlayerGUID = 0; ardonisGUID = 0; pathaleonGUID = 0; - Phase = 1; PhaseSubphase = 0; Phase_Timer = 4000; isEvent = false; } - void EnterCombat(Unit *who) { } - void JustSummoned(Creature *summoned) { pathaleonGUID = summoned->GetGUID(); } - // Emote Ardonis and Pathaleon void Turn_to_Pathaleons_Image() { Creature *ardonis = Unit::GetCreature(*m_creature,ardonisGUID); Creature *pathaleon = Unit::GetCreature(*m_creature,pathaleonGUID); Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (!ardonis || !pathaleon || !pPlayer) return; - //Calculate the angle to Pathaleon angle_dawnforge = m_creature->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - //Turn Dawnforge and update m_creature->SetOrientation(angle_dawnforge); m_creature->SendUpdateToPlayer(pPlayer); //Turn Ardonis and update ardonis->SetOrientation(angle_ardonis); ardonis->SendUpdateToPlayer(pPlayer); - //Set them to kneel m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); ardonis->SetStandState(UNIT_STAND_STATE_KNEEL); } - //Set them back to each other void Turn_to_eachother() { if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID)) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (!pPlayer) return; - angle_dawnforge = m_creature->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); angle_ardonis = ardonis->GetAngle(m_creature->GetPositionX(), m_creature->GetPositionY()); - //Turn Dawnforge and update m_creature->SetOrientation(angle_dawnforge); m_creature->SendUpdateToPlayer(pPlayer); //Turn Ardonis and update ardonis->SetOrientation(angle_ardonis); ardonis->SendUpdateToPlayer(pPlayer); - //Set state m_creature->SetStandState(UNIT_STAND_STATE_STAND); ardonis->SetStandState(UNIT_STAND_STATE_STAND); } } - bool CanStartEvent(Player* pPlayer) { if (!isEvent) @@ -456,49 +408,39 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI Creature* ardonis = me->FindNearestCreature(CreatureEntry[0], 10.0f); if (!ardonis) return false; - ardonisGUID = ardonis->GetGUID(); PlayerGUID = pPlayer->GetGUID(); - isEvent = true; - Turn_to_eachother(); return true; } - debug_log("TSCR: npc_commander_dawnforge event already in progress, need to wait."); return false; } - void UpdateAI(const uint32 diff) { //Is event even running? if (!isEvent) return; - //Phase timing if (Phase_Timer >= diff) { Phase_Timer -= diff; return; } - Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (!ardonis || !pPlayer) { Reset(); return; } - if (Phase > 4 && !pathaleon) { Reset(); return; } - //Phase 1 Dawnforge say switch (Phase) { @@ -601,55 +543,42 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_commander_dawnforge(Creature* pCreature) { return new npc_commander_dawnforgeAI(pCreature); } - bool AreaTrigger_at_commander_dawnforge(Player* pPlayer, AreaTriggerEntry *at) { //if player lost aura or not have at all, we should not try start event. if (!pPlayer->HasAura(SPELL_SUNFURY_DISGUISE)) return false; - if (pPlayer->isAlive() && pPlayer->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) { Creature* Dawnforge = pPlayer->FindNearestCreature(CreatureEntry[1], 30.0f); - if (!Dawnforge) return false; - if (CAST_AI(npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(pPlayer)) return true; } return false; } - /*###### ## npc_professor_dabiri ######*/ - #define SPELL_PHASE_DISTRUPTOR 35780 #define GOSSIP_ITEM "I need a new phase distruptor, Professor" #define WHISPER_DABIRI -1000302 - #define QUEST_DIMENSIUS 10439 #define QUEST_ON_NETHERY_WINGS 10438 - bool GossipHello_npc_professor_dabiri(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(29778, 1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -657,69 +586,54 @@ bool GossipSelect_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, uin pCreature->CastSpell(pPlayer, SPELL_PHASE_DISTRUPTOR, false); pPlayer->CLOSE_GOSSIP_MENU(); } - return true; } - bool QuestAccept_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, Quest const *quest) { if (quest->GetQuestId() == QUEST_DIMENSIUS) DoScriptText(WHISPER_DABIRI, pCreature, pPlayer); - return true; } - /*###### ## mob_phase_hunter ######*/ - #define SUMMONED_MOB 19595 #define EMOTE_WEAK -1000303 - // Spells #define SPELL_PHASE_SLIP 36574 #define SPELL_MANA_BURN 13321 #define SPELL_MATERIALIZE 34804 #define SPELL_DE_MATERIALIZE 34804 - struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI { - mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {} - bool Weak; bool Materialize; bool Drained; - int WeakPercent; uint64 PlayerGUID; uint32 Health; uint32 Level; uint32 PhaseSlipVulnerabilityTimer; uint32 ManaBurnTimer; - void Reset() { Weak = false; Materialize = false; Drained = false; - WeakPercent = 25 + (rand()%16); // 25-40 PlayerGUID = 0; ManaBurnTimer = 5000 + (rand()%3 * 1000); // 5-8 sec cd } - void EnterCombat(Unit *who) { if (Player* pPlayer = who->GetCharmerOrOwnerPlayerOrPlayerItself()) PlayerGUID = pPlayer->GetGUID(); } - void SpellHit(Unit *caster, const SpellEntry *spell) { DoCast(m_creature, SPELL_DE_MATERIALIZE); } - void UpdateAI(const uint32 diff) { if (!Materialize) @@ -727,13 +641,10 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI DoCast(m_creature, SPELL_MATERIALIZE); Materialize = true; } - if (m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it DoCast(m_creature, SPELL_PHASE_SLIP); - if (!UpdateVictim()) return; - if (ManaBurnTimer < diff) // cast Mana Burn { if (m_creature->getVictim()->GetCreateMana() > 0) @@ -742,11 +653,9 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd } }else ManaBurnTimer -= diff; - if (PlayerGUID) // start: support for quest 10190 { Unit* target = Unit::GetUnit((*m_creature), PlayerGUID); - if (target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && CAST_PLR(target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) { @@ -756,19 +665,14 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI if (Weak && !Drained && m_creature->HasAura(34219)) { Drained = true; - Health = m_creature->GetHealth(); // get the normal mob's data Level = m_creature->getLevel(); - m_creature->AttackStop(); // delete the normal mob m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); - Creature* DrainedPhaseHunter = NULL; - if (!DrainedPhaseHunter) DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob - if (DrainedPhaseHunter) { DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data @@ -778,45 +682,35 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI } } }// end: support for quest 10190 - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_phase_hunter(Creature* pCreature) { return new mob_phase_hunterAI (pCreature); } - /*###### ## npc_bessy ######*/ - #define Q_ALMABTRIEB 10337 #define N_THADELL 20464 #define SPAWN_FIRST 20512 #define SPAWN_SECOND 19881 #define SAY_THADELL_1 -1000304 #define SAY_THADELL_2 -1000305 - struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI { - npc_bessyAI(Creature *c) : npc_escortAI(c) {} - void JustDied(Unit* killer) { if (Player* pPlayer = GetPlayerForEscort()) pPlayer->FailQuest(Q_ALMABTRIEB); } - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 3: //first spawn @@ -824,12 +718,10 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI m_creature->SummonCreature(SPAWN_FIRST, 2449.53, 2184.43, 96.36, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, 2449.85, 2186.34, 97.57, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; - case 7: m_creature->SummonCreature(SPAWN_SECOND, 2309.64, 2186.24, 92.25, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND, 2309.25, 2183.46, 91.75, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; - case 12: if (pPlayer) pPlayer->GroupEventHappens(Q_ALMABTRIEB, m_creature); @@ -840,19 +732,15 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI DoScriptText(SAY_THADELL_2, m_creature, pPlayer); break; } } - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void Reset() { me->RestoreFaction(); } - }; - bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == Q_ALMABTRIEB) @@ -863,52 +751,42 @@ bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* qu } return true; } - CreatureAI* GetAI_npc_bessy(Creature* pCreature) { return new npc_bessyAI(pCreature); } - /*###### ## ######*/ - void AddSC_netherstorm() { Script *newscript; - newscript = new Script; newscript->Name = "go_manaforge_control_console"; newscript->pGOHello = &GOHello_go_manaforge_control_console; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_manaforge_control_console"; newscript->GetAI = &GetAI_npc_manaforge_control_console; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_commander_dawnforge"; newscript->GetAI = &GetAI_npc_commander_dawnforge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_commander_dawnforge"; newscript->pAreaTrigger = &AreaTrigger_at_commander_dawnforge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_professor_dabiri"; newscript->pGossipHello = &GossipHello_npc_professor_dabiri; newscript->pGossipSelect = &GossipSelect_npc_professor_dabiri; newscript->pQuestAccept = &QuestAccept_npc_professor_dabiri; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_phase_hunter"; newscript->GetAI = &GetAI_mob_phase_hunter; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_bessy"; newscript->GetAI = &GetAI_npc_bessy; diff --git a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp index 3a6a121ff4d..a0424c5ac7d 100644 --- a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Shadowmoon_Valley SD%Complete: 100 SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 10458, 10481, 10480, 11082, 10781, 10451. Vendor Drake Dealer Hurlunk. SDCategory: Shadowmoon Valley EndScriptData */ - /* ContentData mob_mature_netherwing_drake mob_enslaved_netherwing_drake @@ -38,70 +36,53 @@ npc_lord_illidan_stormrage go_crystal_prison npc_enraged_spirit EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*##### # mob_mature_netherwing_drake #####*/ - enum eMatureNetherwing { SAY_JUST_EATEN = -1000222, - SPELL_PLACE_CARCASS = 38439, SPELL_JUST_EATEN = 38502, SPELL_NETHER_BREATH = 38467, POINT_ID = 1, - GO_CARCASS = 185155, - QUEST_KINDNESS = 10804, NPC_EVENT_PINGER = 22131 }; - struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI { mob_mature_netherwing_drakeAI(Creature* c) : ScriptedAI(c) { } - uint64 uiPlayerGUID; - bool bCanEat; bool bIsEating; - uint32 EatTimer; uint32 CastTimer; - void Reset() { uiPlayerGUID = 0; - bCanEat = false; bIsEating = false; - EatTimer = 5000; CastTimer = 5000; } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (bCanEat || bIsEating) return; - if (pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_PLACE_CARCASS && !m_creature->HasAura(SPELL_JUST_EATEN)) { uiPlayerGUID = pCaster->GetGUID(); bCanEat = true; } } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == POINT_ID) { bIsEating = true; @@ -109,7 +90,6 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); } } - void UpdateAI(const uint32 diff) { if (bCanEat || bIsEating) @@ -124,10 +104,8 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI { if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MoveIdle(); m_creature->StopMoving(); - m_creature->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); } } @@ -137,56 +115,43 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI { DoCast(m_creature, SPELL_JUST_EATEN); DoScriptText(SAY_JUST_EATEN, m_creature); - if (Player* pPlr = Unit::GetPlayer(uiPlayerGUID)) { pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, m_creature->GetGUID()); - if (GameObject* pGo = pPlr->FindNearestGameObject(GO_CARCASS, 10)) pGo->Delete(); } - Reset(); m_creature->GetMotionMaster()->Clear(); } } else EatTimer -= diff; - return; } - if (!UpdateVictim()) return; - if (CastTimer < diff) { DoCast(m_creature->getVictim(), SPELL_NETHER_BREATH); CastTimer = 5000; }else CastTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_mature_netherwing_drake(Creature* pCreature) { return new mob_mature_netherwing_drakeAI(pCreature); } - /*### # mob_enslaved_netherwing_drake ####*/ - #define FACTION_DEFAULT 62 #define FACTION_FRIENDLY 1840 // Not sure if this is correct, it was taken off of Mordenai. - #define SPELL_HIT_FORCE_OF_NELTHARAKU 38762 #define SPELL_FORCE_OF_NELTHARAKU 38775 - #define CREATURE_DRAGONMAW_SUBJUGATOR 21718 #define CREATURE_ESCAPE_DUMMY 22317 - struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI { mob_enslaved_netherwing_drakeAI(Creature* c) : ScriptedAI(c) @@ -195,53 +160,42 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI Tapped = false; Reset(); } - uint64 PlayerGUID; uint32 FlyTimer; bool Tapped; - void Reset() { if (!Tapped) m_creature->setFaction(FACTION_DEFAULT); - FlyTimer = 10000; m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->SetVisibility(VISIBILITY_ON); } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) return; - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_HIT_FORCE_OF_NELTHARAKU && !Tapped) { Tapped = true; PlayerGUID = caster->GetGUID(); - m_creature->setFaction(FACTION_FRIENDLY); DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); - Unit* Dragonmaw = me->FindNearestCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50); - if (Dragonmaw) { m_creature->AddThreat(Dragonmaw, 100000.0f); AttackStart(Dragonmaw); } - HostilReference* ref = m_creature->getThreatManager().getOnlineContainer().getReferenceByTarget(caster); if (ref) ref->removeReference(); } } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id == 1) { if (PlayerGUID) @@ -249,7 +203,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID); if (plr) DoCast(plr, SPELL_FORCE_OF_NELTHARAKU, true); - PlayerGUID = 0; } m_creature->SetVisibility(VISIBILITY_OFF); @@ -258,7 +211,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->RemoveCorpse(); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -276,11 +228,9 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI /* float x,y,z; m_creature->GetPosition(x,y,z); - float dx,dy,dz; m_creature->GetRandomPoint(x, y, z, 20, dx, dy, dz); dz += 20; // so it's in the air, not ground*/ - Position pos; if(Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30)) EscapeDummy->GetPosition(&pos); @@ -289,7 +239,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->GetRandomNearPosition(pos, 20); pos.m_positionZ += 25; } - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->GetMotionMaster()->MovePoint(1, pos); } @@ -297,65 +246,52 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI }else FlyTimer -= diff; return; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_enslaved_netherwing_drake(Creature* pCreature) { return new mob_enslaved_netherwing_drakeAI(pCreature); } - /*##### # mob_dragonmaw_peon #####*/ - struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI { mob_dragonmaw_peonAI(Creature* c) : ScriptedAI(c) {} - uint64 PlayerGUID; bool Tapped; uint32 PoisonTimer; - void Reset() { PlayerGUID = 0; Tapped = false; PoisonTimer = 0; } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) return; - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == 40468 && !Tapped) { PlayerGUID = caster->GetGUID(); - Tapped = true; float x, y, z; caster->GetClosePoint(x, y, z, m_creature->GetObjectSize()); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->GetMotionMaster()->MovePoint(1, x, y, z); } } - void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; - if (id) { m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_EAT); PoisonTimer = 15000; } } - void UpdateAI(const uint32 diff) { if (PoisonTimer) @@ -372,53 +308,40 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI }else PoisonTimer -= diff; } }; - CreatureAI* GetAI_mob_dragonmaw_peon(Creature* pCreature) { return new mob_dragonmaw_peonAI(pCreature); } - /*###### ## npc_drake_dealer_hurlunk ######*/ - bool GossipHello_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature) { if (pCreature->isVendor() && pPlayer->GetReputationRank(1015) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_flanis_swiftwing_and_kagrosh ######*/ - #define GOSSIP_HSK1 "Take Flanis's Pack" #define GOSSIP_HSK2 "Take Kagrosh's Pack" - bool GossipHello_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(10583) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30658,1,true)) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if (pPlayer->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30659,1,true)) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -443,29 +366,23 @@ bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* p } return true; } - /*###### ## npc_murkblood_overseer ######*/ - #define QUEST_11082 11082 - #define GOSSIP_HMO "I am here for you, overseer." #define GOSSIP_SMO1 "How dare you question an overseer of the Dragonmaw!" #define GOSSIP_SMO2 "Who speaks of me? What are you talking about, broken?" #define GOSSIP_SMO3 "Continue please." #define GOSSIP_SMO4 "Who are these bidders?" #define GOSSIP_SMO5 "Well... yes." - bool GossipHello_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HMO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -504,29 +421,22 @@ bool GossipSelect_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature, u } return true; } - /*###### ## npc_neltharaku ######*/ - #define GOSSIP_HN "I am listening, dragon" #define GOSSIP_SN1 "But you are dragons! How could orcs do this to you?" #define GOSSIP_SN2 "Your mate?" #define GOSSIP_SN3 "I have battled many beasts, dragon. I will help you." - bool GossipHello_npc_neltharaku(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(10814) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10613, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -550,11 +460,9 @@ bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 ui } return true; } - /*###### ## npc_oronok ######*/ - #define GOSSIP_ORONOK1 "I am ready to hear your story, Oronok." #define GOSSIP_ORONOK2 "How do I find the cipher?" #define GOSSIP_ORONOK3 "How do you know all of this?" @@ -562,24 +470,20 @@ bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 ui #define GOSSIP_ORONOK5 "Continue, please." #define GOSSIP_ORONOK6 "So what of the cipher now? And your boys?" #define GOSSIP_ORONOK7 "I will find your boys and the cipher, Oronok." - bool GossipHello_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pCreature->isVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pPlayer->GetQuestStatus(10519) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(10312, pCreature->GetGUID()); }else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -618,50 +522,38 @@ bool GossipSelect_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature, uin } return true; } - /*#### # npc_karynaku ####*/ - enum eKarynaku { QUEST_ALLY_OF_NETHER = 10870, - TAXI_PATH_ID = 649 }; - bool QuestAccept_npc_karynaku(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ALLY_OF_NETHER) pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID); //pPlayer->ActivateTaxiPathTo(649); - return true; } - /*#### # npc_overlord_morghor ####*/ - #define QUEST_LORD_ILLIDAN_STORMRAGE 11108 - #define C_ILLIDAN 22083 #define C_YARZILL 23141 - #define SPELL_ONE 39990 // Red Lightning Bolt #define SPELL_TWO 41528 // Mark of Stormrage #define SPELL_THREE 40216 // Dragonaw Faction #define SPELL_FOUR 42016 // Dragonaw Trasform - #define OVERLORD_SAY_1 -1000206 #define OVERLORD_SAY_2 -1000207 #define OVERLORD_SAY_3 -1000208 //signed for 28315 #define OVERLORD_SAY_4 -1000209 #define OVERLORD_SAY_5 -1000210 #define OVERLORD_SAY_6 -1000211 - #define OVERLORD_YELL_1 -1000212 #define OVERLORD_YELL_2 -1000213 - #define LORD_ILLIDAN_SAY_1 -1000214 #define LORD_ILLIDAN_SAY_2 -1000215 #define LORD_ILLIDAN_SAY_3 -1000216 @@ -669,32 +561,23 @@ bool QuestAccept_npc_karynaku(Player* pPlayer, Creature* pCreature, Quest const* #define LORD_ILLIDAN_SAY_5 -1000218 #define LORD_ILLIDAN_SAY_6 -1000219 #define LORD_ILLIDAN_SAY_7 -1000220 - #define YARZILL_THE_MERC_SAY -1000221 - struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI { npc_overlord_morghorAI(Creature *c) : ScriptedAI(c) {} - uint64 PlayerGUID; uint64 IllidanGUID; - uint32 ConversationTimer; uint32 Step; - bool Event; - void Reset() { PlayerGUID = 0; IllidanGUID = 0; - ConversationTimer = 0; Step = 0; - Event = false; } - void StartEvent() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -715,19 +598,15 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI Step = 0; Event = true; } - uint32 NextStep(uint32 Step) { Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID); - Unit* Illi = Unit::GetUnit((*m_creature), IllidanGUID); - if (!plr || !Illi) { EnterEvadeMode(); return 0; } - switch(Step) { case 0: return 0; break; @@ -758,7 +637,9 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI plr->RemoveAurasDueToSpell(SPELL_THREE); plr->RemoveAurasDueToSpell(SPELL_FOUR); return 5000; - }else{ + } + else + { CAST_PLR(plr)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); Step = 30; return 100; }break; case 17: DoScriptText(LORD_ILLIDAN_SAY_5, Illi); return 5000; break; @@ -812,16 +693,13 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI return 1000;}break; case 32: m_creature->GetMotionMaster()->MovePoint(0, -5085.77, 577.231, 86.6719); return 5000; break; case 33: Reset(); return 100; break; - default : return 0; } } - void UpdateAI(const uint32 diff) { if (!ConversationTimer) return; - if (ConversationTimer <= diff) { if (Event && IllidanGUID && PlayerGUID) @@ -831,12 +709,10 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI }else ConversationTimer -= diff; } }; - CreatureAI* GetAI_npc_overlord_morghor(Creature* pCreature) { return new npc_overlord_morghorAI(pCreature); } - bool QuestAccept_npc_overlord_morghor(Player* pPlayer, Creature* pCreature, const Quest *_Quest) { if (_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) @@ -847,11 +723,9 @@ bool QuestAccept_npc_overlord_morghor(Player* pPlayer, Creature* pCreature, cons } return false; } - /*#### # npc_earthmender_wilda ####*/ - enum eEarthmender { SAY_WIL_START = -1000381, @@ -864,35 +738,27 @@ enum eEarthmender SAY_WIL_PROGRESS5 = -1000388, SAY_WIL_JUST_AHEAD = -1000389, SAY_WIL_END = -1000390, - SPELL_CHAIN_LIGHTNING = 16006, SPELL_EARTHBING_TOTEM = 15786, SPELL_FROST_SHOCK = 12548, SPELL_HEALING_WAVE = 12491, - QUEST_ESCAPE_COILSCAR = 10451, NPC_COILSKAR_ASSASSIN = 21044, FACTION_EARTHEN = 1726 //guessed }; - struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI { npc_earthmender_wildaAI(Creature* pCreature) : npc_escortAI(pCreature) { } - uint32 m_uiHealingTimer; - void Reset() { m_uiHealingTimer = 0; } - void WaypointReached(uint32 uiPointId) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(uiPointId) { case 13: @@ -940,37 +806,31 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI break; case 50: DoScriptText(SAY_WIL_END, m_creature, pPlayer); - if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature); break; } } - void JustSummoned(Creature* pSummoned) { if (pSummoned->GetEntry() == NPC_COILSKAR_ASSASSIN) pSummoned->AI()->AttackStart(m_creature); } - //this is very unclear, random say without no real relevance to script/event void DoRandomSay() { DoScriptText(RAND(SAY_WIL_PROGRESS2,SAY_WIL_PROGRESS4,SAY_WIL_PROGRESS5), m_creature); } - void DoSpawnAssassin() { //unknown where they actually appear DoSummon(NPC_COILSKAR_ASSASSIN, me, 15.0f, 5000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); } - void Aggro(Unit* pWho) { //don't always use if (rand()%5) return; - //only aggro text if not player if (pWho->GetTypeId() != TYPEID_PLAYER) { @@ -979,14 +839,11 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI DoScriptText(RAND(SAY_WIL_AGGRO1, SAY_WIL_AGGRO2), pWho); } } - void UpdateAI(const uint32 uiDiff) { npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) return; - //TODO: add more abilities if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30) { @@ -1000,29 +857,24 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI } } }; - CreatureAI* GetAI_npc_earthmender_wilda(Creature* pCreature) { return new npc_earthmender_wildaAI(pCreature); } - bool QuestAccept_npc_earthmender_wilda(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_ESCAPE_COILSCAR) { DoScriptText(SAY_WIL_START, pCreature, pPlayer); pCreature->setFaction(FACTION_EARTHEN); - if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wildaAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } - /*##### # Quest: Battle of the crimson watch #####*/ - /* ContentData Battle of the crimson watch - creatures, gameobjects and defines mob_illidari_spawn : Adds that are summoned in the Crimson Watch battle. @@ -1030,19 +882,15 @@ mob_torloth_the_magnificent : Final Creature that players have to face before qu npc_lord_illidan_stormrage : Creature that controls the event. go_crystal_prison : GameObject that begins the event and hands out quest EndContentData */ - #define END_TEXT -1000366 //signed for 10646 - #define QUEST_BATTLE_OF_THE_CRIMSON_WATCH 10781 #define EVENT_AREA_RADIUS 65 //65yds #define EVENT_COOLDOWN 30000 //in ms. appear after event completed or failed (should be = Adds despawn time) - struct TorlothCinematic { int32 TextId; uint32 pCreature, Timer; }; - // Creature 0 - Torloth, 1 - Illidan static TorlothCinematic TorlothAnim[]= { @@ -1054,12 +902,10 @@ static TorlothCinematic TorlothAnim[]= {NULL, 0, 3000}, {NULL, 0, NULL} }; - struct Location { float x, y, z, o; }; - //Cordinates for Spawns static Location SpawnLocation[]= { @@ -1081,14 +927,12 @@ static Location SpawnLocation[]= {-4616.4736, 1384.2170, 139.9, 4.971},//Illidari Highlord {-4627.1240, 1378.8752, 139.9, 2.544} //Torloth The Magnificent }; - struct WaveData { uint8 SpawnCount, UsedSpawnPoint; uint32 CreatureId, SpawnTimer,YellTimer; int32 WaveTextId; }; - static WaveData WavesInfo[]= { {9, 0, 22075, 10000, 7000, -1000371}, //Illidari Soldier @@ -1096,12 +940,10 @@ static WaveData WavesInfo[]= {4, 11, 19797, 10000, 7000, -1000373}, //Illidari Highlord {1, 15, 22076, 10000, 7000, -1000374} //Torloth The Magnificent }; - struct SpawnSpells { uint32 Timer1, Timer2, SpellId; }; - static SpawnSpells SpawnCast[]= { {10000, 15000, 35871}, // Illidari Soldier Cast - Spellbreaker @@ -1114,46 +956,39 @@ static SpawnSpells SpawnCast[]= {18000, 20000, 39082}, // Torloth the Magnificent Cast - Shadowfury {25000, 28000, 33961} // Torloth the Magnificent Cast - Spell Reflection }; - /*###### # mob_illidari_spawn ######*/ - struct TRINITY_DLL_DECL mob_illidari_spawnAI : public ScriptedAI { mob_illidari_spawnAI(Creature* c) : ScriptedAI(c) {} - uint64 LordIllidanGUID; uint32 SpellTimer1, SpellTimer2, SpellTimer3; bool Timers; - void Reset() { LordIllidanGUID = 0; Timers = false; } - void EnterCombat(Unit* who) {} void JustDied(Unit* slayer); - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (!Timers) { - if (m_creature->GetEntry() == 22075)//Illidari Soldier + if (m_creature->GetEntry() == 22075) //Illidari Soldier { SpellTimer1 = SpawnCast[0].Timer1 + (rand()%4 * 1000); } - if (m_creature->GetEntry() == 22074)//Illidari Mind Breaker + if (m_creature->GetEntry() == 22074) //Illidari Mind Breaker { SpellTimer1 = SpawnCast[1].Timer1 + (rand()%10 * 1000); SpellTimer2 = SpawnCast[2].Timer1 + (rand()%4 * 1000); SpellTimer3 = SpawnCast[3].Timer1 + (rand()%4 * 1000); } - if (m_creature->GetEntry() == 19797)// Illidari Highlord + if (m_creature->GetEntry() == 19797) // Illidari Highlord { SpellTimer1 = SpawnCast[4].Timer1 + (rand()%4 * 1000); SpellTimer2 = SpawnCast[5].Timer1 + (rand()%4 * 1000); @@ -1183,13 +1018,11 @@ struct TRINITY_DLL_DECL mob_illidari_spawnAI : public ScriptedAI }else SpellTimer1 = 2000; } }else SpellTimer1 -= diff; - if (SpellTimer2 < diff) { DoCast(m_creature->getVictim(), SpawnCast[2].SpellId);//Psychic Scream SpellTimer2 = SpawnCast[2].Timer2 + (rand()%13 * 1000); }else SpellTimer2 -= diff; - if (SpellTimer3 < diff) { DoCast(m_creature->getVictim(), SpawnCast[3].SpellId);//Mind Blast @@ -1204,35 +1037,26 @@ struct TRINITY_DLL_DECL mob_illidari_spawnAI : public ScriptedAI DoCast(m_creature->getVictim(), SpawnCast[4].SpellId);//Curse Of Flames SpellTimer1 = SpawnCast[4].Timer2 + (rand()%10 * 1000); }else SpellTimer1 -= diff; - if (SpellTimer2 < diff) { DoCast(m_creature->getVictim(), SpawnCast[5].SpellId);//Flamestrike SpellTimer2 = SpawnCast[5].Timer2 + (rand()%7 * 13000); }else SpellTimer2 -= diff; } - DoMeleeAttackIfReady(); } }; - /*###### # mob_torloth_the_magnificent #####*/ - struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI { mob_torloth_the_magnificentAI(Creature* c) : ScriptedAI(c) {} - uint32 AnimationTimer, SpellTimer1, SpellTimer2, SpellTimer3; - uint8 AnimationCount; - uint64 LordIllidanGUID; uint64 AggroTargetGUID; - bool Timers; - void Reset() { AnimationTimer = 4000; @@ -1240,31 +1064,23 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI LordIllidanGUID = 0; AggroTargetGUID = 0; Timers = false; - m_creature->addUnitState(UNIT_STAT_ROOT); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); } - void EnterCombat(Unit* who){} - void HandleAnimation() { Creature* pCreature = m_creature; - if (TorlothAnim[AnimationCount].pCreature == 1) { pCreature = (Unit::GetCreature(*m_creature, LordIllidanGUID)); - if (!pCreature) return; } - if (TorlothAnim[AnimationCount].TextId) DoScriptText(TorlothAnim[AnimationCount].TextId, pCreature); - AnimationTimer = TorlothAnim[AnimationCount].Timer; - switch(AnimationCount) { case 0: @@ -1286,7 +1102,6 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->clearUnitState(UNIT_STAT_ROOT); - float x, y, z; AggroTarget->GetPosition(x,y,z); m_creature->GetMotionMaster()->MovePoint(0,x,y,z); @@ -1295,7 +1110,6 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI } ++AnimationCount; } - void UpdateAI(const uint32 diff) { if (AnimationTimer) @@ -1305,19 +1119,16 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI HandleAnimation(); }else AnimationTimer -= diff; } - if (AnimationCount < 6) { m_creature->CombatStop(); }else if (!Timers) { - SpellTimer1 = SpawnCast[6].Timer1; SpellTimer2 = SpawnCast[7].Timer1; SpellTimer3 = SpawnCast[8].Timer1; Timers = true; } - if (Timers) { if (SpellTimer1 < diff) @@ -1325,23 +1136,19 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI DoCast(m_creature->getVictim(), SpawnCast[6].SpellId);//Cleave SpellTimer1 = SpawnCast[6].Timer2 + (rand()%10 * 1000); }else SpellTimer1 -= diff; - if (SpellTimer2 < diff) { DoCast(m_creature->getVictim(), SpawnCast[7].SpellId);//Shadowfury SpellTimer2 = SpawnCast[7].Timer2 + (rand()%5 * 1000); }else SpellTimer2 -= diff; - if (SpellTimer3 < diff) { DoCast(m_creature, SpawnCast[8].SpellId); SpellTimer3 = SpawnCast[8].Timer2 + (rand()%7 * 1000);//Spell Reflection }else SpellTimer3 -= diff; } - DoMeleeAttackIfReady(); } - void JustDied(Unit* slayer) { if (slayer) @@ -1352,12 +1159,10 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI if (owner->GetTypeId() == TYPEID_PLAYER) CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, m_creature); break; - case TYPEID_PLAYER: CAST_PLR(slayer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, m_creature); break; } - if (Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID))) { DoScriptText(END_TEXT, LordIllidan, slayer); @@ -1365,47 +1170,35 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI } } }; - /*##### # npc_lord_illidan_stormrage #####*/ - struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI { npc_lord_illidan_stormrageAI(Creature* c) : ScriptedAI(c) {} - uint64 PlayerGUID; - uint32 WaveTimer; uint32 AnnounceTimer; - int8 LiveCount; uint8 WaveCount; - bool EventStarted; bool Announced; bool Failed; - void Reset() { PlayerGUID = 0; - WaveTimer = 10000; AnnounceTimer = 7000; LiveCount = 0; WaveCount = 0; - EventStarted = false; Announced = false; Failed = false; - m_creature->SetVisibility(VISIBILITY_OFF); } - void EnterCombat(Unit* who) {} void MoveInLineOfSight(Unit* who) {} void AttackStart(Unit* who) {} - void SummonNextWave() { uint8 count = WavesInfo[WaveCount].SpawnCount; @@ -1413,8 +1206,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI srand(time(NULL));//initializing random seed uint8 FelguardCount = 0; uint8 DreadlordCount = 0; - - for(uint8 i = 0; i < count; ++i) + for (uint8 i = 0; i < count; ++i) { Creature* Spawn = NULL; float X = SpawnLocation[locIndex + i].x; @@ -1423,12 +1215,10 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI float O = SpawnLocation[locIndex + i].o; Spawn = m_creature->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); ++LiveCount; - if (Spawn) { Spawn->LoadCreaturesAddon(); - - if (WaveCount == 0)//1 Wave + if (WaveCount == 0) //1 Wave { if (rand()%3 == 1 && FelguardCount<2) { @@ -1446,8 +1236,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI ++FelguardCount; } } - - if (WaveCount < 3)//1-3 Wave + if (WaveCount < 3) //1-3 Wave { if (PlayerGUID) { @@ -1460,7 +1249,6 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI } CAST_AI(mob_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = m_creature->GetGUID(); } - if (WavesInfo[WaveCount].CreatureId == 22076) // Torloth { CAST_AI(mob_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = m_creature->GetGUID(); @@ -1473,25 +1261,19 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI WaveTimer = WavesInfo[WaveCount].SpawnTimer; AnnounceTimer = WavesInfo[WaveCount].YellTimer; } - void CheckEventFail() { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (!pPlayer) return; - if (Group *EventGroup = pPlayer->GetGroup()) { Player* GroupMember; - uint8 GroupMemberCount = 0; uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - - for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) { GroupMember = (Unit::GetPlayer(itr->guid)); if (!GroupMember) @@ -1503,24 +1285,20 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI ++FailedMemberCount; } ++GroupMemberCount; - if (GroupMember->isDead()) { ++DeadMemberCount; } } - if (GroupMemberCount == FailedMemberCount) { Failed = true; } - if (GroupMemberCount == DeadMemberCount) { - for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) { GroupMember = Unit::GetPlayer(itr->guid); - if (GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) { GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); @@ -1535,19 +1313,16 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI Failed = true; } } - void LiveCounter() { --LiveCount; if (!LiveCount) Announced = false; } - void UpdateAI(const uint32 diff) { if (!PlayerGUID || !EventStarted) return; - if (!LiveCount && WaveCount < 4) { if (!Announced && AnnounceTimer < diff) @@ -1555,19 +1330,16 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI DoScriptText(WavesInfo[WaveCount].WaveTextId, m_creature); Announced = true; }else AnnounceTimer -= diff; - if (WaveTimer < diff) { SummonNextWave(); }else WaveTimer -= diff; } CheckEventFail(); - if (Failed) EnterEvadeMode(); } }; - void mob_illidari_spawnAI::JustDied(Unit *slayer) { m_creature->RemoveCorpse(); @@ -1575,17 +1347,14 @@ void mob_illidari_spawnAI::JustDied(Unit *slayer) if (LordIllidan) CAST_AI(npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); } - /*##### # go_crystal_prison ######*/ - bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* quest) { if (quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH) { Creature* Illidan = plr->FindNearestCreature(22083, 50); - if (Illidan && !CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted) { CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = plr->GetGUID(); @@ -1595,74 +1364,58 @@ bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* q } return true; } - CreatureAI* GetAI_npc_lord_illidan_stormrage(Creature* c) { return new npc_lord_illidan_stormrageAI(c); } - CreatureAI* GetAI_mob_illidari_spawn(Creature* c) { return new mob_illidari_spawnAI(c); } - CreatureAI* GetAI_mob_torloth_the_magnificent(Creature* c) { return new mob_torloth_the_magnificentAI(c); } - /*#### # npc_enraged_spirits ####*/ - /* QUESTS */ #define QUEST_ENRAGED_SPIRITS_FIRE_EARTH 10458 #define QUEST_ENRAGED_SPIRITS_AIR 10481 #define QUEST_ENRAGED_SPIRITS_WATER 10480 - /* Totem */ #define ENTRY_TOTEM_OF_SPIRITS 21071 #define RADIUS_TOTEM_OF_SPIRITS 15 - /* SPIRITS */ #define ENTRY_ENRAGED_EARTH_SPIRIT 21050 #define ENTRY_ENRAGED_FIRE_SPIRIT 21061 #define ENTRY_ENRAGED_AIR_SPIRIT 21060 #define ENTRY_ENRAGED_WATER_SPIRIT 21059 - /* SOULS */ #define ENTRY_EARTHEN_SOUL 21073 #define ENTRY_FIERY_SOUL 21097 #define ENTRY_ENRAGED_AIRY_SOUL 21116 #define ENTRY_ENRAGED_WATERY_SOUL 21109 // wrong model - /* SPELL KILLCREDIT - not working!?! - using KilledMonsterCredit */ #define SPELL_EARTHEN_SOUL_CAPTURED_CREDIT 36108 #define SPELL_FIERY_SOUL_CAPTURED_CREDIT 36117 #define SPELL_AIRY_SOUL_CAPTURED_CREDIT 36182 #define SPELL_WATERY_SOUL_CAPTURED_CREDIT 36171 - /* KilledMonsterCredit Workaround */ #define CREDIT_FIRE 21094 #define CREDIT_WATER 21095 #define CREDIT_AIR 21096 #define CREDIT_EARTH 21092 - /* Captured Spell/Buff */ #define SPELL_SOUL_CAPTURED 36115 - /* Factions */ #define ENRAGED_SOUL_FRIENDLY 35 #define ENRAGED_SOUL_HOSTILE 14 - struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI { npc_enraged_spiritAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } - void EnterCombat(Unit *who){} - void JustDied(Unit* killer) { // always spawn spirit on death @@ -1670,7 +1423,6 @@ struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI // move spirit to totem and cast kill count uint32 entry = 0; uint32 credit = 0; - switch(m_creature->GetEntry()) { case ENTRY_ENRAGED_FIRE_SPIRIT: entry = ENTRY_FIERY_SOUL; @@ -1693,14 +1445,11 @@ struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI credit = CREDIT_WATER; break; } - // Spawn Soul on Kill ALWAYS! Creature* Summoned = NULL; Unit* totemOspirits = NULL; - if (entry != 0) Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); - // FIND TOTEM, PROCESS QUEST if (Summoned) { @@ -1709,7 +1458,6 @@ struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI { Summoned->setFaction(ENRAGED_SOUL_FRIENDLY); Summoned->GetMotionMaster()->MovePoint(0,totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ()); - Unit* Owner = totemOspirits->GetOwner(); if (Owner && Owner->GetTypeId() == TYPEID_PLAYER) // DoCast(Owner, credit); -- not working! @@ -1719,102 +1467,83 @@ struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_enraged_spirit(Creature* pCreature) { return new npc_enraged_spiritAI(pCreature); } - /*##### # ######*/ - void AddSC_shadowmoon_valley() { Script *newscript; - newscript = new Script; newscript->Name = "mob_mature_netherwing_drake"; newscript->GetAI = &GetAI_mob_mature_netherwing_drake; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_enslaved_netherwing_drake"; newscript->GetAI = &GetAI_mob_enslaved_netherwing_drake; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_dragonmaw_peon"; newscript->GetAI = &GetAI_mob_dragonmaw_peon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_drake_dealer_hurlunk"; newscript->pGossipHello = &GossipHello_npc_drake_dealer_hurlunk; newscript->pGossipSelect = &GossipSelect_npc_drake_dealer_hurlunk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npcs_flanis_swiftwing_and_kagrosh"; newscript->pGossipHello = &GossipHello_npcs_flanis_swiftwing_and_kagrosh; newscript->pGossipSelect = &GossipSelect_npcs_flanis_swiftwing_and_kagrosh; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_murkblood_overseer"; newscript->pGossipHello = &GossipHello_npc_murkblood_overseer; newscript->pGossipSelect = &GossipSelect_npc_murkblood_overseer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_neltharaku"; newscript->pGossipHello = &GossipHello_npc_neltharaku; newscript->pGossipSelect = &GossipSelect_npc_neltharaku; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_karynaku"; newscript->pQuestAccept = &QuestAccept_npc_karynaku; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_oronok_tornheart"; newscript->pGossipHello = &GossipHello_npc_oronok_tornheart; newscript->pGossipSelect = &GossipSelect_npc_oronok_tornheart; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_overlord_morghor"; newscript->GetAI = &GetAI_npc_overlord_morghor; newscript->pQuestAccept = &QuestAccept_npc_overlord_morghor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_earthmender_wilda"; newscript->GetAI = &GetAI_npc_earthmender_wilda; newscript->pQuestAccept = &QuestAccept_npc_earthmender_wilda; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lord_illidan_stormrage"; newscript->GetAI = &GetAI_npc_lord_illidan_stormrage; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_crystal_prison"; newscript->pGOQuestAccept = &GOQuestAccept_GO_crystal_prison; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_illidari_spawn"; newscript->GetAI = &GetAI_mob_illidari_spawn; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_torloth_the_magnificent"; newscript->GetAI = &GetAI_mob_torloth_the_magnificent; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_enraged_spirit"; newscript->GetAI = &GetAI_npc_enraged_spirit; diff --git a/src/bindings/scripts/scripts/outland/shattrath_city.cpp b/src/bindings/scripts/scripts/outland/shattrath_city.cpp index cd25653fc61..54e29840957 100644 --- a/src/bindings/scripts/scripts/outland/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/outland/shattrath_city.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Shattrath_City SD%Complete: 100 SDComment: Quest support: 10004, 10009, 10211, 10231. Flask vendors, Teleport to Caverns of Time SDCategory: Shattrath City EndScriptData */ - /* ContentData npc_raliq_the_drunk npc_salsalabim @@ -31,68 +29,54 @@ npc_dirty_larry npc_ishanah npc_khadgar EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npc_raliq_the_drunk ######*/ - #define GOSSIP_RALIQ "You owe Sim'salabim money. Hand them over or die!" - enum eRaliq { SPELL_UPPERCUT = 10966, QUEST_CRACK_SKULLS = 10009, FACTION_HOSTILE_RD = 45 }; - struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI { npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } - uint32 m_uiNormFaction; uint32 Uppercut_Timer; - void Reset() { Uppercut_Timer = 5000; me->RestoreFaction(); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Uppercut_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_UPPERCUT); Uppercut_Timer = 15000; }else Uppercut_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_raliq_the_drunk(Creature* pCreature) { return new npc_raliq_the_drunkAI (pCreature); } - bool GossipHello_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_RALIQ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9440, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -103,29 +87,22 @@ bool GossipSelect_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature, uint } return true; } - /*###### # npc_salsalabim ######*/ - #define FACTION_HOSTILE_SA 90 #define FACTION_FRIENDLY_SA 35 #define QUEST_10004 10004 - #define SPELL_MAGNETIC_PULL 31705 - struct TRINITY_DLL_DECL npc_salsalabimAI : public ScriptedAI { npc_salsalabimAI(Creature* c) : ScriptedAI(c) {} - uint32 MagneticPull_Timer; - void Reset() { MagneticPull_Timer = 15000; me->RestoreFaction(); } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -136,18 +113,15 @@ struct TRINITY_DLL_DECL npc_salsalabimAI : public ScriptedAI EnterEvadeMode(); } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (MagneticPull_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MAGNETIC_PULL); MagneticPull_Timer = 15000; }else MagneticPull_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -155,7 +129,6 @@ CreatureAI* GetAI_npc_salsalabim(Creature* pCreature) { return new npc_salsalabimAI (pCreature); } - bool GossipHello_npc_salsalabim(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_10004) == QUEST_STATUS_INCOMPLETE) @@ -171,7 +144,6 @@ bool GossipHello_npc_salsalabim(Player* pPlayer, Creature* pCreature) } return true; } - /* ################################################## Shattrath City Flask Vendors provides flasks to people exalted with 3 factions: @@ -182,7 +154,6 @@ purchasable for one Mark of Illidari each Purchase requires exalted reputation with Scryers/Aldor, Cenarion Expedition and The Sha'tar ################################################## */ - bool GossipHello_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature) { if (pCreature->GetEntry() == 23484) @@ -198,7 +169,6 @@ bool GossipHello_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(11083, pCreature->GetGUID()); } } - if (pCreature->GetEntry() == 23483) { // Scryers vendor @@ -212,46 +182,34 @@ bool GossipHello_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(11084, pCreature->GetGUID()); } } - return true; } - bool GossipSelect_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### # npc_zephyr ######*/ - #define GOSSIP_HZ "Take me to the Caverns of Time." - bool GossipHello_npc_zephyr(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetReputationRank(989) >= REP_REVERED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HZ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_zephyr(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) pPlayer->CastSpell(pPlayer,37778,false); - return true; } - /*###### # npc_kservant ######*/ - #define SAY1 -1000306 #define WHISP1 -1000307 #define WHISP2 -1000308 @@ -274,20 +232,16 @@ bool GossipSelect_npc_zephyr(Player* pPlayer, Creature* pCreature, uint32 uiSend #define WHISP19 -1000325 #define WHISP20 -1000326 #define WHISP21 -1000327 - struct TRINITY_DLL_DECL npc_kservantAI : public npc_escortAI { public: npc_kservantAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: DoScriptText(SAY1, m_creature, pPlayer); break; @@ -317,12 +271,10 @@ public: break; } } - void MoveInLineOfSight(Unit* pWho) { if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (pWho->GetTypeId() == TYPEID_PLAYER) { if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) @@ -335,54 +287,42 @@ public: } } } - void Reset() {} }; CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) { return new npc_kservantAI(pCreature); } - /*###### # npc_dirty_larry ######*/ - #define GOSSIP_BOOK "Ezekiel said that you might have a certain book..." - #define SAY_1 -1000328 #define SAY_2 -1000329 #define SAY_3 -1000330 #define SAY_4 -1000331 #define SAY_5 -1000332 #define SAY_GIVEUP -1000333 - #define QUEST_WBI 10231 #define NPC_CREEPJACK 19726 #define NPC_MALONE 19725 - struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI { npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {} - bool Event; bool Attack; bool Done; - uint64 PlayerGUID; - uint32 SayTimer; uint32 Step; - void Reset() { Event = false; Attack = false; Done = false; - PlayerGUID = 0; SayTimer = 0; Step = 0; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->setFaction(1194); Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); @@ -400,11 +340,9 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } } - uint32 NextStep(uint32 Step) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - switch(Step) { case 0:{ m_creature->SetInFront(pPlayer); @@ -424,9 +362,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI default: return 0; } } - void EnterCombat(Unit* who){} - void UpdateAI(const uint32 diff) { if (SayTimer < diff) @@ -434,7 +370,6 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI if (Event) SayTimer = NextStep(++Step); }else SayTimer -= diff; - if (Attack) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); @@ -463,7 +398,6 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI } Attack = false; } - if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done) { Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); @@ -496,19 +430,15 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI DoMeleeAttackIfReady(); } }; - bool GossipHello_npc_dirty_larry(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_dirty_larry(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -517,69 +447,52 @@ bool GossipSelect_npc_dirty_larry(Player* pPlayer, Creature* pCreature, uint32 u CAST_AI(npc_dirty_larryAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); pPlayer->CLOSE_GOSSIP_MENU(); } - return true; } - CreatureAI* GetAI_npc_dirty_larryAI(Creature* pCreature) { return new npc_dirty_larryAI (pCreature); } - /*###### # npc_ishanah ######*/ - #define ISANAH_GOSSIP_1 "Who are the Sha'tar?" #define ISANAH_GOSSIP_2 "Isn't Shattrath a draenei city? Why do you allow others here?" - bool GossipHello_npc_ishanah(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_ishanah(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) pPlayer->SEND_GOSSIP_MENU(9458, pCreature->GetGUID()); else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) pPlayer->SEND_GOSSIP_MENU(9459, pCreature->GetGUID()); - return true; } - /*###### # npc_khadgar ######*/ - #define KHADGAR_GOSSIP_1 "I've heard your name spoken only in whispers, mage. Who are you?" #define KHADGAR_GOSSIP_2 "Go on, please." #define KHADGAR_GOSSIP_3 "I see." //6th too this #define KHADGAR_GOSSIP_4 "What did you do then?" #define KHADGAR_GOSSIP_5 "What happened next?" #define KHADGAR_GOSSIP_7 "There was something else I wanted to ask you." - bool GossipHello_npc_khadgar(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (!pPlayer->hasQuest(10211)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9243, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_khadgar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -615,54 +528,45 @@ bool GossipSelect_npc_khadgar(Player* pPlayer, Creature* pCreature, uint32 uiSen } return true; } - void AddSC_shattrath_city() { Script *newscript; - newscript = new Script; newscript->Name = "npc_raliq_the_drunk"; newscript->GetAI = &GetAI_npc_raliq_the_drunk; newscript->pGossipHello = &GossipHello_npc_raliq_the_drunk; newscript->pGossipSelect = &GossipSelect_npc_raliq_the_drunk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_salsalabim"; newscript->GetAI = &GetAI_npc_salsalabim; newscript->pGossipHello = &GossipHello_npc_salsalabim; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_shattrathflaskvendors"; newscript->pGossipHello = &GossipHello_npc_shattrathflaskvendors; newscript->pGossipSelect = &GossipSelect_npc_shattrathflaskvendors; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_zephyr"; newscript->pGossipHello = &GossipHello_npc_zephyr; newscript->pGossipSelect = &GossipSelect_npc_zephyr; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kservant"; newscript->GetAI = &GetAI_npc_kservantAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_dirty_larry"; newscript->GetAI = &GetAI_npc_dirty_larryAI; newscript->pGossipHello = &GossipHello_npc_dirty_larry; newscript->pGossipSelect = &GossipSelect_npc_dirty_larry; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ishanah"; newscript->pGossipHello = &GossipHello_npc_ishanah; newscript->pGossipSelect = &GossipSelect_npc_ishanah; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_khadgar"; newscript->pGossipHello = &GossipHello_npc_khadgar; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/arcatraz.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/arcatraz.cpp index 6c5460e1d83..b329e1a2f3b 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/arcatraz.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/arcatraz.cpp @@ -13,27 +13,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Arcatraz SD%Complete: 60 SDComment: Warden Mellichar, event controller for Skyriss event. Millhouse Manastorm. TODO: make better combatAI for Millhouse. SDCategory: Tempest Keep, The Arcatraz EndScriptData */ - /* ContentData npc_millhouse_manastorm npc_warden_mellichar mob_zerekethvoidzone EndContentData */ - #include "precompiled.h" #include "def_arcatraz.h" - /*##### # npc_millhouse_manastorm #####*/ - #define SAY_INTRO_1 -1552010 #define SAY_INTRO_2 -1552011 #define SAY_WATER -1552012 @@ -47,57 +42,46 @@ EndContentData */ #define SAY_LOWHP -1552020 #define SAY_DEATH -1552021 #define SAY_COMPLETE -1552022 - #define SPELL_CONJURE_WATER 36879 #define SPELL_ARCANE_INTELLECT 36880 #define SPELL_ICE_ARMOR 36881 - #define SPELL_ARCANE_MISSILES 33833 #define SPELL_CONE_OF_COLD 12611 #define SPELL_FIRE_BLAST 13341 #define SPELL_FIREBALL 14034 #define SPELL_FROSTBOLT 15497 #define SPELL_PYROBLAST 33975 - struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI { npc_millhouse_manastormAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 EventProgress_Timer; uint32 Phase; bool Init; bool LowHp; - uint32 Pyroblast_Timer; uint32 Fireball_Timer; - void Reset() { EventProgress_Timer = 2000; LowHp = false; Init = false; Phase = 1; - Pyroblast_Timer = 1000; Fireball_Timer = 2500; - if (pInstance) { if (pInstance->GetData(TYPE_WARDEN_2) == DONE) Init = true; - if (pInstance->GetData(TYPE_HARBINGERSKYRISS) == DONE) { DoScriptText(SAY_COMPLETE, m_creature); } } } - void AttackStart(Unit* pWho) { if (m_creature->Attack(pWho, true)) @@ -105,29 +89,23 @@ struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI m_creature->AddThreat(pWho, 0.0f); m_creature->SetInCombatWith(pWho); pWho->SetInCombatWith(m_creature); - m_creature->GetMotionMaster()->MoveChase(pWho, 25.0f); } } - void EnterCombat(Unit *who) { } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - /*for questId 10886 (heroic mode only) if (pInstance && pInstance->GetData(TYPE_HARBINGERSKYRISS) != DONE) ->FailQuest();*/ } - void UpdateAI(const uint32 diff) { if (!Init) @@ -175,46 +153,36 @@ struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI } } else EventProgress_Timer -= diff; } - if (!UpdateVictim()) return; - if (!LowHp && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20)) { DoScriptText(SAY_LOWHP, m_creature); LowHp = true; } - if (Pyroblast_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) return; - DoScriptText(SAY_PYRO, m_creature); - DoCast(m_creature->getVictim(),SPELL_PYROBLAST); Pyroblast_Timer = 40000; }else Pyroblast_Timer -=diff; - if (Fireball_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FIREBALL); Fireball_Timer = 4000; }else Fireball_Timer -=diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_millhouse_manastorm(Creature* pCreature) { return new npc_millhouse_manastormAI (pCreature); } - /*##### # npc_warden_mellichar #####*/ - #define YELL_INTRO1 -1552023 #define YELL_INTRO2 -1552024 #define YELL_RELEASE1 -1552025 @@ -223,7 +191,6 @@ CreatureAI* GetAI_npc_millhouse_manastorm(Creature* pCreature) #define YELL_RELEASE3 -1552028 #define YELL_RELEASE4 -1552029 #define YELL_WELCOME -1552030 - //phase 2(acid mobs) #define ENTRY_TRICKSTER 20905 #define ENTRY_PH_HUNTER 20906 @@ -237,7 +204,6 @@ CreatureAI* GetAI_npc_millhouse_manastorm(Creature* pCreature) #define ENTRY_BL_DRAK 20911 //phase 6 #define ENTRY_SKYRISS 20912 - //TARGET_SCRIPT #define SPELL_TARGET_ALPHA 36856 #define SPELL_TARGET_BETA 36854 @@ -245,62 +211,48 @@ CreatureAI* GetAI_npc_millhouse_manastorm(Creature* pCreature) #define SPELL_TARGET_GAMMA 36858 #define SPELL_TARGET_OMEGA 36852 #define SPELL_BUBBLE_VISUAL 36849 - struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI { npc_warden_mellicharAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - bool IsRunning; bool CanSpawn; - uint32 EventProgress_Timer; uint32 Phase; - void Reset() { IsRunning = false; CanSpawn = false; - EventProgress_Timer = 22000; Phase = 1; - m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); DoCast(m_creature,SPELL_TARGET_OMEGA); - if (pInstance) pInstance->SetData(TYPE_HARBINGERSKYRISS,NOT_STARTED); } - void AttackStart(Unit* who) { } - void MoveInLineOfSight(Unit *who) { if (IsRunning) return; - if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) { if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; if (who->GetTypeId() != TYPEID_PLAYER) return; - float attackRadius = m_creature->GetAttackDistance(who)/10; if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) EnterCombat(who); } } - void EnterCombat(Unit *who) { DoScriptText(YELL_INTRO1, m_creature); DoCast(m_creature,SPELL_BUBBLE_VISUAL); - if (pInstance) { pInstance->SetData(TYPE_HARBINGERSKYRISS,IN_PROGRESS); @@ -308,7 +260,6 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI IsRunning = true; } } - bool CanProgress() { if (pInstance) @@ -331,14 +282,12 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI } return false; } - void DoPrepareForPhase() { if (pInstance) { m_creature->InterruptNonMeleeSpells(true); m_creature->RemoveAurasByType(SPELL_AURA_DUMMY); - switch(Phase) { case 2: @@ -365,12 +314,10 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI CanSpawn = true; } } - void UpdateAI(const uint32 diff) { if (!IsRunning) return; - if (EventProgress_Timer < diff) { if (pInstance) @@ -381,13 +328,11 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI return; } } - if (CanSpawn) { //continue beam omega pod, unless we are about to summon skyriss if (Phase != 7) DoCast(m_creature,SPELL_TARGET_OMEGA); - switch(Phase) { case 2: @@ -471,47 +416,37 @@ CreatureAI* GetAI_npc_warden_mellichar(Creature* pCreature) { return new npc_warden_mellicharAI (pCreature); } - /*##### # mob_zerekethvoidzone (this script probably not needed in future -> `creature_template_addon`.`auras`='36120 0') #####*/ - #define SPELL_VOID_ZONE_DAMAGE 36120 - struct TRINITY_DLL_DECL mob_zerekethvoidzoneAI : public ScriptedAI { mob_zerekethvoidzoneAI(Creature *c) : ScriptedAI(c) {} - void Reset() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS,0); m_creature->setFaction(16); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(m_creature,SPELL_VOID_ZONE_DAMAGE); } - void EnterCombat(Unit* who) {} }; CreatureAI* GetAI_mob_zerekethvoidzoneAI(Creature* pCreature) { return new mob_zerekethvoidzoneAI (pCreature); } - void AddSC_arcatraz() { Script *newscript; - newscript = new Script; newscript->Name = "npc_millhouse_manastorm"; newscript->GetAI = &GetAI_npc_millhouse_manastorm; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_warden_mellichar"; newscript->GetAI = &GetAI_npc_warden_mellichar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_zerekethvoidzone"; newscript->GetAI = &GetAI_mob_zerekethvoidzoneAI; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp index e5620e908c2..ba7851b7a47 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp @@ -13,22 +13,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Harbinger_Skyriss SD%Complete: 45 SDComment: CombatAI not fully implemented. Timers will need adjustments. Need more docs on how event fully work. Reset all event and force start over if fail at one point? SDCategory: Tempest Keep, The Arcatraz EndScriptData */ - /* ContentData boss_harbinger_skyriss boss_harbinger_skyriss_illusion EndContentData */ - #include "precompiled.h" #include "def_arcatraz.h" - #define SAY_INTRO -1552000 #define SAY_AGGRO -1552001 #define SAY_KILL_1 -1552002 @@ -39,20 +35,14 @@ EndContentData */ #define SAY_FEAR_2 -1552007 #define SAY_IMAGE -1552008 #define SAY_DEATH -1552009 - #define SPELL_FEAR 39415 - #define SPELL_MIND_REND 36924 #define H_SPELL_MIND_REND 39017 - #define SPELL_DOMINATION 37162 #define H_SPELL_DOMINATION 39019 - #define H_SPELL_MANA_BURN 39020 - #define SPELL_66_ILLUSION 36931 //entry 21466 #define SPELL_33_ILLUSION 36932 //entry 21467 - struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI { boss_harbinger_skyrissAI(Creature *c) : ScriptedAI(c) @@ -61,29 +51,23 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI HeroicMode = c->GetMap()->IsHeroic(); Intro = false; } - ScriptedInstance *pInstance; bool HeroicMode; - bool Intro; bool IsImage33; bool IsImage66; - uint32 Intro_Phase; uint32 Intro_Timer; uint32 MindRend_Timer; uint32 Fear_Timer; uint32 Domination_Timer; uint32 ManaBurn_Timer; - void Reset() { if (!Intro) m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - IsImage33 = false; IsImage66 = false; - Intro_Phase = 1; Intro_Timer = 5000; MindRend_Timer = 3000; @@ -91,7 +75,6 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI Domination_Timer = 30000; ManaBurn_Timer = 25000; } - void MoveInLineOfSight(Unit *who) { if (!Intro) @@ -100,16 +83,13 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI } ScriptedAI::MoveInLineOfSight(who); } - void EnterCombat(Unit *who) {} - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); if (pInstance) pInstance->SetData(TYPE_HARBINGERSKYRISS,DONE); } - void JustSummoned(Creature *summon) { if (!summon) @@ -122,36 +102,29 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) summon->AI()->AttackStart(target); } - void KilledUnit(Unit* victim) { //won't yell killing pet/other unit if (victim->GetEntry() == 21436) return; - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void DoSplit(uint32 val) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoScriptText(SAY_IMAGE, m_creature); - if (val == 66) DoCast(m_creature, SPELL_66_ILLUSION); else DoCast(m_creature, SPELL_33_ILLUSION); } - void UpdateAI(const uint32 diff) { if (!Intro) { if (!pInstance) return; - if (Intro_Timer < diff) { switch(Intro_Phase) @@ -181,10 +154,8 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI } }else Intro_Timer -=diff; } - if (!UpdateVictim()) return; - if (!IsImage66 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 66)) { DoSplit(66); @@ -195,101 +166,77 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI DoSplit(33); IsImage33 = true; } - if (MindRend_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,HEROIC(SPELL_MIND_REND, H_SPELL_MIND_REND)); else DoCast(m_creature->getVictim(),HEROIC(SPELL_MIND_REND, H_SPELL_MIND_REND)); - MindRend_Timer = 8000; }else MindRend_Timer -=diff; - if (Fear_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) return; - DoScriptText(RAND(SAY_FEAR_1,SAY_FEAR_2), m_creature); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,SPELL_FEAR); else DoCast(m_creature->getVictim(),SPELL_FEAR); - Fear_Timer = 25000; }else Fear_Timer -=diff; - if (Domination_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) return; - DoScriptText(RAND(SAY_MIND_1,SAY_MIND_2), m_creature); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,HEROIC(SPELL_DOMINATION, H_SPELL_DOMINATION)); else DoCast(m_creature->getVictim(),HEROIC(SPELL_DOMINATION, H_SPELL_DOMINATION)); - Domination_Timer = 16000+rand()%16000; }else Domination_Timer -=diff; - if (HeroicMode) { if (ManaBurn_Timer < diff) { if (m_creature->IsNonMeleeSpellCasted(false)) return; - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,H_SPELL_MANA_BURN); - ManaBurn_Timer = 16000+rand()%16000; }else ManaBurn_Timer -=diff; } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_harbinger_skyriss(Creature* pCreature) { return new boss_harbinger_skyrissAI (pCreature); } - #define SPELL_MIND_REND_IMAGE 36929 #define H_SPELL_MIND_REND_IMAGE 39021 - struct TRINITY_DLL_DECL boss_harbinger_skyriss_illusionAI : public ScriptedAI { boss_harbinger_skyriss_illusionAI(Creature *c) : ScriptedAI(c) { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - void Reset() { } - void EnterCombat(Unit *who) { } }; - CreatureAI* GetAI_boss_harbinger_skyriss_illusion(Creature* pCreature) { return new boss_harbinger_skyriss_illusionAI (pCreature); } - void AddSC_boss_harbinger_skyriss() { Script *newscript; - newscript = new Script; newscript->Name = "boss_harbinger_skyriss"; newscript->GetAI = &GetAI_boss_harbinger_skyriss; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_harbinger_skyriss_illusion"; newscript->GetAI = &GetAI_boss_harbinger_skyriss_illusion; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/def_arcatraz.h b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/def_arcatraz.h index 3f8dee8bbd0..56810237064 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/def_arcatraz.h +++ b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/def_arcatraz.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_ARCATRAZ_H #define DEF_ARCATRAZ_H - #define TYPE_ZEREKETH 1 #define TYPE_DALLIAH 2 #define TYPE_SOCCOTHRATES 3 diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp index ebf5484671c..44c13e4c3a1 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp @@ -13,19 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Arcatraz SD%Complete: 80 SDComment: Mainly Harbringer Skyriss event SDCategory: Tempest Keep, The Arcatraz EndScriptData */ - #include "precompiled.h" #include "def_arcatraz.h" - #define MAX_ENCOUNTER 9 - #define CONTAINMENT_CORE_SECURITY_FIELD_ALPHA 184318 //door opened when Wrath-Scryer Soccothrates dies #define CONTAINMENT_CORE_SECURITY_FIELD_BETA 184319 //door opened when Dalliah the Doomsayer dies #define POD_ALPHA 183961 //pod first boss wave @@ -35,23 +31,18 @@ EndScriptData */ #define POD_OMEGA 183965 //pod fifth boss wave #define WARDENS_SHIELD 184802 // warden shield #define SEAL_SPHERE 184802 //shield 'protecting' mellichar - #define MELLICHAR 20904 //skyriss will kill this unit - /* Arcatraz encounters: 1 - Zereketh the Unbound event 2 - Dalliah the Doomsayer event 3 - Wrath-Scryer Soccothrates event 4 - Harbinger Skyriss event, 5 sub-events */ - struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance { instance_arcatraz(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - GameObject *Containment_Core_Security_Field_Alpha; GameObject *Containment_Core_Security_Field_Beta; GameObject *Pod_Alpha; @@ -60,14 +51,11 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance GameObject *Pod_Delta; GameObject *Pod_Omega; GameObject *Wardens_Shield; - uint64 GoSphereGUID; uint64 MellicharGUID; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Containment_Core_Security_Field_Alpha = NULL; Containment_Core_Security_Field_Beta = NULL; Pod_Alpha = NULL; @@ -76,19 +64,15 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance Pod_Gamma = NULL; Pod_Omega = NULL; Wardens_Shield = NULL; - GoSphereGUID = 0; MellicharGUID = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -104,13 +88,11 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance //case WARDENS_SHIELD: Wardens_Shield = pGo; break; } } - void OnCreatureCreate(Creature* pCreature, bool add) { if (pCreature->GetEntry() == MELLICHAR) MellicharGUID = pCreature->GetGUID(); } - void SetData(uint32 type, uint32 data) { switch(type) @@ -118,21 +100,18 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance case TYPE_ZEREKETH: m_auiEncounter[0] = data; break; - case TYPE_DALLIAH: if (data == DONE) if (Containment_Core_Security_Field_Beta) Containment_Core_Security_Field_Beta->UseDoorOrButton(); m_auiEncounter[1] = data; break; - case TYPE_SOCCOTHRATES: if (data == DONE) if (Containment_Core_Security_Field_Alpha) Containment_Core_Security_Field_Alpha->UseDoorOrButton(); m_auiEncounter[2] = data; break; - case TYPE_HARBINGERSKYRISS: if (data == NOT_STARTED || data == FAIL) { @@ -144,42 +123,36 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance } m_auiEncounter[3] = data; break; - case TYPE_WARDEN_1: if (data == IN_PROGRESS) if (Pod_Alpha) Pod_Alpha->UseDoorOrButton(); m_auiEncounter[4] = data; break; - case TYPE_WARDEN_2: if (data == IN_PROGRESS) if (Pod_Beta) Pod_Beta->UseDoorOrButton(); m_auiEncounter[5] = data; break; - case TYPE_WARDEN_3: if (data == IN_PROGRESS) if (Pod_Delta) Pod_Delta->UseDoorOrButton(); m_auiEncounter[6] = data; break; - case TYPE_WARDEN_4: if (data == IN_PROGRESS) if (Pod_Gamma) Pod_Gamma->UseDoorOrButton(); m_auiEncounter[7] = data; break; - case TYPE_WARDEN_5: if (data == IN_PROGRESS) if (Pod_Omega) Pod_Omega->UseDoorOrButton(); m_auiEncounter[8] = data; break; - case TYPE_SHIELD_OPEN: if (data == IN_PROGRESS) if (Wardens_Shield) @@ -187,7 +160,6 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance break; } } - uint32 GetData(uint32 type) { switch(type) @@ -207,7 +179,6 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance } return 0; } - uint64 GetData64(uint32 data) { switch(data) @@ -220,12 +191,10 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance return 0; } }; - InstanceData* GetInstanceData_instance_arcatraz(Map* pMap) { return new instance_arcatraz(pMap); } - void AddSC_instance_arcatraz() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_high_botanist_freywinn.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_high_botanist_freywinn.cpp index 2e48e5147a3..e3868d56115 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_high_botanist_freywinn.cpp @@ -13,68 +13,54 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_High_Botanist_Freywinn SD%Complete: 90 SDComment: some strange visual related to tree form(if aura lost before normal duration end). possible make summon&transform -process smoother(transform after delay) SDCategory: Tempest Keep, The Botanica EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1553000 #define SAY_KILL_1 -1553001 #define SAY_KILL_2 -1553002 #define SAY_TREE_1 -1553003 #define SAY_TREE_2 -1553004 #define SAY_DEATH -1553005 - #define SPELL_TRANQUILITY 34550 #define SPELL_TREE_FORM 34551 - #define SPELL_SUMMON_FRAYER 34557 #define ENTRY_FRAYER 19953 - #define SPELL_PLANT_WHITE 34759 #define SPELL_PLANT_GREEN 34761 #define SPELL_PLANT_BLUE 34762 #define SPELL_PLANT_RED 34763 - struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI { boss_high_botanist_freywinnAI(Creature *c) : ScriptedAI(c) {} - std::list Adds_List; - uint32 SummonSeedling_Timer; uint32 TreeForm_Timer; uint32 MoveCheck_Timer; uint32 DeadAddsCount; bool MoveFree; - void Reset() { Adds_List.clear(); - SummonSeedling_Timer = 6000; TreeForm_Timer = 30000; MoveCheck_Timer = 1000; DeadAddsCount = 0; MoveFree = true; } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void JustSummoned(Creature *summoned) { if (summoned->GetEntry() == ENTRY_FRAYER) Adds_List.push_back(summoned->GetGUID()); } - void DoSummonSeedling() { switch(rand()%4) @@ -85,48 +71,38 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI case 3: DoCast(m_creature,SPELL_PLANT_RED); break; } } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (TreeForm_Timer < diff) { DoScriptText(RAND(SAY_TREE_1,SAY_TREE_2), m_creature); - if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); - m_creature->RemoveAllAuras(); - DoCast(m_creature,SPELL_SUMMON_FRAYER,true); DoCast(m_creature,SPELL_TRANQUILITY,true); DoCast(m_creature,SPELL_TREE_FORM,true); - m_creature->GetMotionMaster()->MoveIdle(); MoveFree = false; - TreeForm_Timer = 75000; }else TreeForm_Timer -= diff; - if (!MoveFree) { if (MoveCheck_Timer < diff) { if (!Adds_List.empty()) { - for(std::list::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr) + for (std::list::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr) { if (Unit *temp = Unit::GetUnit(*m_creature,*itr)) { @@ -139,15 +115,12 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI } } } - if (DeadAddsCount < 3 && TreeForm_Timer-30000 < diff) DeadAddsCount = 3; - if (DeadAddsCount >= 3) { Adds_List.clear(); DeadAddsCount = 0; - m_creature->InterruptNonMeleeSpells(true); m_creature->RemoveAllAuras(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); @@ -156,33 +129,26 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI MoveCheck_Timer = 500; } else MoveCheck_Timer -= diff; - return; } - /*if (m_creature->HasAura(SPELL_TREE_FORM,0) || m_creature->HasAura(SPELL_TRANQUILITY,0)) return;*/ - //one random seedling every 5 secs, but not in tree form if (SummonSeedling_Timer < diff) { DoSummonSeedling(); SummonSeedling_Timer = 6000; }else SummonSeedling_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_high_botanist_freywinn(Creature* pCreature) { return new boss_high_botanist_freywinnAI (pCreature); } - void AddSC_boss_high_botanist_freywinn() { Script *newscript; - newscript = new Script; newscript->Name = "boss_high_botanist_freywinn"; newscript->GetAI = &GetAI_boss_high_botanist_freywinn; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_laj.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_laj.cpp index 58ff64a9493..1788cf749a4 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_laj.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_laj.cpp @@ -13,21 +13,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Laj SD%Complete: 90 SDComment: Immunities are wrong, must be adjusted to use resistance from creature_templates. Most spells require database support. SDCategory: Tempest Keep, The Botanica EndScriptData */ - #include "precompiled.h" - #define EMOTE_SUMMON -1553006 - #define SPELL_ALLERGIC_REACTION 34697 #define SPELL_TELEPORT_SELF 34673 - #define SPELL_SUMMON_LASHER_1 34681 #define SPELL_SUMMON_FLAYER_1 34682 #define SPELL_SUMMON_LASHER_2 34684 @@ -36,23 +31,19 @@ EndScriptData */ #define SPELL_SUMMON_FLAYER_4 34687 #define SPELL_SUMMON_LASHER_4 34688 #define SPELL_SUMMON_FLAYER_3 34690 - #define MODEL_DEFAULT 13109 #define MODEL_ARCANE 14213 #define MODEL_FIRE 13110 #define MODEL_FROST 14112 #define MODEL_NATURE 14214 - struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI { boss_lajAI(Creature *c) : ScriptedAI(c) {} - bool CanSummon; uint32 Teleport_Timer; uint32 Summon_Timer; uint32 Transform_Timer; uint32 Allergic_Timer; - void Reset() { m_creature->SetDisplayId(MODEL_DEFAULT); @@ -61,14 +52,12 @@ struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, false); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); - CanSummon = false; Teleport_Timer = 20000; Summon_Timer = 2500; Transform_Timer = 30000; Allergic_Timer = 5000; } - void DoTransform() { switch(rand()%5) @@ -115,7 +104,6 @@ struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI break; } } - void DoSummons() { switch(rand()%4) @@ -139,22 +127,18 @@ struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI } CanSummon = false; } - void EnterCombat(Unit *who) { } - void JustSummoned(Creature *summon) { if (summon && m_creature->getVictim()) summon->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CanSummon) { if (Summon_Timer < diff) @@ -164,39 +148,32 @@ struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI Summon_Timer = 2500; }else Summon_Timer -= diff; } - if (Allergic_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ALLERGIC_REACTION); Allergic_Timer = 25000+rand()%15000; }else Allergic_Timer -= diff; - if (Teleport_Timer < diff) { DoCast(m_creature,SPELL_TELEPORT_SELF); Teleport_Timer = 30000+rand()%10000; CanSummon = true; }else Teleport_Timer -= diff; - if (Transform_Timer < diff) { DoTransform(); Transform_Timer = 25000+rand()%15000; }else Transform_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_laj(Creature* pCreature) { return new boss_lajAI (pCreature); } - void AddSC_boss_laj() { Script *newscript; - newscript = new Script; newscript->Name = "boss_laj"; newscript->GetAI = &GetAI_boss_laj; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp index e06b1b03a41..b50d15cd3a2 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp @@ -13,41 +13,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Warp_Splinter SD%Complete: 80 SDComment: Includes Sapling (need some better control with these). SDCategory: Tempest Keep, The Botanica EndScriptData */ - #include "precompiled.h" - /*##### # mob_treant (Sapling) #####*/ - #define SPELL_HEAL_FATHER 6262 - struct TRINITY_DLL_DECL mob_treantAI : public ScriptedAI { mob_treantAI (Creature *c) : ScriptedAI(c) { WarpGuid = 0; } - uint64 WarpGuid; uint32 check_Timer; - void Reset() { check_Timer = 0; } - void EnterCombat(Unit *who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -69,31 +59,24 @@ struct TRINITY_DLL_DECL mob_treantAI : public ScriptedAI }else check_Timer -= diff; return; } - if (m_creature->getVictim()->GetGUID() != WarpGuid) DoMeleeAttackIfReady(); } }; - /*##### # boss_warp_splinter #####*/ - #define SAY_AGGRO -1553007 #define SAY_SLAY_1 -1553008 #define SAY_SLAY_2 -1553009 #define SAY_SUMMON_1 -1553010 #define SAY_SUMMON_2 -1553011 #define SAY_DEATH -1553012 - #define WAR_STOMP 34716 #define SUMMON_TREANTS 34727 // DBC: 34727, 34731, 34733, 34734, 34736, 34739, 34741 (with Ancestral Life spell 34742) // won't work (guardian summon) #define ARCANE_VOLLEY (HeroicMode?39133:36705) - #define CREATURE_TREANT 19949 - #define TREANT_SPAWN_DIST 50 //50 yards from Warp Splinter's spawn point - float treant_pos[6][3] = { {24.301233, 427.221100, -27.060635}, @@ -103,7 +86,6 @@ float treant_pos[6][3] = {109.861877, 423.201630, -27.356019}, {106.780159, 355.582581, -27.593357} }; - struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI { boss_warp_splinterAI(Creature *c) : ScriptedAI(c) @@ -112,104 +94,84 @@ struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI Treant_Spawn_Pos_X = c->GetPositionX(); Treant_Spawn_Pos_Y = c->GetPositionY(); } - uint32 War_Stomp_Timer; uint32 Summon_Treants_Timer; uint32 Arcane_Volley_Timer; bool HeroicMode; - float Treant_Spawn_Pos_X; float Treant_Spawn_Pos_Y; - void Reset() { War_Stomp_Timer = 25000 + rand()%15000; Summon_Treants_Timer = 45000; Arcane_Volley_Timer = 8000 + rand()%12000; - m_creature->SetSpeed(MOVE_RUN, 0.7f, true); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); } - void SummonTreants() { - for(uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) { float angle = (M_PI / 3) * i; - float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle); float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle); float O = - m_creature->GetAngle(X,Y); - if (Creature *pTreant = m_creature->SummonCreature(CREATURE_TREANT,treant_pos[i][0],treant_pos[i][1],treant_pos[i][2],O,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,25000)) CAST_AI(mob_treantAI, pTreant->AI())->WarpGuid = m_creature->GetGUID(); } DoScriptText(RAND(SAY_SUMMON_1,SAY_SUMMON_2), m_creature); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Check for War Stomp if (War_Stomp_Timer < diff) { DoCast(m_creature->getVictim(),WAR_STOMP); War_Stomp_Timer = 25000 + rand()%15000; }else War_Stomp_Timer -= diff; - //Check for Arcane Volley if (Arcane_Volley_Timer < diff) { DoCast(m_creature->getVictim(),ARCANE_VOLLEY); Arcane_Volley_Timer = 20000 + rand()%15000; }else Arcane_Volley_Timer -= diff; - //Check for Summon Treants if (Summon_Treants_Timer < diff) { SummonTreants(); Summon_Treants_Timer = 45000; }else Summon_Treants_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_warp_splinter(Creature* pCreature) { return new boss_warp_splinterAI (pCreature); } - CreatureAI* GetAI_mob_treant(Creature* pCreature) { return new mob_treantAI (pCreature); } - void AddSC_boss_warp_splinter() { Script *newscript; - newscript = new Script; newscript->Name = "boss_warp_splinter"; newscript->GetAI = &GetAI_boss_warp_splinter; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_warp_splinter_treant"; newscript->GetAI = &GetAI_mob_treant; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_alar.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_alar.cpp index b96ca667835..13b572aa865 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_alar.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_alar.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: boss_alar SD%Complete: 95 SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ - #include "precompiled.h" #include "def_the_eye.h" - #define SPELL_FLAME_BUFFET 34121 // Flame Buffet - every 1,5 secs in phase 1 if there is no victim in melee range and after Dive Bomb in phase 2 with same conditions #define SPELL_FLAME_QUILLS 34229 // Randomly after changing position in phase after watching tonns of movies, set probability 20% #define SPELL_REBIRTH 34342 // Rebirth - beginning of second phase(after loose all health in phase 1) @@ -33,13 +30,10 @@ EndScriptData */ #define SPELL_DIVE_BOMB_VISUAL 35367 // Bosskillers says 30 sec cooldown, wowwiki says 30 sec colldown, DBM and BigWigs addons says ~47 sec #define SPELL_DIVE_BOMB 35181 // after watching tonns of movies, set cooldown to 40+rand()%5. #define SPELL_BERSERK 45078 // 10 minutes after phase 2 starts(id is wrong, but proper id is unknown) - #define CREATURE_EMBER_OF_ALAR 19551 // Al'ar summons one Ember of Al'ar every position change in phase 1 and two after Dive Bomb. Also in phase 2 when Ember of Al'ar dies, boss loose 3% health. #define SPELL_EMBER_BLAST 34133 // When Ember of Al'ar dies, it casts Ember Blast - #define CREATURE_FLAME_PATCH_ALAR 20602 // Flame Patch - every 30 sec in phase 2 #define SPELL_FLAME_PATCH 35380 // - static float waypoint[6][3] = { {340.15, 58.65, 17.71}, @@ -49,7 +43,6 @@ static float waypoint[6][3] = {332, 0.01, 39}, // better not use the same xy coord {331, 0.01, -2.39} }; - enum WaitEventType { WE_NONE = 0, @@ -64,7 +57,6 @@ enum WaitEventType WE_LAND = 9, WE_SUMMON = 10 }; - struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI { boss_alarAI(Creature *c) : ScriptedAI(c) @@ -72,46 +64,34 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI pInstance =c->GetInstanceData(); DefaultMoveSpeedRate = c->GetSpeedRate(MOVE_RUN); } - ScriptedInstance *pInstance; - WaitEventType WaitEvent; uint32 WaitTimer; - bool AfterMoving; - uint32 Platforms_Move_Timer; uint32 DiveBomb_Timer; uint32 MeltArmor_Timer; uint32 Charge_Timer; uint32 FlamePatch_Timer; uint32 Berserk_Timer; - float DefaultMoveSpeedRate; - bool Phase1; bool ForceMove; uint32 ForceTimer; - int8 cur_wp; - void Reset() { if (pInstance) pInstance->SetData(DATA_ALAREVENT, NOT_STARTED); - Berserk_Timer = 1200000; Platforms_Move_Timer = 0; - Phase1 = true; WaitEvent = WE_NONE; WaitTimer = 0; AfterMoving = false; ForceMove = false; ForceTimer = 5000; - cur_wp = 4; - m_creature->SetDisplayId(m_creature->GetNativeDisplayId()); m_creature->SetSpeed(MOVE_RUN, DefaultMoveSpeedRate); //m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); @@ -121,32 +101,26 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->setActive(false); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_ALAREVENT, IN_PROGRESS); - m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); // after enterevademode will be set walk movement DoZoneInCombat(); m_creature->setActive(true); } - void JustDied(Unit *victim) { if (pInstance) pInstance->SetData(DATA_ALAREVENT, DONE); } - void JustSummoned(Creature *summon) { if (summon->GetEntry() == CREATURE_EMBER_OF_ALAR) if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) summon->AI()->AttackStart(target); } - void MoveInLineOfSight(Unit *who) {} - void AttackStart(Unit* who) { if (Phase1) @@ -154,7 +128,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI else ScriptedAI::AttackStart(who); } - void DamageTaken(Unit* pKiller, uint32 &damage) { if (damage >= m_creature->GetHealth() && Phase1) @@ -176,7 +149,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI } } } - void SpellHit(Unit*, const SpellEntry *spell) { if (spell->Id == SPELL_DIVE_BOMB_VISUAL) @@ -186,7 +158,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI //m_creature->SendUpdateObjectToAllExcept(NULL); } } - void MovementInform(uint32 type, uint32 id) { if (type == POINT_MOTION_TYPE) @@ -196,18 +167,15 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI ForceMove = false; } } - void UpdateAI(const uint32 diff) { if (!m_creature->isInCombat()) // sometimes isincombat but !incombat, faction bug? return; - if (Berserk_Timer < diff) { m_creature->CastSpell(m_creature, SPELL_BERSERK, true); Berserk_Timer = 60000; }else Berserk_Timer -= diff; - if (ForceMove) { if (ForceTimer < diff) @@ -215,7 +183,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI m_creature->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); ForceTimer = 5000; }else ForceTimer -= diff; - } if (WaitEvent) { @@ -228,7 +195,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); AfterMoving = false; } - switch(WaitEvent) { case WE_PLATFORM: @@ -288,7 +254,7 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI WaitTimer = 2000; return; case WE_SUMMON: - for(uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < 2; ++i) DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -299,14 +265,12 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI default: break; } - WaitEvent = WE_NONE; WaitTimer = 0; }else WaitTimer -= diff; } return; } - if (Phase1) { if (m_creature->getThreatManager().getThreatList().empty()) @@ -314,7 +278,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI EnterEvadeMode(); return; } - if (Platforms_Move_Timer < diff) { if (cur_wp == 4) @@ -355,13 +318,11 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI DoCast(target, SPELL_CHARGE); Charge_Timer = 30000; }else Charge_Timer -= diff; - if (MeltArmor_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MELT_ARMOR); MeltArmor_Timer = 60000; }else MeltArmor_Timer -= diff; - if (DiveBomb_Timer < diff) { m_creature->AttackStop(); @@ -373,7 +334,6 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI DiveBomb_Timer = 40000+rand()%5000; return; }else DiveBomb_Timer -= diff; - if (FlamePatch_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) @@ -392,10 +352,8 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI FlamePatch_Timer = 30000; }else FlamePatch_Timer -= diff; } - DoMeleeAttackIfReady(); } - void DoMeleeAttackIfReady() { if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) @@ -420,12 +378,10 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI } } }; - CreatureAI* GetAI_boss_alar(Creature* pCreature) { return new boss_alarAI(pCreature); } - struct TRINITY_DLL_DECL mob_ember_of_alarAI : public ScriptedAI { mob_ember_of_alarAI(Creature *c) : ScriptedAI(c) @@ -434,14 +390,11 @@ struct TRINITY_DLL_DECL mob_ember_of_alarAI : public ScriptedAI c->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); c->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } - ScriptedInstance *pInstance; bool toDie; - void Reset() {toDie = false;} void EnterCombat(Unit *who) {DoZoneInCombat();} void EnterEvadeMode() {m_creature->setDeathState(JUST_DIED);} - void DamageTaken(Unit* pKiller, uint32 &damage) { if (damage >= m_creature->GetHealth() && pKiller != m_creature && !toDie) @@ -464,28 +417,22 @@ struct TRINITY_DLL_DECL mob_ember_of_alarAI : public ScriptedAI toDie = true; } } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (toDie) { m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); //m_creature->SetVisibility(VISIBILITY_OFF); } - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI_mob_ember_of_alar(Creature* pCreature) { return new mob_ember_of_alarAI(pCreature); } - struct TRINITY_DLL_DECL mob_flame_patch_alarAI : public ScriptedAI { mob_flame_patch_alarAI(Creature *c) : ScriptedAI(c) {} @@ -495,26 +442,21 @@ struct TRINITY_DLL_DECL mob_flame_patch_alarAI : public ScriptedAI void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) {} }; - CreatureAI* GetAI_mob_flame_patch_alar(Creature* pCreature) { return new mob_flame_patch_alarAI(pCreature); } - void AddSC_boss_alar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_alar"; newscript->GetAI = &GetAI_boss_alar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ember_of_alar"; newscript->GetAI = &GetAI_mob_ember_of_alar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_flame_patch_alar"; newscript->GetAI = &GetAI_mob_flame_patch_alar; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp index 7cf9f3b1c62..e8ba7e3a197 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Astromancer SD%Complete: 80 SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ - #include "precompiled.h" #include "def_the_eye.h" - enum eEnums { SAY_AGGRO = -1550007, @@ -35,29 +32,22 @@ enum eEnums SAY_DEATH = -1550013, SAY_VOIDA = -1550014, SAY_VOIDB = -1550015, - SPELL_ARCANE_MISSILES = 33031, SPELL_WRATH_OF_THE_ASTROMANCER = 42783, SPELL_BLINDING_LIGHT = 33009, SPELL_FEAR = 34322, SPELL_VOID_BOLT = 39329, - SPELL_SPOTLIGHT = 25824, NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT = 18928, - NPC_SOLARIUM_AGENT = 18925, NPC_SOLARIUM_PRIEST = 18806, - MODEL_HUMAN = 18239, MODEL_VOIDWALKER = 18988, - SPELL_SOLARIUM_GREAT_HEAL = 33387, SPELL_SOLARIUM_HOLY_SMITE = 25054, SPELL_SOLARIUM_ARCANE_TORRENT = 33390, - WV_ARMOR = 31000 }; - const float CENTER_X = 432.909f; const float CENTER_Y = -373.424f; const float CENTER_Z = 17.9608f; @@ -65,25 +55,19 @@ const float CENTER_O = 1.06421f; const float SMALL_PORTAL_RADIUS = 12.6f; const float LARGE_PORTAL_RADIUS = 26.0f; const float PORTAL_Z = 17.005f; - // x, y, z, o static float SolarianPos[4] = {432.909, -373.424, 17.9608, 1.06421}; - struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI { boss_high_astromancer_solarianAI(Creature *c) : ScriptedAI(c), Summons(m_creature) { pInstance = c->GetInstanceData(); - defaultarmor = c->GetArmor(); defaultsize = c->GetFloatValue(OBJECT_FIELD_SCALE_X); } - ScriptedInstance *pInstance; SummonList Summons; - uint8 Phase; - uint32 ArcaneMissiles_Timer; uint32 m_uiWrathOfTheAstromancer_Timer; uint32 BlindingLight_Timer; @@ -95,13 +79,10 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI uint32 AppearDelay_Timer; uint32 defaultarmor; uint32 Wrath_Timer; - float defaultsize; float Portals[3][3]; - bool AppearDelay; bool BlindingLight; - void Reset() { ArcaneMissiles_Timer = 2000; @@ -118,43 +99,34 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI Wrath_Timer = 20000+rand()%5000;//twice in phase one Phase = 1; Wrath_Timer = 20000+rand()%5000;//twice in phase one - if (pInstance) pInstance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, NOT_STARTED); - m_creature->SetArmor(defaultarmor); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); m_creature->SetDisplayId(MODEL_HUMAN); - Summons.DespawnAll(); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_KILL1,SAY_KILL2,SAY_KILL3), m_creature); } - void JustDied(Unit *victim) { m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); m_creature->SetDisplayId(MODEL_HUMAN); DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, DONE); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); - if (pInstance) pInstance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, IN_PROGRESS); } - void SummonMinion(uint32 entry, float x, float y, float z) { Creature* Summoned = m_creature->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); @@ -162,23 +134,18 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) Summoned->AI()->AttackStart(target); - Summons.Summon(Summoned); } } - float Portal_X(float radius) { if ((rand()%2)==1) radius = -radius; - return (radius * (float)(rand()%100)/100.0f + CENTER_X); } - float Portal_Y(float x, float radius) { float z = 0.0f; - switch(rand()%2) { case 0: z = 1; break; @@ -186,12 +153,10 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI } return (z*sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (AppearDelay) { m_creature->StopMoving(); @@ -207,43 +172,38 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI AppearDelay_Timer = 2000; }else AppearDelay_Timer -= diff; } - if (Phase == 1) { if (BlindingLight_Timer < diff){ BlindingLight = true; BlindingLight_Timer = 45000; }else BlindingLight_Timer -= diff; - if (Wrath_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_WRATH_OF_THE_ASTROMANCER, true); Wrath_Timer = 20000+rand()%5000; }else Wrath_Timer -= diff; - if (ArcaneMissiles_Timer < diff) { if (BlindingLight) { DoCast(m_creature->getVictim(), SPELL_BLINDING_LIGHT); BlindingLight = false; - }else{ + } + else + { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!m_creature->HasInArc(2.5f, target)) target = m_creature->getVictim(); - if (target) DoCast(target, SPELL_ARCANE_MISSILES); } ArcaneMissiles_Timer = 3000; }else ArcaneMissiles_Timer -= diff; - if (m_uiWrathOfTheAstromancer_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); - //Target the tank ? if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) if (pTarget->GetTypeId() == TYPEID_PLAYER) @@ -254,7 +214,6 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI else m_uiWrathOfTheAstromancer_Timer = 1000; }else m_uiWrathOfTheAstromancer_Timer -= diff; - //Phase1_Timer if (Phase1_Timer < diff) { @@ -263,7 +222,7 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. m_creature->GetMotionMaster()->Clear(); m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); - for(uint8 i=0; i<=2; ++i) + for (uint8 i=0; i<=2; ++i) { if (!i) { @@ -308,7 +267,6 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI for (int i=0; i<=2; ++i) for (int j=1; j<=4; j++) SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]); - DoScriptText(SAY_SUMMON1, m_creature); Phase2_Timer = 10000; } else Phase2_Timer -= diff; @@ -317,24 +275,19 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI { m_creature->AttackStop(); m_creature->StopMoving(); - //Check Phase3_Timer if (Phase3_Timer < diff) { Phase = 1; - //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. int i = rand()%3; m_creature->GetMotionMaster()->Clear(); m_creature->GetMap()->CreatureRelocation(m_creature, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); - for (int j=0; j<=2; j++) if (j!=i) SummonMinion(NPC_SOLARIUM_PRIEST, Portals[j][0], Portals[j][1], Portals[j][2]); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); - DoScriptText(SAY_SUMMON2, m_creature); AppearDelay = true; Phase3_Timer = 15000; @@ -348,7 +301,6 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI DoCast(m_creature, SPELL_FEAR); Fear_Timer = 20000; }else Fear_Timer -= diff; - //VoidBolt_Timer if (VoidBolt_Timer < diff) { @@ -356,12 +308,10 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI VoidBolt_Timer = 10000; }else VoidBolt_Timer -= diff; } - //When Solarian reaches 20% she will transform into a huge void walker. if (Phase != 4 && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth())<20)) { Phase = 4; - //To make sure she wont be invisible or not selecatble m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); @@ -371,44 +321,35 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI m_creature->SetDisplayId(MODEL_VOIDWALKER); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f); } - DoMeleeAttackIfReady(); } }; - struct TRINITY_DLL_DECL mob_solarium_priestAI : public ScriptedAI { mob_solarium_priestAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; - uint32 healTimer; uint32 holysmiteTimer; uint32 aoesilenceTimer; - void Reset() { healTimer = 9000; holysmiteTimer = 1; aoesilenceTimer = 15000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (healTimer < diff) { Unit* target = NULL; - switch(rand()%2) { case 0: @@ -419,40 +360,33 @@ struct TRINITY_DLL_DECL mob_solarium_priestAI : public ScriptedAI target = m_creature; break; } - if (target) { DoCast(target,SPELL_SOLARIUM_GREAT_HEAL); healTimer = 9000; } } else healTimer -= diff; - if (holysmiteTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SOLARIUM_HOLY_SMITE); holysmiteTimer = 4000; } else holysmiteTimer -= diff; - if (aoesilenceTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SOLARIUM_ARCANE_TORRENT); aoesilenceTimer = 13000; } else aoesilenceTimer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_solarium_priest(Creature* pCreature) { return new mob_solarium_priestAI (pCreature); } - CreatureAI* GetAI_boss_high_astromancer_solarian(Creature* pCreature) { return new boss_high_astromancer_solarianAI (pCreature); } - void AddSC_boss_high_astromancer_solarian() { Script *newscript; @@ -460,7 +394,6 @@ void AddSC_boss_high_astromancer_solarian() newscript->Name = "boss_high_astromancer_solarian"; newscript->GetAI = &GetAI_boss_high_astromancer_solarian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_solarium_priest"; newscript->GetAI = &GetAI_mob_solarium_priest; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp index 2341f78ebe3..b5a950e8dee 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp @@ -13,18 +13,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Kaelthas SD%Complete: 60 SDComment: SQL, weapon scripts, mind control, need correct spells(interruptible/uninterruptible), phoenix spawn location & animation, phoenix behaviour & spawn during gravity lapse SDCategory: Tempest Keep, The Eye EndScriptData */ - #include "precompiled.h" #include "def_the_eye.h" #include "WorldPacket.h" - enum eEnums { //kael'thas Speech @@ -47,24 +44,19 @@ enum eEnums SAY_SUMMON_PHOENIX1 = -1550032, SAY_SUMMON_PHOENIX2 = -1550033, SAY_DEATH = -1550034, - //Thaladred the Darkener speech SAY_THALADRED_AGGRO = -1550035, SAY_THALADRED_DEATH = -1550036, EMOTE_THALADRED_GAZE = -1550037, - //Lord Sanguinar speech SAY_SANGUINAR_AGGRO = -1550038, SAY_SANGUINAR_DEATH = -1550039, - //Grand Astromancer Capernian speech SAY_CAPERNIAN_AGGRO = -1550040, SAY_CAPERNIAN_DEATH = -1550041, - //Master Engineer Telonicus speech SAY_TELONICUS_AGGRO = -1550042, SAY_TELONICUS_DEATH = -1550043, - //Phase 2 spells SPELL_SUMMON_WEAPONS = 36976, SPELL_SUMMON_WEAPONA = 36958, @@ -75,7 +67,6 @@ enum eEnums SPELL_SUMMON_WEAPONF = 36963, SPELL_SUMMON_WEAPONG = 36964, SPELL_RES_VISUAL = 24171, - //Phase 4 spells SPELL_FIREBALL = 22088, //wrong but works with CastCustomSpell SPELL_PYROBLAST = 36819, @@ -86,7 +77,6 @@ enum eEnums SPELL_SHOCK_BARRIER = 36815, SPELL_PHOENIX_ANIMATION = 36723, SPELL_MIND_CONTROL = 32830, - //Phase 5 spells SPELL_EXPLODE = 36092, SPELL_FULLPOWER = 36187, @@ -94,14 +84,12 @@ enum eEnums SPELL_GRAVITY_LAPSE = 34480, SPELL_GRAVITY_LAPSE_AURA = 39432, SPELL_NETHER_BEAM = 35873, - //Thaladred the Darkener spells SPELL_PSYCHIC_BLOW = 10689, SPELL_SILENCE = 30225, //Lord Sanguinar spells SPELL_BELLOWING_ROAR = 40636, //Grand Astromancer Capernian spells - SPELL_CAPERNIAN_FIREBALL = 36971, SPELL_CONFLAGRATION = 37018, SPELL_ARCANE_EXPLOSION = 36970, @@ -114,32 +102,24 @@ enum eEnums SPELL_BURN = 36720, SPELL_EMBER_BLAST = 34341, SPELL_REBIRTH = 41587, - //Creature IDs NPC_PHOENIX = 21362, NPC_PHOENIX_EGG = 21364, - //Phoenix egg and phoenix model MODEL_ID_PHOENIX = 19682, MODEL_ID_PHOENIX_EGG = 20245, - MAX_ADVISORS = 4 }; - uint32 m_auiSpellSummonWeapon[]= { SPELL_SUMMON_WEAPONA, SPELL_SUMMON_WEAPONB, SPELL_SUMMON_WEAPONC, SPELL_SUMMON_WEAPOND, SPELL_SUMMON_WEAPONE, SPELL_SUMMON_WEAPONF, SPELL_SUMMON_WEAPONG }; - const float CAPERNIAN_DISTANCE = 20.0f; //she casts away from the target const float KAEL_VISIBLE_RANGE = 50.0f; - const float afGravityPos[3] = {795.0f, 0.0f, 70.0f}; - #define TIME_PHASE_2_3 120000 #define TIME_PHASE_3_4 180000 - //Base AI for Advisors struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI { @@ -148,13 +128,11 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); m_bDoubled_Health = false; } - ScriptedInstance* m_pInstance; bool FakeDeath; bool m_bDoubled_Health; uint32 DelayRes_Timer; uint64 DelayRes_Target; - void Reset() { if (m_bDoubled_Health) @@ -162,37 +140,29 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI m_creature->SetMaxHealth(m_creature->GetMaxHealth() / 2); m_bDoubled_Health = false; } - FakeDeath = false; DelayRes_Timer = 0; DelayRes_Target = 0; - m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //reset encounter if (m_pInstance && (m_pInstance->GetData(DATA_KAELTHASEVENT) == 1 || m_pInstance->GetData(DATA_KAELTHASEVENT) == 3)) if (Creature *Kaelthas = Unit::GetCreature((*m_creature), m_pInstance->GetData64(DATA_KAELTHAS))) Kaelthas->AI()->EnterEvadeMode(); } - void MoveInLineOfSight(Unit *who) { if (!who || FakeDeath || m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::MoveInLineOfSight(who); } - void AttackStart(Unit* who) { if (!who || FakeDeath || m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - ScriptedAI::AttackStart(who); } - void Revive(Unit* Target) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -201,30 +171,25 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI m_bDoubled_Health = true; m_creature->SetHealth(m_creature->GetMaxHealth()); m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(m_creature, SPELL_RES_VISUAL, false); DelayRes_Timer = 2000; } - void DamageTaken(Unit* pKiller, uint32 &damage) { if (damage < m_creature->GetHealth()) return; - //Prevent glitch if in fake death if (FakeDeath && m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) != 0) { damage = 0; return; } - //Don't really die in phase 1 & 3, only die after that if (m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) != 0) { //prevent death damage = 0; FakeDeath = true; - m_creature->InterruptNonMeleeSpells(false); m_creature->SetHealth(0); m_creature->StopMoving(); @@ -241,7 +206,6 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI JustDied(pKiller); } } - void UpdateAI(const uint32 diff) { if (DelayRes_Timer) @@ -250,11 +214,9 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI { DelayRes_Timer = 0; FakeDeath = false; - Unit* Target = Unit::GetUnit((*m_creature), DelayRes_Target); if (!Target) Target = m_creature->getVictim(); - DoResetThreat(); AttackStart(Target); m_creature->GetMotionMaster()->Clear(); @@ -263,9 +225,7 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI } else DelayRes_Timer -= diff; } } - }; - //Kael'thas AI struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { @@ -274,9 +234,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI m_pInstance = pCreature->GetInstanceData(); memset(&m_auiAdvisorGuid, 0, sizeof(m_auiAdvisorGuid)); } - ScriptedInstance* m_pInstance; - uint32 Fireball_Timer; uint32 ArcaneDisruption_Timer; uint32 Phoenix_Timer; @@ -291,15 +249,11 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI uint32 PhaseSubphase; //generic uint32 Phase_Timer; //generic timer uint32 PyrosCasted; - bool InGravityLapse; bool IsCastingFireball; bool ChainPyros; - SummonList summons; - uint64 m_auiAdvisorGuid[MAX_ADVISORS]; - void Reset() { Fireball_Timer = 5000+rand()%10000; @@ -317,22 +271,17 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI InGravityLapse = false; IsCastingFireball = false; ChainPyros = false; - if (m_creature->isInCombat()) PrepareAdvisors(); - summons.DespawnAll(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (m_pInstance) m_pInstance->SetData(DATA_KAELTHASEVENT, 0); } - void PrepareAdvisors() { - for(uint8 i = 0; i < MAX_ADVISORS; ++i) + for (uint8 i = 0; i < MAX_ADVISORS; ++i) { if (Creature *pCreature = Unit::GetCreature((*m_creature), m_auiAdvisorGuid[i])) { @@ -343,49 +292,36 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI } } } - void StartEvent() { if (!m_pInstance) return; - m_auiAdvisorGuid[0] = m_pInstance->GetData64(DATA_THALADREDTHEDARKENER); m_auiAdvisorGuid[1] = m_pInstance->GetData64(DATA_LORDSANGUINAR); m_auiAdvisorGuid[2] = m_pInstance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); m_auiAdvisorGuid[3] = m_pInstance->GetData64(DATA_MASTERENGINEERTELONICUS); - if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { error_log("TSCR: Kael'Thas One or more advisors missing, Skipping Phases 1-3"); - DoScriptText(SAY_PHASE4_INTRO2, m_creature); - Phase = 4; - m_pInstance->SetData(DATA_KAELTHASEVENT, 4); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) AttackStart(target); - } else { PrepareAdvisors(); - DoScriptText(SAY_INTRO, m_creature); - m_pInstance->SetData(DATA_KAELTHASEVENT, 1); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - PhaseSubphase = 0; Phase_Timer = 23000; Phase = 1; } } - void MoveInLineOfSight(Unit *who) { if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() && @@ -393,7 +329,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) { @@ -406,25 +341,21 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { if (m_pInstance && !m_pInstance->GetData(DATA_KAELTHASEVENT) && !Phase) StartEvent(); - who->SetInCombatWith(m_creature); m_creature->AddThreat(who, 0.0f); } } } } - void Aggro(Unit *who) { if (m_pInstance && !m_pInstance->GetData(DATA_KAELTHASEVENT) && !Phase) StartEvent(); } - void KilledUnit() { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustSummoned(Creature* pSummoned) { // if not phoenix, then it's one of the 7 weapons @@ -432,32 +363,24 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); - summons.Summon(pSummoned); } } - void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - void JustDied(Unit* Killer) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_DEATH, m_creature); - summons.DespawnAll(); - if (m_pInstance) m_pInstance->SetData(DATA_KAELTHASEVENT, 0); - - for(uint8 i = 0; i < MAX_ADVISORS; ++i) + for (uint8 i = 0; i < MAX_ADVISORS; ++i) { if (Unit* pAdvisor = Unit::GetUnit((*m_creature), m_auiAdvisorGuid[i])) pAdvisor->Kill(pAdvisor); } } - void UpdateAI(const uint32 diff) { //Phase 1 @@ -467,7 +390,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { Unit *target = NULL; Creature* Advisor = NULL; - //Subphase switch switch(PhaseSubphase) { @@ -476,148 +398,118 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (Phase_Timer < diff) { DoScriptText(SAY_INTRO_THALADRED, m_creature); - //start advisor within 7 seconds Phase_Timer = 7000; ++PhaseSubphase; } else Phase_Timer -= diff; break; - //Subphase 1 - Unlock advisor case 1: if (Phase_Timer < diff) { Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[0])); - if (Advisor) { Advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Advisor->setFaction(m_creature->getFaction()); - target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) Advisor->AI()->AttackStart(target); } - ++PhaseSubphase; } else Phase_Timer -= diff; break; - //Subphase 2 - Start case 2: Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[0])); - if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { DoScriptText(SAY_INTRO_SANGUINAR, m_creature); - //start advisor within 12.5 seconds Phase_Timer = 12500; ++PhaseSubphase; } break; - //Subphase 2 - Unlock advisor case 3: if (Phase_Timer < diff) { Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[1])); - if (Advisor) { Advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Advisor->setFaction(m_creature->getFaction()); - target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) Advisor->AI()->AttackStart(target); } - ++PhaseSubphase; } else Phase_Timer -= diff; break; - //Subphase 3 - Start case 4: Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[1])); - if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { DoScriptText(SAY_INTRO_CAPERNIAN, m_creature); - //start advisor within 7 seconds Phase_Timer = 7000; ++PhaseSubphase; } break; - //Subphase 3 - Unlock advisor case 5: if (Phase_Timer < diff) { Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[2])); - if (Advisor) { Advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Advisor->setFaction(m_creature->getFaction()); - target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) Advisor->AI()->AttackStart(target); } - ++PhaseSubphase; } else Phase_Timer -= diff; break; - //Subphase 4 - Start case 6: Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[2])); - if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { DoScriptText(SAY_INTRO_TELONICUS, m_creature); - //start advisor within 8.4 seconds Phase_Timer = 8400; ++PhaseSubphase; } break; - //Subphase 4 - Unlock advisor case 7: if (Phase_Timer < diff) { Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[3])); - if (Advisor) { Advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Advisor->setFaction(m_creature->getFaction()); - target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (target) Advisor->AI()->AttackStart(target); } - Phase_Timer = 3000; ++PhaseSubphase; } else Phase_Timer -= diff; break; - //End of phase 1 case 8: Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[3])); - if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { Phase = 2; if(m_pInstance) m_pInstance->SetData(DATA_KAELTHASEVENT, 2); - DoScriptText(SAY_PHASE2_WEAPON, m_creature); - PhaseSubphase = 0; Phase_Timer = 3500; DoCast(m_creature, SPELL_SUMMON_WEAPONS); @@ -625,7 +517,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI break; } }break; - case 2: { if (PhaseSubphase == 0) @@ -635,21 +526,16 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI PhaseSubphase = 1; }else Phase_Timer -= diff; } - //Spawn weapons if (PhaseSubphase == 1) { m_creature->CastSpell(m_creature, SPELL_SUMMON_WEAPONS, false); - uint8 uiMaxWeapon = sizeof(m_auiSpellSummonWeapon)/sizeof(uint32); - for (uint32 i = 0; i < uiMaxWeapon; ++i) m_creature->CastSpell(m_creature,m_auiSpellSummonWeapon[i],true); - PhaseSubphase = 2; Phase_Timer = TIME_PHASE_2_3; } - if (PhaseSubphase == 2) { if (Phase_Timer < diff) @@ -662,51 +548,40 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI }else Phase_Timer -= diff; } }break; - case 3: { if (PhaseSubphase == 0) { //Respawn advisors Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); - Creature* Advisor; for (uint32 i = 0; i < MAX_ADVISORS; ++i) { Advisor = (Unit::GetCreature((*m_creature), m_auiAdvisorGuid[i])); - if (!Advisor) error_log("SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); else CAST_AI(advisorbase_ai, Advisor->AI())->Revive(Target); } - PhaseSubphase = 1; Phase_Timer = TIME_PHASE_3_4; } - if (Phase_Timer < diff) { DoScriptText(SAY_PHASE4_INTRO2, m_creature); Phase = 4; - if(m_pInstance) m_pInstance->SetData(DATA_KAELTHASEVENT, 4); - // Sometimes people can collect Aggro in Phase 1-3. Reset threat before releasing Kael. DoResetThreat(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) AttackStart(target); - Phase_Timer = 30000; } else Phase_Timer -= diff; } break; - case 4: case 5: case 6: @@ -714,7 +589,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //Return since we have no target if (!UpdateVictim()) return; - //Fireball_Timer if (!InGravityLapse && !ChainPyros && Phase != 5) { @@ -740,22 +614,18 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Fireball_Timer = 5000+rand()%10000; } } else Fireball_Timer -= diff; - //ArcaneDisruption_Timer if (ArcaneDisruption_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_DISRUPTION, true); ArcaneDisruption_Timer = 60000; } else ArcaneDisruption_Timer -= diff; - if (FlameStrike_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_FLAME_STRIKE); - FlameStrike_Timer = 30000; } else FlameStrike_Timer -= diff; - if (MindControl_Timer < diff) { if (m_creature->getThreatManager().getThreatList().size() >= 2) @@ -764,20 +634,16 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI debug_log("SD2: Kael'Thas mind control not supported."); //DoCast(pUnit, SPELL_MIND_CONTROL); } - MindControl_Timer = 60000; } else MindControl_Timer -= diff; } - //Phoenix_Timer if (Phoenix_Timer < diff) { DoCast(m_creature, SPELL_PHOENIX_ANIMATION); DoScriptText(RAND(SAY_SUMMON_PHOENIX1,SAY_SUMMON_PHOENIX2), m_creature); - Phoenix_Timer = 60000; } else Phoenix_Timer -= diff; - //Phase 4 specific spells if (Phase == 4) { @@ -787,20 +653,16 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI m_pInstance->SetData(DATA_KAELTHASEVENT, 4); Phase = 5; Phase_Timer = 10000; - DoScriptText(SAY_PHASE5_NUTS, m_creature); - m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, afGravityPos[0], afGravityPos[1], afGravityPos[2], 0); m_creature->SendMonsterMove(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0, 0, 0); - m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_FULLPOWER); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - //ShockBarrier_Timer if (ShockBarrier_Timer < diff) { @@ -809,7 +671,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI PyrosCasted = 0; ShockBarrier_Timer = 60000; }else ShockBarrier_Timer -= diff; - //Chain Pyros (3 of them max) if (ChainPyros && !m_creature->IsNonMeleeSpellCasted(false)) { @@ -826,26 +687,21 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI } } } - if (Phase == 5) { if (Phase_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); m_creature->RemoveAurasDueToSpell(SPELL_FULLPOWER); - DoCast(m_creature, SPELL_EXPLODE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Phase = 6; AttackStart(m_creature->getVictim()); } else Phase_Timer -= diff; } - //Phase 5 if (Phase == 6) { - //GravityLapse_Timer if (GravityLapse_Timer < diff) { @@ -858,7 +714,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, afGravityPos[0], afGravityPos[1], afGravityPos[2], 0); m_creature->SendMonsterMove(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0, MOVEMENTFLAG_NONE, 0); - // 1) Kael'thas will portal the whole raid right into his body for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) { @@ -869,17 +724,14 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoTeleportPlayer(pUnit, afGravityPos[0], afGravityPos[1], afGravityPos[2], pUnit->GetOrientation()); } } - GravityLapse_Timer = 500; ++GravityLapse_Phase; InGravityLapse = true; ShockBarrier_Timer = 1000; NetherBeam_Timer = 5000; break; - case 1: DoScriptText(RAND(SAY_GRAVITYLAPSE1,SAY_GRAVITYLAPSE2), m_creature); - // 2) At that point he will put a Gravity Lapse debuff on everyone for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i) { @@ -887,10 +739,8 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { m_creature->CastSpell(pUnit, SPELL_KNOCKBACK, true); //Gravity lapse - needs an exception in Spell system to work - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE, true, 0, 0, m_creature->GetGUID()); pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, m_creature->GetGUID()); - //Using packet workaround WorldPacket data(12); data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); @@ -902,16 +752,13 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI GravityLapse_Timer = 10000; ++GravityLapse_Phase; break; - case 2: //Cast nether vapor aura on self m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_NETHER_VAPOR); - GravityLapse_Timer = 20000; ++GravityLapse_Phase; break; - case 3: //Remove flight for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) @@ -926,7 +773,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI pUnit->SendMessageToSet(&data, true); } } - m_creature->RemoveAurasDueToSpell(SPELL_NETHER_VAPOR); InGravityLapse = false; GravityLapse_Timer = 60000; @@ -935,7 +781,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI break; } }else GravityLapse_Timer -= diff; - if (InGravityLapse) { //ShockBarrier_Timer @@ -944,73 +789,58 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_SHOCK_BARRIER); ShockBarrier_Timer = 20000; } else ShockBarrier_Timer -= diff; - //NetherBeam_Timer if (NetherBeam_Timer < diff) { if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pUnit, SPELL_NETHER_BEAM); - NetherBeam_Timer = 4000; } else NetherBeam_Timer -= diff; } } - if (!InGravityLapse) DoMeleeAttackIfReady(); } } } }; - //Thaladred the Darkener AI struct TRINITY_DLL_DECL boss_thaladred_the_darkenerAI : public advisorbase_ai { boss_thaladred_the_darkenerAI(Creature* pCreature) : advisorbase_ai(pCreature) {} - uint32 Gaze_Timer; uint32 Silence_Timer; uint32 PsychicBlow_Timer; - void Reset() { Gaze_Timer = 100; Silence_Timer = 20000; PsychicBlow_Timer = 10000; - advisorbase_ai::Reset(); } - void Aggro(Unit *who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (!who || FakeDeath) return; - DoScriptText(SAY_THALADRED_AGGRO, m_creature); m_creature->AddThreat(who, 5000000.0f); } - void JustDied(Unit* pKiller) { if (m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_THALADRED_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { advisorbase_ai::UpdateAI(diff); - //Faking death, don't do anything if (FakeDeath) return; - //Return since we have no target if (!UpdateVictim()) return; - //Gaze_Timer if (Gaze_Timer < diff) { @@ -1022,89 +852,71 @@ struct TRINITY_DLL_DECL boss_thaladred_the_darkenerAI : public advisorbase_ai Gaze_Timer = 8500; } } else Gaze_Timer -= diff; - //Silence_Timer if (Silence_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SILENCE); Silence_Timer = 20000; } else Silence_Timer -= diff; - //PsychicBlow_Timer if (PsychicBlow_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_PSYCHIC_BLOW); PsychicBlow_Timer = 20000+rand()%5000; } else PsychicBlow_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Lord Sanguinar AI struct TRINITY_DLL_DECL boss_lord_sanguinarAI : public advisorbase_ai { boss_lord_sanguinarAI(Creature* pCreature) : advisorbase_ai(pCreature) {} - uint32 Fear_Timer; - void Reset() { Fear_Timer = 20000; advisorbase_ai::Reset(); } - void Aggro(Unit *who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (!who || FakeDeath) return; - DoScriptText(SAY_SANGUINAR_AGGRO, m_creature); } - void JustDied(Unit* Killer) { if (m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_SANGUINAR_DEATH, m_creature); } - void UpdateAI(const uint32 diff) { advisorbase_ai::UpdateAI(diff); - //Faking death, don't do anything if (FakeDeath) return; - //Return since we have no target if (!UpdateVictim()) return; - //Fear_Timer if (Fear_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_BELLOWING_ROAR); Fear_Timer = 25000+rand()%10000; //approximately every 30 seconds } else Fear_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Grand Astromancer Capernian AI struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_ai { boss_grand_astromancer_capernianAI(Creature* pCreature) : advisorbase_ai(pCreature) {} - uint32 Fireball_Timer; uint32 Conflagration_Timer; uint32 ArcaneExplosion_Timer; uint32 Yell_Timer; bool Yell; - void Reset() { Fireball_Timer = 2000; @@ -1112,52 +924,41 @@ struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_ ArcaneExplosion_Timer = 5000; Yell_Timer = 2000; Yell = false; - advisorbase_ai::Reset(); } - void JustDied(Unit* pKiller) { if (m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_CAPERNIAN_DEATH, m_creature); } - void AttackStart(Unit* who) { if (!who || FakeDeath || m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (m_creature->Attack(who, true)) { m_creature->AddThreat(who, 0.0f); m_creature->SetInCombatWith(who); who->SetInCombatWith(m_creature); - m_creature->GetMotionMaster()->MoveChase(who, CAPERNIAN_DISTANCE); } } - void Aggro(Unit *who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (!who || FakeDeath) return; } - void UpdateAI(const uint32 diff) { advisorbase_ai::UpdateAI(diff); - //Faking Death, don't do anything if (FakeDeath) return; - //Return since we have no target if (!UpdateVictim()) return; - //Yell_Timer if (!Yell) { @@ -1167,28 +968,23 @@ struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_ Yell = true; } else Yell_Timer -= diff; } - //Fireball_Timer if (Fireball_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CAPERNIAN_FIREBALL); Fireball_Timer = 4000; } else Fireball_Timer -= diff; - //Conflagration_Timer if (Conflagration_Timer < diff) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (target && m_creature->IsWithinDistInMap(target, 30)) DoCast(target, SPELL_CONFLAGRATION); else DoCast(m_creature->getVictim(), SPELL_CONFLAGRATION); - Conflagration_Timer = 10000+rand()%5000; } else Conflagration_Timer -= diff; - //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { @@ -1206,103 +1002,79 @@ struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_ break; } } - if (InMeleeRange) DoCast(target, SPELL_ARCANE_EXPLOSION); - ArcaneExplosion_Timer = 4000+rand()%2000; } else ArcaneExplosion_Timer -= diff; - //Do NOT deal any melee damage. } }; - //Master Engineer Telonicus AI struct TRINITY_DLL_DECL boss_master_engineer_telonicusAI : public advisorbase_ai { boss_master_engineer_telonicusAI(Creature* pCreature) : advisorbase_ai(pCreature) {} - uint32 Bomb_Timer; uint32 RemoteToy_Timer; - void Reset() { Bomb_Timer = 10000; RemoteToy_Timer = 5000; - advisorbase_ai::Reset(); } - void JustDied(Unit* pKiller) { if (m_pInstance && m_pInstance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_TELONICUS_DEATH, m_creature); } - void Aggro(Unit *who) { if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; - if (!who || FakeDeath) return; - DoScriptText(SAY_TELONICUS_AGGRO, m_creature); } - void UpdateAI(const uint32 diff) { advisorbase_ai::UpdateAI(diff); - //Faking Death, do nothing if (FakeDeath) return; - //Return since we have no target if (!UpdateVictim()) return; - //Bomb_Timer if (Bomb_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_BOMB); Bomb_Timer = 25000; } else Bomb_Timer -= diff; - //RemoteToy_Timer if (RemoteToy_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_REMOTE_TOY); - RemoteToy_Timer = 10000+rand()%5000; } else RemoteToy_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Flame Strike AI struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI { mob_kael_flamestrikeAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 Timer; bool Casting; bool KillSelf; - void Reset() { Timer = 5000; Casting = false; KillSelf = false; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(14); } - void MoveInLineOfSight(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!Casting) @@ -1310,7 +1082,6 @@ struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI DoCast(m_creature, SPELL_FLAME_STRIKE_VIS); Casting = true; } - //Timer if (Timer < diff) { @@ -1319,38 +1090,31 @@ struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_FLAME_STRIKE_DMG); } else m_creature->Kill(m_creature); - KillSelf = true; Timer = 1000; } else Timer -= diff; } }; - //Phoenix AI struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI { mob_phoenix_tkAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 Cycle_Timer; - void Reset() { Cycle_Timer = 2000; m_creature->CastSpell(m_creature,SPELL_BURN,true); } - void JustDied(Unit* killer) { //is this spell in use anylonger? //m_creature->CastSpell(m_creature,SPELL_EMBER_BLAST,true); m_creature->SummonCreature(NPC_PHOENIX_EGG,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Cycle_Timer < diff) { //spell Burn should possible do this, but it doesn't, so do this for now. @@ -1359,48 +1123,38 @@ struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg)); Cycle_Timer = 2000; } else Cycle_Timer -= diff; - DoMeleeAttackIfReady(); } }; - //Phoenix Egg AI struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI { mob_phoenix_egg_tkAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 Rebirth_Timer; - void Reset() { Rebirth_Timer = 15000; } - //ignore any void MoveInLineOfSight(Unit* who) { return; } - void AttackStart(Unit* who) { if (m_creature->Attack(who, false)) { m_creature->SetInCombatWith(who); who->SetInCombatWith(m_creature); - DoStartNoMovement(who); } } - void JustSummoned(Creature* summoned) { summoned->AddThreat(m_creature->getVictim(), 0.0f); summoned->CastSpell(summoned,SPELL_REBIRTH,false); } - void UpdateAI(const uint32 diff) { if (!Rebirth_Timer) return; - if (Rebirth_Timer <= diff) { m_creature->SummonCreature(NPC_PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000); @@ -1408,47 +1162,38 @@ struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI } else Rebirth_Timer -= diff; } }; - CreatureAI* GetAI_boss_kaelthas(Creature* pCreature) { return new boss_kaelthasAI(pCreature); } - CreatureAI* GetAI_boss_thaladred_the_darkener(Creature* pCreature) { return new boss_thaladred_the_darkenerAI(pCreature); } - CreatureAI* GetAI_boss_lord_sanguinar(Creature* pCreature) { return new boss_lord_sanguinarAI(pCreature); } - CreatureAI* GetAI_boss_grand_astromancer_capernian(Creature* pCreature) { return new boss_grand_astromancer_capernianAI(pCreature); } - CreatureAI* GetAI_boss_master_engineer_telonicus(Creature* pCreature) { return new boss_master_engineer_telonicusAI(pCreature); } - CreatureAI* GetAI_mob_kael_flamestrike(Creature* pCreature) { return new mob_kael_flamestrikeAI(pCreature); } - CreatureAI* GetAI_mob_phoenix_tk(Creature* pCreature) { return new mob_phoenix_tkAI(pCreature); } - CreatureAI* GetAI_mob_phoenix_egg_tk(Creature* pCreature) { return new mob_phoenix_egg_tkAI(pCreature); } - void AddSC_boss_kaelthas() { Script *newscript; @@ -1456,37 +1201,30 @@ void AddSC_boss_kaelthas() newscript->Name = "boss_kaelthas"; newscript->GetAI = &GetAI_boss_kaelthas; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_thaladred_the_darkener"; newscript->GetAI = &GetAI_boss_thaladred_the_darkener; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_lord_sanguinar"; newscript->GetAI = &GetAI_boss_lord_sanguinar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_grand_astromancer_capernian"; newscript->GetAI = &GetAI_boss_grand_astromancer_capernian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_master_engineer_telonicus"; newscript->GetAI = &GetAI_boss_master_engineer_telonicus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_kael_flamestrike"; newscript->GetAI = &GetAI_mob_kael_flamestrike; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_phoenix_tk"; newscript->GetAI = &GetAI_mob_phoenix_tk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_phoenix_egg_tk"; newscript->GetAI = &GetAI_mob_phoenix_egg_tk; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp index c1de7772120..afd513b4a30 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Void_Reaver SD%Complete: 90 SDComment: Should reset if raid are out of room. SDCategory: Tempest Keep, The Eye EndScriptData */ - #include "precompiled.h" #include "def_the_eye.h" - enum eEnums { SAY_AGGRO = -1550000, @@ -33,141 +30,111 @@ enum eEnums SAY_DEATH = -1550004, SAY_POUNDING1 = -1550005, SAY_POUNDING2 = -1550006, - SPELL_POUNDING = 34162, SPELL_ARCANE_ORB = 34172, SPELL_KNOCK_AWAY = 25778, SPELL_BERSERK = 27680 }; - struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI { boss_void_reaverAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } - ScriptedInstance* pInstance; - uint32 Pounding_Timer; uint32 ArcaneOrb_Timer; uint32 KnockAway_Timer; uint32 Berserk_Timer; - bool Enraged; - void Reset() { Pounding_Timer = 15000; ArcaneOrb_Timer = 3000; KnockAway_Timer = 30000; Berserk_Timer = 600000; - Enraged = false; - if (pInstance && m_creature->isAlive()) pInstance->SetData(DATA_VOIDREAVEREVENT, NOT_STARTED); } - void KilledUnit(Unit *victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature); } - void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); DoZoneInCombat(); - if (pInstance) pInstance->SetData(DATA_VOIDREAVEREVENT, DONE); } - void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if (pInstance) pInstance->SetData(DATA_VOIDREAVEREVENT, IN_PROGRESS); } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - // Pounding if (Pounding_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_POUNDING); - DoScriptText(RAND(SAY_POUNDING1,SAY_POUNDING2), m_creature); Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000) }else Pounding_Timer -= diff; - // Arcane Orb if (ArcaneOrb_Timer < diff) { Unit *target = NULL; std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!target) continue; - // exclude pets & totems if (target->GetTypeId() != TYPEID_PLAYER) continue; - //18 yard radius minimum if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive() && !target->IsWithinDist(m_creature, 18, false)) target_list.push_back(target); target = NULL; } - if (target_list.size()) target = *(target_list.begin()+rand()%target_list.size()); else target = m_creature->getVictim(); - if (target) m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, false, NULL, NULL, NULL, target); - ArcaneOrb_Timer = 3000; }else ArcaneOrb_Timer -= diff; - // Single Target knock back, reduces aggro if (KnockAway_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCK_AWAY); - //Drop 25% aggro if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-25); - KnockAway_Timer = 30000; }else KnockAway_Timer -= diff; - //Berserk if (Berserk_Timer < diff && !Enraged) { DoCast(m_creature,SPELL_BERSERK); Enraged = true; }else Berserk_Timer -= diff; - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(diff); } }; - CreatureAI* GetAI_boss_void_reaver(Creature* pCreature) { return new boss_void_reaverAI (pCreature); } - void AddSC_boss_void_reaver() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/def_the_eye.h b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/def_the_eye.h index d0d3ea09061..3fe81530bc4 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/def_the_eye.h +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/def_the_eye.h @@ -1,10 +1,8 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef DEF_THE_EYE_H #define DEF_THE_EYE_H - #define DATA_ALAREVENT 1 #define DATA_ASTROMANCER 2 #define DATA_GRANDASTROMANCERCAPERNIAN 3 diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/instance_the_eye.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/instance_the_eye.cpp index f973f96c1ff..79183547c50 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/instance_the_eye.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/instance_the_eye.cpp @@ -13,30 +13,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_The_Eye SD%Complete: 100 SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ - #include "precompiled.h" #include "def_the_eye.h" - #define MAX_ENCOUNTER 5 - /* The Eye encounters: 0 - Kael'thas event 1 - Al' ar event 2 - Solarian Event 3 - Void Reaver event */ - struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance { instance_the_eye(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint64 ThaladredTheDarkener; uint64 LordSanguinar; uint64 GrandAstromancerCapernian; @@ -44,16 +38,12 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance uint64 Kaelthas; uint64 Astromancer; uint64 Alar; - uint8 KaelthasEventPhase; uint8 AlarEventPhase; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - ThaladredTheDarkener = 0; LordSanguinar = 0; GrandAstromancerCapernian = 0; @@ -61,19 +51,15 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance Kaelthas = 0; Astromancer = 0; Alar = 0; - KaelthasEventPhase = 0; AlarEventPhase = 0; } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - void OnCreatureCreate(Creature* pCreature, bool add) { switch(pCreature->GetEntry()) @@ -87,7 +73,6 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance case 19514: Alar = pCreature->GetGUID(); break; } } - uint64 GetData64(uint32 identifier) { switch(identifier) @@ -102,7 +87,6 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance } return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -115,7 +99,6 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance if (data == DONE) SaveToDB(); } - uint32 GetData(uint32 type) { switch(type) @@ -127,7 +110,6 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance } return 0; } - std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -142,7 +124,6 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance } return NULL; } - void Load(const char* in) { if (!in) @@ -153,18 +134,16 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. m_auiEncounter[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceData* GetInstanceData_instance_the_eye(Map* pMap) { return new instance_the_eye(pMap); } - void AddSC_instance_the_eye() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/the_eye.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/the_eye.cpp index a7e47718017..e39457fedf5 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/the_eye.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_eye/the_eye.cpp @@ -13,81 +13,63 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: The_Eye SD%Complete: 100 SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ - /* ContentData mob_crystalcore_devastator EndContentData */ - #include "precompiled.h" #include "def_the_eye.h" - #define SPELL_COUNTERCHARGE 35035 #define SPELL_KNOCKAWAY 22893 - struct TRINITY_DLL_DECL mob_crystalcore_devastatorAI : public ScriptedAI { mob_crystalcore_devastatorAI(Creature *c) : ScriptedAI(c) {} - uint32 Knockaway_Timer; uint32 Countercharge_Timer; - void Reset() { Countercharge_Timer = 9000; Knockaway_Timer = 25000; } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //Check if we have a current target //Knockaway_Timer if (Knockaway_Timer < diff) { m_creature->CastSpell(m_creature->getVictim(),SPELL_KNOCKAWAY, true); - // current aggro target is knocked away pick new target Unit* Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); - if (!Target || Target == m_creature->getVictim()) Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); - if (Target) m_creature->TauntApply(Target); - Knockaway_Timer = 23000; } else Knockaway_Timer -= diff; - //Countercharge_Timer if (Countercharge_Timer < diff) { DoCast(this->m_creature,SPELL_COUNTERCHARGE); Countercharge_Timer = 45000; }else Countercharge_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_crystalcore_devastator(Creature* pCreature) { return new mob_crystalcore_devastatorAI (pCreature); } - void AddSC_the_eye() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_gyrokill.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_gyrokill.cpp index 90f17e299b7..16b3e443769 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_gyrokill.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_gyrokill.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gatewatcher_Gyrokill SD%Complete: 0 SDComment: Place Holder SDCategory: Tempest Keep, The Mechanar EndScriptData */ - #include "precompiled.h" - //not used #define SAY_AGGRO -1554000 #define SAY_SAW_ATTACK1 -1554001 @@ -30,7 +27,6 @@ EndScriptData */ #define SAY_SLAY1 -1554003 #define SAY_SLAY2 -1554004 #define SAY_DEATH -1554005 - #define SPELL_STREAM_OF_MACHINE_FLUID 35311 #define SPELL_SAW_BLADE 35318 #define H_SPELL_SAW_BLADE 39192 diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp index 946108a72f0..66e1580f3d8 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Gatewatcher_Ironhand SD%Complete: 75 SDComment: SDCategory: Tempest Keep, The Mechanar EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO_1 -1554006 #define SAY_HAMMER_1 -1554007 #define SAY_HAMMER_2 -1554008 @@ -30,7 +27,6 @@ EndScriptData */ #define SAY_SLAY_2 -1554010 #define SAY_DEATH_1 -1554011 #define EMOTE_HAMMER -1554012 - // Spells to be casted #define SPELL_SHADOW_POWER 35322 #define H_SPELL_SHADOW_POWER 39193 @@ -38,7 +34,6 @@ EndScriptData */ #define SPELL_JACKHAMMER 35327 #define H_SPELL_JACKHAMMER 39194 #define SPELL_STREAM_OF_MACHINE_FLUID 35311 - // Gatewatcher Iron-Hand AI struct TRINITY_DLL_DECL boss_gatewatcher_iron_handAI : public ScriptedAI { @@ -46,74 +41,60 @@ struct TRINITY_DLL_DECL boss_gatewatcher_iron_handAI : public ScriptedAI { HeroicMode = c->GetMap()->IsHeroic(); } - bool HeroicMode; - uint32 Shadow_Power_Timer; uint32 Jackhammer_Timer; uint32 Stream_of_Machine_Fluid_Timer; - void Reset() { Shadow_Power_Timer = 25000; Jackhammer_Timer = 45000; Stream_of_Machine_Fluid_Timer = 55000; - } void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO_1, m_creature); } - void KilledUnit(Unit* victim) { if (rand()%2) return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH_1, m_creature); //TODO: Add door check/open code } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Shadow Power if (Shadow_Power_Timer < diff) { DoCast(m_creature,HEROIC(SPELL_SHADOW_POWER, H_SPELL_SHADOW_POWER)); Shadow_Power_Timer = 20000 + rand()%8000; }else Shadow_Power_Timer -= diff; - //Jack Hammer if (Jackhammer_Timer < diff) { //TODO: expect cast this about 5 times in a row (?), announce it by emote only once DoScriptText(EMOTE_HAMMER, m_creature); DoCast(m_creature->getVictim(),HEROIC(SPELL_JACKHAMMER, H_SPELL_JACKHAMMER)); - //chance to yell, but not same time as emote (after spell in fact casted) if (rand()%2) return; - DoScriptText(RAND(SAY_HAMMER_1,SAY_HAMMER_2), m_creature); Jackhammer_Timer = 30000; }else Jackhammer_Timer -= diff; - //Stream of Machine Fluid if (Stream_of_Machine_Fluid_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_STREAM_OF_MACHINE_FLUID); Stream_of_Machine_Fluid_Timer = 35000 + rand()%15000; }else Stream_of_Machine_Fluid_Timer -= diff; - DoMeleeAttackIfReady(); } }; @@ -121,7 +102,6 @@ CreatureAI* GetAI_boss_gatewatcher_iron_hand(Creature* pCreature) { return new boss_gatewatcher_iron_handAI (pCreature); } - void AddSC_boss_gatewatcher_iron_hand() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp index aef118ff42f..e7d861dbee7 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp @@ -13,17 +13,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss_Nethermancer_Sepethrea SD%Complete: 90 SDComment: Need adjustments to initial summons SDCategory: Tempest Keep, The Mechanar EndScriptData */ - #include "precompiled.h" #include "def_mechanar.h" - #define SAY_AGGRO -1554013 #define SAY_SUMMON -1554014 #define SAY_DRAGONS_BREATH_1 -1554015 @@ -31,16 +28,13 @@ EndScriptData */ #define SAY_SLAY1 -1554017 #define SAY_SLAY2 -1554018 #define SAY_DEATH -1554019 - #define SPELL_SUMMON_RAGIN_FLAMES 35275 #define H_SPELL_SUMMON_RAGIN_FLAMES 39084 - #define SPELL_FROST_ATTACK 35263 #define SPELL_ARCANE_BLAST 35314 #define SPELL_DRAGONS_BREATH 35250 #define SPELL_KNOCKBACK 37317 #define SPELL_SOLARBURN 35267 - struct TRINITY_DLL_DECL boss_nethermancer_sepethreaAI : public ScriptedAI { boss_nethermancer_sepethreaAI(Creature *c) : ScriptedAI(c) @@ -48,17 +42,13 @@ struct TRINITY_DLL_DECL boss_nethermancer_sepethreaAI : public ScriptedAI pInstance = c->GetInstanceData(); HeroicMode = c->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; - bool HeroicMode; - uint32 frost_attack_Timer; uint32 arcane_blast_Timer; uint32 dragons_breath_Timer; uint32 knockback_Timer; uint32 solarburn_Timer; - void Reset() { frost_attack_Timer = 7000 + rand()%3000; @@ -66,54 +56,44 @@ struct TRINITY_DLL_DECL boss_nethermancer_sepethreaAI : public ScriptedAI dragons_breath_Timer = 18000 + rand()%4000; knockback_Timer = 22000 + rand()%6000; solarburn_Timer = 30000; - if (pInstance) pInstance->SetData(DATA_NETHERMANCER_EVENT, NOT_STARTED); } - void EnterCombat(Unit *who) { if (pInstance) pInstance->SetData(DATA_NETHERMANCER_EVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, m_creature); DoCast(who, HEROIC(SPELL_SUMMON_RAGIN_FLAMES, H_SPELL_SUMMON_RAGIN_FLAMES)); DoScriptText(SAY_SUMMON, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) pInstance->SetData(DATA_NETHERMANCER_EVENT, DONE); } - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - //Frost Attack if (frost_attack_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_ATTACK); frost_attack_Timer = 7000 + rand()%3000; }else frost_attack_Timer -= diff; - //Arcane Blast if (arcane_blast_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_ARCANE_BLAST); arcane_blast_Timer = 15000; }else arcane_blast_Timer -= diff; - //Dragons Breath if (dragons_breath_Timer < diff) { @@ -121,56 +101,44 @@ struct TRINITY_DLL_DECL boss_nethermancer_sepethreaAI : public ScriptedAI { if (rand()%2) return; - DoScriptText(RAND(SAY_DRAGONS_BREATH_1,SAY_DRAGONS_BREATH_2), m_creature); } dragons_breath_Timer = 12000 + rand()%10000; }else dragons_breath_Timer -= diff; - //Knockback if (knockback_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KNOCKBACK); knockback_Timer = 15000 + rand()%10000; }else knockback_Timer -= diff; - //Solarburn if (solarburn_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SOLARBURN); solarburn_Timer = 30000; }else solarburn_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_nethermancer_sepethrea(Creature* pCreature) { return new boss_nethermancer_sepethreaAI (pCreature); } - #define SPELL_INFERNO 35268 #define H_SPELL_INFERNO 39346 #define SPELL_FIRE_TAIL 35278 - struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI { mob_ragin_flamesAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); HeroicMode = m_creature->GetMap()->IsHeroic(); } - ScriptedInstance *pInstance; - bool HeroicMode; - uint32 inferno_Timer; uint32 flame_timer; uint32 Check_Timer; - bool onlyonce; - void Reset() { inferno_Timer = 10000; @@ -181,11 +149,9 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); m_creature->SetSpeed(MOVE_RUN, HeroicMode ? 0.7f : 0.5f); } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { //Check_Timer @@ -202,33 +168,27 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI } Check_Timer = 1000; }else Check_Timer -= diff; - if (!UpdateVictim()) return; - if (!onlyonce) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) m_creature->GetMotionMaster()->MoveChase(target); onlyonce = true; } - if (inferno_Timer < diff) { DoCast(m_creature->getVictim(),HEROIC(SPELL_INFERNO, H_SPELL_INFERNO)); m_creature->TauntApply(m_creature->getVictim()); inferno_Timer = 10000; }else inferno_Timer -= diff; - if (flame_timer < diff) { DoCast(m_creature,SPELL_FIRE_TAIL); flame_timer = 500; }else flame_timer -=diff; - DoMeleeAttackIfReady(); } - }; CreatureAI* GetAI_mob_ragin_flames(Creature* pCreature) { @@ -241,7 +201,6 @@ void AddSC_boss_nethermancer_sepethrea() newscript->Name = "boss_nethermancer_sepethrea"; newscript->GetAI = &GetAI_boss_nethermancer_sepethrea; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_ragin_flames"; newscript->GetAI = &GetAI_mob_ragin_flames; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp index 02e44616b52..077cb0e0ecc 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp @@ -13,16 +13,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Boss Pathaleon the Calculator SD%Complete: 50 SDComment: Event missing. Script for himself 99% blizzlike. SDCategory: Tempest Keep, The Mechanar EndScriptData */ - #include "precompiled.h" - #define SAY_AGGRO -1554020 #define SAY_DOMINATION_1 -1554021 #define SAY_DOMINATION_2 -1554022 @@ -31,30 +28,25 @@ EndScriptData */ #define SAY_SLAY_1 -1554025 #define SAY_SLAY_2 -1554026 #define SAY_DEATH -1554027 - // Spells to be casted #define SPELL_MANA_TAP 36021 #define SPELL_ARCANE_TORRENT 36022 #define SPELL_DOMINATION 35280 #define H_SPELL_ARCANE_EXPLOSION 15453 #define SPELL_FRENZY 36992 - #define SPELL_SUMMON_NETHER_WRAITH_1 35285 //Spells work, but not implemented #define SPELL_SUMMON_NETHER_WRAITH_2 35286 #define SPELL_SUMMON_NETHER_WRAITH_3 35287 #define SPELL_SUMMON_NETHER_WRAITH_4 35288 - // Add Spells #define SPELL_DETONATION 35058 #define SPELL_ARCANE_MISSILES 35034 - struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI { boss_pathaleon_the_calculatorAI(Creature *c) : ScriptedAI(c), summons(m_creature) { HeroicMode = c->GetMap()->IsHeroic(); } - uint32 Summon_Timer; SummonList summons; uint32 ManaTap_Timer; @@ -63,9 +55,7 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI uint32 ArcaneExplosion_Timer; bool HeroicMode; bool Enraged; - uint32 Counter; - void Reset() { Summon_Timer = 30000; @@ -73,9 +63,7 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI ArcaneTorrent_Timer = 16000 + rand()%9000; Domination_Timer = 25000 + rand()%15000; ArcaneExplosion_Timer = 8000 + rand()%5000; - Enraged = false; - Counter = 0; summons.DespawnAll(); } @@ -83,31 +71,25 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI { DoScriptText(SAY_AGGRO, m_creature); } - void KilledUnit(Unit* victim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), m_creature); } - void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - summons.DespawnAll(); } - void JustSummoned(Creature *summon) {summons.Summon(summon);} void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; - if (Summon_Timer < diff) { - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++i) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Creature* Wraith = m_creature->SummonCreature(21062,m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); @@ -117,30 +99,25 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI DoScriptText(SAY_SUMMON, m_creature); Summon_Timer = 30000 + rand()%15000; }else Summon_Timer -= diff; - if (ManaTap_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MANA_TAP); ManaTap_Timer = 14000 + rand()%8000; }else ManaTap_Timer -= diff; - if (ArcaneTorrent_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ARCANE_TORRENT); ArcaneTorrent_Timer = 12000 + rand()%6000; }else ArcaneTorrent_Timer -= diff; - if (Domination_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) { DoScriptText(RAND(SAY_DOMINATION_1,SAY_DOMINATION_2), m_creature); - DoCast(target,SPELL_DOMINATION); } Domination_Timer = 25000 + rand()%5000; }else Domination_Timer -= diff; - //Only casting if Heroic Mode is used if (HeroicMode) { @@ -150,15 +127,12 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI ArcaneExplosion_Timer = 10000 + rand()%4000; }else ArcaneExplosion_Timer -= diff; } - if (!Enraged && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21) { DoCast(m_creature, SPELL_FRENZY); DoScriptText(SAY_ENRAGE, m_creature); Enraged = true; - } - DoMeleeAttackIfReady(); } }; @@ -166,44 +140,35 @@ CreatureAI* GetAI_boss_pathaleon_the_calculator(Creature* pCreature) { return new boss_pathaleon_the_calculatorAI (pCreature); } - struct TRINITY_DLL_DECL mob_nether_wraithAI : public ScriptedAI { mob_nether_wraithAI(Creature *c) : ScriptedAI(c) {} - uint32 ArcaneMissiles_Timer; uint32 Detonation_Timer; uint32 Die_Timer; bool Detonation; - void Reset() { ArcaneMissiles_Timer = 1000 + rand()%3000; Detonation_Timer = 20000; Die_Timer = 2200; Detonation = false; - } - void EnterCombat(Unit* who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (ArcaneMissiles_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) DoCast(target,SPELL_ARCANE_MISSILES); else DoCast(m_creature->getVictim(),SPELL_ARCANE_MISSILES); - ArcaneMissiles_Timer = 5000 + rand()%5000; }else ArcaneMissiles_Timer -=diff; - if (!Detonation) { if (Detonation_Timer < diff) @@ -212,7 +177,6 @@ struct TRINITY_DLL_DECL mob_nether_wraithAI : public ScriptedAI Detonation = true; }else Detonation_Timer -= diff; } - if (Detonation) { if (Die_Timer < diff) @@ -221,16 +185,13 @@ struct TRINITY_DLL_DECL mob_nether_wraithAI : public ScriptedAI m_creature->RemoveCorpse(); }else Die_Timer -= diff; } - DoMeleeAttackIfReady(); } - }; CreatureAI* GetAI_mob_nether_wraith(Creature* pCreature) { return new mob_nether_wraithAI (pCreature); } - void AddSC_boss_pathaleon_the_calculator() { Script *newscript; @@ -238,7 +199,6 @@ void AddSC_boss_pathaleon_the_calculator() newscript->Name = "boss_pathaleon_the_calculator"; newscript->GetAI = &GetAI_boss_pathaleon_the_calculator; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_nether_wraith"; newscript->GetAI = &GetAI_mob_nether_wraith; diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/def_mechanar.h b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/def_mechanar.h index d1b53eebf53..97c756d0fef 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/def_mechanar.h +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/def_mechanar.h @@ -1,6 +1,5 @@ #ifndef DEF_MECHANAR_H #define DEF_MECHANAR_H - #define DATA_NETHERMANCER_EVENT 1 #endif diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/instance_mechanar.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/instance_mechanar.cpp index e43190620d9..c4d36178e0f 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/instance_mechanar.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/the_mechanar/instance_mechanar.cpp @@ -13,55 +13,43 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Instance_Mechanar SD%Complete: 100 SDComment: SDCategory: Mechanar EndScriptData */ - #include "precompiled.h" #include "def_mechanar.h" - #define MAX_ENCOUNTER 1 - struct TRINITY_DLL_DECL instance_mechanar : public ScriptedInstance { instance_mechanar(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - void Initialize() { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - bool IsEncounterInProgress() const { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; } - uint32 GetData(uint32 type) { switch(type) { case DATA_NETHERMANCER_EVENT: return m_auiEncounter[0]; } - return false; } - uint64 GetData64 (uint32 identifier) { return 0; } - void SetData(uint32 type, uint32 data) { switch(type) @@ -70,12 +58,10 @@ struct TRINITY_DLL_DECL instance_mechanar : public ScriptedInstance } } }; - InstanceData* GetInstanceData_instance_mechanar(Map* pMap) { return new instance_mechanar(pMap); } - void AddSC_instance_mechanar() { Script *newscript; diff --git a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp index 76776234d98..0474b5f5de9 100644 --- a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Terokkar_Forest SD%Complete: 85 SDComment: Quest support: 9889, 10009, 10873, 10896, 10898, 11096, 10052, 10051. Skettis->Ogri'la Flight SDCategory: Terokkar Forest EndScriptData */ - /* ContentData mob_unkor_the_ruthless mob_infested_root_walker @@ -30,31 +28,23 @@ npc_floon npc_isla_starmane npc_slim EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## mob_unkor_the_ruthless ######*/ - #define SAY_SUBMIT -1000351 - #define FACTION_HOSTILE 45 #define FACTION_FRIENDLY 35 #define QUEST_DONTKILLTHEFATONE 9889 - #define SPELL_PULVERIZE 2676 //#define SPELL_QUID9889 32174 - struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI { mob_unkor_the_ruthlessAI(Creature* c) : ScriptedAI(c) {} - bool CanDoQuest; uint32 UnkorUnfriendly_Timer; uint32 Pulverize_Timer; - void Reset() { CanDoQuest = false; @@ -63,9 +53,7 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->setFaction(FACTION_HOSTILE); } - void EnterCombat(Unit *who) {} - void DoNice() { DoScriptText(SAY_SUBMIT, m_creature); @@ -76,7 +64,6 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI m_creature->CombatStop(true); UnkorUnfriendly_Timer = 60000; } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -84,7 +71,7 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI { if (Group* pGroup = CAST_PLR(done_by)->GetGroup()) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *pGroupie = itr->getSource(); if (pGroupie && @@ -105,7 +92,6 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (CanDoQuest) @@ -124,36 +110,28 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI }else UnkorUnfriendly_Timer -= diff; } } - if (!UpdateVictim()) return; - if (Pulverize_Timer < diff) { DoCast(m_creature,SPELL_PULVERIZE); Pulverize_Timer = 9000; }else Pulverize_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_mob_unkor_the_ruthless(Creature* pCreature) { return new mob_unkor_the_ruthlessAI (pCreature); } - /*###### ## mob_infested_root_walker ######*/ - struct TRINITY_DLL_DECL mob_infested_root_walkerAI : public ScriptedAI { mob_infested_root_walkerAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } void EnterCombat(Unit *who) { } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by && done_by->GetTypeId() == TYPEID_PLAYER) @@ -168,7 +146,6 @@ CreatureAI* GetAI_mob_infested_root_walker(Creature* pCreature) return new mob_infested_root_walkerAI (pCreature); } - /*###### ## mob_skywing ######*/ @@ -176,13 +153,11 @@ struct TRINITY_DLL_DECL npc_skywingAI : public npc_escortAI { public: npc_skywingAI(Creature *c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; - switch(i) { case 8: @@ -190,14 +165,11 @@ public: break; } } - void EnterCombat(Unit* who) {} - void MoveInLineOfSight(Unit *who) { if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - if (who->GetTypeId() == TYPEID_PLAYER) { if (CAST_PLR(who)->GetQuestStatus(10898) == QUEST_STATUS_INCOMPLETE) @@ -210,31 +182,24 @@ public: } } } - void Reset() {} - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_skywingAI(Creature* pCreature) { return new npc_skywingAI(pCreature); } - /*###### ## mob_rotting_forest_rager ######*/ - struct TRINITY_DLL_DECL mob_rotting_forest_ragerAI : public ScriptedAI { mob_rotting_forest_ragerAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } void EnterCombat(Unit *who) { } - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -248,14 +213,11 @@ CreatureAI* GetAI_mob_rotting_forest_rager(Creature* pCreature) { return new mob_rotting_forest_ragerAI (pCreature); } - /*###### ## mob_netherweb_victim ######*/ - #define QUEST_TARGET 22459 //#define SPELL_FREE_WEBBED 38950 - const uint32 netherwebVictims[6] = { 18470, 16805, 21242, 18452, 22482, 21285 @@ -263,11 +225,9 @@ const uint32 netherwebVictims[6] = struct TRINITY_DLL_DECL mob_netherweb_victimAI : public ScriptedAI { mob_netherweb_victimAI(Creature *c) : ScriptedAI(c) {} - void Reset() { } void EnterCombat(Unit *who) { } void MoveInLineOfSight(Unit *who) { } - void JustDied(Unit* Killer) { if (Killer->GetTypeId() == TYPEID_PLAYER) @@ -281,7 +241,6 @@ struct TRINITY_DLL_DECL mob_netherweb_victimAI : public ScriptedAI } else m_creature->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - if (rand()%100 < 75) m_creature->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f,0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); m_creature->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); @@ -293,38 +252,30 @@ CreatureAI* GetAI_mob_netherweb_victim(Creature* pCreature) { return new mob_netherweb_victimAI (pCreature); } - /*###### ## npc_floon ######*/ - #define GOSSIP_FLOON1 "You owe Sim'salabim money. Hand them over or die!" #define GOSSIP_FLOON2 "Hand over the money or die...again!" - enum eFloon { SAY_FLOON_ATTACK = -1000352, - SPELL_SILENCE = 6726, SPELL_FROSTBOLT = 9672, SPELL_FROST_NOVA = 11831, - FACTION_HOSTILE_FL = 1738, QUEST_CRACK_SKULLS = 10009 }; - struct TRINITY_DLL_DECL npc_floonAI : public ScriptedAI { npc_floonAI(Creature* c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } - uint32 m_uiNormFaction; uint32 Silence_Timer; uint32 Frostbolt_Timer; uint32 FrostNova_Timer; - void Reset() { Silence_Timer = 2000; @@ -333,50 +284,40 @@ struct TRINITY_DLL_DECL npc_floonAI : public ScriptedAI if (m_creature->getFaction() != m_uiNormFaction) m_creature->setFaction(m_uiNormFaction); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (Silence_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); Silence_Timer = 30000; }else Silence_Timer -= diff; - if (FrostNova_Timer < diff) { DoCast(m_creature,SPELL_FROST_NOVA); FrostNova_Timer = 20000; }else FrostNova_Timer -= diff; - if (Frostbolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); Frostbolt_Timer = 5000; }else Frostbolt_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_floon(Creature* pCreature) { return new npc_floonAI (pCreature); } - bool GossipHello_npc_floon(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9442, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_floon(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -393,32 +334,25 @@ bool GossipSelect_npc_floon(Player* pPlayer, Creature* pCreature, uint32 uiSende } return true; } - /*###### ## npc_isla_starmane ######*/ - #define SAY_PROGRESS_1 -1000353 #define SAY_PROGRESS_2 -1000354 #define SAY_PROGRESS_3 -1000355 #define SAY_PROGRESS_4 -1000356 - #define QUEST_EFTW_H 10052 #define QUEST_EFTW_A 10051 #define GO_CAGE 182794 #define SPELL_CAT 32447 - struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 0: @@ -444,12 +378,10 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; } } - void Reset() { me->RestoreFaction(); } - void JustDied(Unit* killer) { if (Player* pPlayer = GetPlayerForEscort()) @@ -461,7 +393,6 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI } } }; - bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest const* quest) { if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) @@ -471,12 +402,10 @@ bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest c } return true; } - CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) { return new npc_isla_starmaneAI(pCreature); } - /*###### ## go_skull_pile ######*/ @@ -484,7 +413,6 @@ CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) #define GOSSIP_S_KARROG "Summon Karrog" #define GOSSIP_S_GEZZARAK_THE_HUNTRESS "Summon Gezzarak the Huntress" #define GOSSIP_S_VAKKIZ_THE_WINDRAGER "Summon Vakkiz the Windrager" - bool GossipHello_go_skull_pile(Player* pPlayer, GameObject* pGo) { if ((pPlayer->GetQuestStatus(11885) == QUEST_STATUS_INCOMPLETE) || pPlayer->GetQuestRewardStatus(11885)) @@ -494,11 +422,9 @@ bool GossipHello_go_skull_pile(Player* pPlayer, GameObject* pGo) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_GEZZARAK_THE_HUNTRESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_VAKKIZ_THE_WINDRAGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); } - pPlayer->SEND_GOSSIP_MENU(pGo->GetGOInfo()->questgiver.gossipID, pGo->GetGUID()); return true; } - void SendActionMenu_go_skull_pile(Player* pPlayer, GameObject* pGo, uint32 uiAction) { switch(uiAction) @@ -517,7 +443,6 @@ void SendActionMenu_go_skull_pile(Player* pPlayer, GameObject* pGo, uint32 uiAct break; } } - bool GossipSelect_go_skull_pile(Player* pPlayer, GameObject* pGo, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -526,16 +451,13 @@ bool GossipSelect_go_skull_pile(Player* pPlayer, GameObject* pGo, uint32 uiSende } return true; } - /*###### ## npc_slim ######*/ - enum eSlim { FACTION_CONSORTIUM = 933 }; - bool GossipHello_npc_slim(Player* pPlayer, Creature* pCreature) { if (pCreature->isVendor() && pPlayer->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY) @@ -545,42 +467,31 @@ bool GossipHello_npc_slim(Player* pPlayer, Creature* pCreature) } else pPlayer->SEND_GOSSIP_MENU(9895, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_slim(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*######## ####npc_Akuno #####*/ - #define QUEST_NPC_AKUNO 10887 #define Summon 21661 - struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI { npc_akunoAI(Creature *c) : npc_escortAI(c) {} - bool IsWalking; - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if(!pPlayer) return; - if(IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - switch(i) { case 0: m_creature->setFaction(5); break; @@ -595,7 +506,6 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI break; } } - void Reset() { if (IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) @@ -606,7 +516,6 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI IsWalking=false; } }; - bool QuestAccept_npc_akuno(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if(pQuest->GetQuestId() == QUEST_NPC_AKUNO) @@ -616,66 +525,54 @@ bool QuestAccept_npc_akuno(Player* pPlayer, Creature* pCreature, Quest const* pQ } return true; } - CreatureAI* GetAI_npc_akuno(Creature* pCreature) { return new npc_akunoAI(pCreature); } - void AddSC_terokkar_forest() { Script *newscript; - newscript = new Script; newscript->Name = "mob_unkor_the_ruthless"; newscript->GetAI = &GetAI_mob_unkor_the_ruthless; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_infested_root_walker"; newscript->GetAI = &GetAI_mob_infested_root_walker; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_rotting_forest_rager"; newscript->GetAI = &GetAI_mob_rotting_forest_rager; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_netherweb_victim"; newscript->GetAI = &GetAI_mob_netherweb_victim; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_floon"; newscript->GetAI = &GetAI_npc_floon; newscript->pGossipHello = &GossipHello_npc_floon; newscript->pGossipSelect = &GossipSelect_npc_floon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_isla_starmane"; newscript->GetAI = &GetAI_npc_isla_starmaneAI; newscript->pQuestAccept = &QuestAccept_npc_isla_starmane; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_skull_pile"; newscript->pGOHello = &GossipHello_go_skull_pile; newscript->pGOSelect = &GossipSelect_go_skull_pile; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_skywing"; newscript->GetAI = &GetAI_npc_skywingAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_slim"; newscript->pGossipHello = &GossipHello_npc_slim; newscript->pGossipSelect = &GossipSelect_npc_slim; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_akuno"; newscript->GetAI = &GetAI_npc_akuno; diff --git a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp index d03e161a2c5..a8b66a8764c 100644 --- a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Zangarmarsh SD%Complete: 100 SDComment: Quest support: 9752, 9785, 9803, 10009. Mark Of ... buffs. SDCategory: Zangarmarsh EndScriptData */ - /* ContentData npcs_ashyen_and_keleth npc_cooshcoosh @@ -29,20 +27,16 @@ npc_mortog_steamhead npc_kayra_longmane npc_timothy_daniels EndContentData */ - #include "precompiled.h" #include "escort_ai.h" - /*###### ## npcs_ashyen_and_keleth ######*/ - #define GOSSIP_ITEM_BLESS_ASH "Grant me your mark, wise ancient." #define GOSSIP_ITEM_BLESS_KEL "Grant me your mark, mighty ancient." //signed for 17900 but used by 17900,17901 #define GOSSIP_REWARD_BLESS -1000359 //#define TEXT_BLESSINGS "" - bool GossipHello_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetReputationRank(942) > REP_NEUTRAL) @@ -53,10 +47,8 @@ bool GossipHello_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); } pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -64,7 +56,6 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature, u pCreature->setPowerType(POWER_MANA); pCreature->SetMaxPower(POWER_MANA,200); //set a "fake" mana value, we can't depend on database doing it in this case pCreature->SetPower(POWER_MANA,200); - if (pCreature->GetEntry() == 17900) //check which Creature we are dealing with { switch (pPlayer->GetReputationRank(942)) @@ -87,7 +78,6 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature, u break; } } - if (pCreature->GetEntry() == 17901) { switch (pPlayer->GetReputationRank(942)) //mark of war @@ -115,68 +105,54 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature, u } return true; } - /*###### ## npc_cooshcoosh ######*/ - #define GOSSIP_COOSH "You owe Sim'salabim money. Hand them over or die!" - enum eCooshhooosh { SPELL_LIGHTNING_BOLT = 9532, QUEST_CRACK_SKULLS = 10009, FACTION_HOSTILE_CO = 45 }; - struct TRINITY_DLL_DECL npc_cooshcooshAI : public ScriptedAI { npc_cooshcooshAI(Creature* c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } - uint32 m_uiNormFaction; uint32 LightningBolt_Timer; - void Reset() { LightningBolt_Timer = 2000; if (m_creature->getFaction() != m_uiNormFaction) m_creature->setFaction(m_uiNormFaction); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (LightningBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_LIGHTNING_BOLT); LightningBolt_Timer = 5000; }else LightningBolt_Timer -= diff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_cooshcoosh(Creature* pCreature) { return new npc_cooshcooshAI (pCreature); } - bool GossipHello_npc_cooshcoosh(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9441, pCreature->GetGUID()); return true; } - bool GossipSelect_npc_cooshcoosh(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) @@ -187,25 +163,19 @@ bool GossipSelect_npc_cooshcoosh(Player* pPlayer, Creature* pCreature, uint32 ui } return true; } - /*###### ## npc_elder_kuruti ######*/ - #define GOSSIP_ITEM_KUR1 "Offer treat" #define GOSSIP_ITEM_KUR2 "Im a messenger for Draenei" #define GOSSIP_ITEM_KUR3 "Get message" - bool GossipHello_npc_elder_kuruti(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(9803) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9226, pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_elder_kuruti(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiAction) @@ -237,21 +207,16 @@ bool GossipSelect_npc_elder_kuruti(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_mortog_steamhead ######*/ - bool GossipHello_npc_mortog_steamhead(Player* pPlayer, Creature* pCreature) { if (pCreature->isVendor() && pPlayer->GetReputationRank(942) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_mortog_steamhead(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) @@ -260,11 +225,9 @@ bool GossipSelect_npc_mortog_steamhead(Player* pPlayer, Creature* pCreature, uin } return true; } - /*###### ## npc_kayra_longmane ######*/ - enum eKayra { SAY_START = -1000360, @@ -273,24 +236,18 @@ enum eKayra SAY_AMBUSH2 = -1000363, SAY_NEAR_END = -1000364, SAY_END = -1000365, //this is signed for 10646 - QUEST_ESCAPE_FROM = 9752, NPC_SLAVEBINDER = 18042 }; - struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI { npc_kayra_longmaneAI(Creature* c) : npc_escortAI(c) {} - void Reset() { } - void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) return; - switch(i) { case 4: @@ -318,49 +275,39 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI } } }; - bool QuestAccept_npc_kayra_longmane(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_ESCAPE_FROM) { DoScriptText(SAY_START, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmaneAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID()); } return true; } - CreatureAI* GetAI_npc_kayra_longmaneAI(Creature* pCreature) { return new npc_kayra_longmaneAI(pCreature); } - /*###### ## npc_timothy_daniels ######*/ - #define GOSSIP_TIMOTHY_DANIELS_ITEM1 "Specialist, eh? Just what kind of specialist are you, anyway?" #define GOSSIP_TEXT_BROWSE_POISONS "Let me browse your reagents and poison supplies." - enum eTimothy { GOSSIP_TEXTID_TIMOTHY_DANIELS1 = 9239 }; - bool GossipHello_npc_timothy_daniels(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_POISONS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TIMOTHY_DANIELS_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_timothy_daniels(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -372,49 +319,40 @@ bool GossipSelect_npc_timothy_daniels(Player* pPlayer, Creature* pCreature, uint pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break; } - return true; } - /*###### ## AddSC ######*/ - void AddSC_zangarmarsh() { Script *newscript; - newscript = new Script; newscript->Name = "npcs_ashyen_and_keleth"; newscript->pGossipHello = &GossipHello_npcs_ashyen_and_keleth; newscript->pGossipSelect = &GossipSelect_npcs_ashyen_and_keleth; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_cooshcoosh"; newscript->GetAI = &GetAI_npc_cooshcoosh; newscript->pGossipHello = &GossipHello_npc_cooshcoosh; newscript->pGossipSelect = &GossipSelect_npc_cooshcoosh; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_elder_kuruti"; newscript->pGossipHello = &GossipHello_npc_elder_kuruti; newscript->pGossipSelect = &GossipSelect_npc_elder_kuruti; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_mortog_steamhead"; newscript->pGossipHello = &GossipHello_npc_mortog_steamhead; newscript->pGossipSelect = &GossipSelect_npc_mortog_steamhead; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kayra_longmane"; newscript->GetAI = &GetAI_npc_kayra_longmaneAI; newscript->pQuestAccept = &QuestAccept_npc_kayra_longmane; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_timothy_daniels"; newscript->pGossipHello = &GossipHello_npc_timothy_daniels; diff --git a/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp b/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp index 5aa7ecb7f04..ed84c0e2b0c 100644 --- a/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp +++ b/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp @@ -13,33 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Areatrigger_Scripts SD%Complete: 100 SDComment: Scripts for areatriggers SDCategory: Areatrigger EndScriptData */ - /* ContentData at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm EndContentData */ - #include "precompiled.h" - /*##### ## at_legion_teleporter #####*/ - enum eLegionTeleporter { SPELL_TELE_A_TO = 37387, QUEST_GAINING_ACCESS_A = 10589, - SPELL_TELE_H_TO = 37389, QUEST_GAINING_ACCESS_H = 10604 }; - bool AreaTrigger_at_legion_teleporter(Player* pPlayer, AreaTriggerEntry* pAt) { if (pPlayer->isAlive() && !pPlayer->isInCombat()) @@ -49,41 +42,33 @@ bool AreaTrigger_at_legion_teleporter(Player* pPlayer, AreaTriggerEntry* pAt) pPlayer->CastSpell(pPlayer,SPELL_TELE_A_TO,false); return true; } - if (pPlayer->GetTeam()== HORDE && pPlayer->GetQuestRewardStatus(QUEST_GAINING_ACCESS_H)) { pPlayer->CastSpell(pPlayer,SPELL_TELE_H_TO,false); return true; } - return false; } return false; } - enum eRavenholdt { QUEST_MANOR_RAVENHOLDT = 6681, NPC_RAVENHOLDT = 13936 }; - bool AreaTrigger_at_ravenholdt(Player* pPlayer, AreaTriggerEntry* pAt) { if (pPlayer->GetQuestStatus(QUEST_MANOR_RAVENHOLDT) == QUEST_STATUS_INCOMPLETE) pPlayer->KilledMonsterCredit(NPC_RAVENHOLDT, 0); - return false; } - void AddSC_areatrigger_scripts() { Script *newscript; - newscript = new Script; newscript->Name = "at_legion_teleporter"; newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "at_ravenholdt"; newscript->pAreaTrigger = &AreaTrigger_at_ravenholdt; diff --git a/src/bindings/scripts/scripts/world/boss_emeriss.cpp b/src/bindings/scripts/scripts/world/boss_emeriss.cpp index fa53ed89d21..233bbac5fa5 100644 --- a/src/bindings/scripts/scripts/world/boss_emeriss.cpp +++ b/src/bindings/scripts/scripts/world/boss_emeriss.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Emeriss SD%Complete: 90 SDComment: Teleport function & Mark of Nature missing SDCategory: Bosses EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1000401, SAY_CASTCORRUPTION = -1000402, //signed for 6182 - SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, SPELL_TAILSWEEP = 15847, @@ -35,11 +31,9 @@ enum eEnums SPELL_VOLATILEINFECTION = 24928, SPELL_CORRUPTIONOFEARTH = 24910 }; - struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI { boss_emerissAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiSleep_Timer; uint32 m_uiNoxiousBreath_Timer; uint32 m_uiTailSweep_Timer; @@ -47,7 +41,6 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI uint32 m_uiVolatileInfection_Timer; uint32 m_uiCorruptionsCasted; - void Reset() { m_uiSleep_Timer = 15000 + rand()%5000; @@ -57,29 +50,24 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI m_uiVolatileInfection_Timer = 12000; m_uiCorruptionsCasted = 0; } - void Aggro(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; - //Sleep_Timer if (m_uiSleep_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SLEEP); - m_uiSleep_Timer = 8000 + rand()%8000; } else m_uiSleep_Timer -= uiDiff; - //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer < uiDiff) { @@ -88,7 +76,6 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI } else m_uiNoxiousBreath_Timer -= uiDiff; - //Tailsweep every 2 seconds if (m_uiTailSweep_Timer < uiDiff) { @@ -97,7 +84,6 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI } else m_uiTailSweep_Timer -= uiDiff; - //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer < uiDiff) //{ @@ -107,7 +93,6 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI //else // m_uiMarkOfNature_Timer -= uiDiff; - //VolatileInfection_Timer if (m_uiVolatileInfection_Timer < uiDiff) { @@ -116,7 +101,6 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI } else m_uiVolatileInfection_Timer -= uiDiff; - //CorruptionofEarth_Timer //CorruptionofEarth at 75%, 50% and 25% if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) @@ -125,16 +109,13 @@ struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI DoScriptText(SAY_CASTCORRUPTION, m_creature); DoCast(m_creature->getVictim(), SPELL_CORRUPTIONOFEARTH); } - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_emeriss(Creature* pCreature) { return new boss_emerissAI (pCreature); } - void AddSC_boss_emeriss() { Script *newscript; diff --git a/src/bindings/scripts/scripts/world/boss_lethon.cpp b/src/bindings/scripts/scripts/world/boss_lethon.cpp index e387891efed..7b323b256f3 100644 --- a/src/bindings/scripts/scripts/world/boss_lethon.cpp +++ b/src/bindings/scripts/scripts/world/boss_lethon.cpp @@ -13,13 +13,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Lethon SD%Complete: 0 SDComment: Place Holder SDCategory: Bosses EndScriptData */ - #include "precompiled.h" diff --git a/src/bindings/scripts/scripts/world/boss_taerar.cpp b/src/bindings/scripts/scripts/world/boss_taerar.cpp index 6659924c41b..d11da293921 100644 --- a/src/bindings/scripts/scripts/world/boss_taerar.cpp +++ b/src/bindings/scripts/scripts/world/boss_taerar.cpp @@ -13,21 +13,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Taerar SD%Complete: 70 SDComment: Mark of Nature & Teleport NYI. Fix the way to be banished. SDCategory: Bosses EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1000399, //signed for 20021 SAY_SUMMONSHADE = -1000400, //signed for 20021 - //Spells of Taerar SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, @@ -35,25 +31,20 @@ enum eEnums // SPELL_MARKOFNATURE = 25040, // Not working SPELL_ARCANEBLAST = 24857, SPELL_BELLOWINGROAR = 22686, - SPELL_SUMMONSHADE_1 = 24841, SPELL_SUMMONSHADE_2 = 24842, SPELL_SUMMONSHADE_3 = 24843, - //Spells of Shades of Taerar SPELL_POSIONCLOUD = 24840, SPELL_POSIONBREATH = 20667 }; - uint32 m_auiSpellSummonShade[]= { SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3 }; - struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI { boss_taerarAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiSleep_Timer; uint32 m_uiNoxiousBreath_Timer; uint32 m_uiTailSweep_Timer; @@ -62,9 +53,7 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI uint32 m_uiBellowingRoar_Timer; uint32 m_uiShades_Timer; uint32 m_uiShadesSummoned; - bool m_bShades; - void Reset() { m_uiSleep_Timer = 15000 + rand()%5000; @@ -75,21 +64,17 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI m_uiBellowingRoar_Timer = 30000; m_uiShades_Timer = 60000; //The time that Taerar is banished m_uiShadesSummoned = 0; - m_bShades = false; } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void JustSummoned(Creature* pSummoned) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } - void UpdateAI(const uint32 uiDiff) { if (m_bShades && m_uiShades_Timer < uiDiff) @@ -105,22 +90,18 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI //Do nothing while banished return; } - //Return since we have no target if (!UpdateVictim()) return; - //Sleep_Timer if (m_uiSleep_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SLEEP); - m_uiSleep_Timer = 8000 + rand()%7000; } else m_uiSleep_Timer -= uiDiff; - //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer < uiDiff) { @@ -129,7 +110,6 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI } else m_uiNoxiousBreath_Timer -= uiDiff; - //Tailsweep every 2 seconds if (m_uiTailSweep_Timer < uiDiff) { @@ -138,7 +118,6 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI } else m_uiTailSweep_Timer -= uiDiff; - //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer < uiDiff) //{ @@ -147,7 +126,6 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI //} //else // m_uiMarkOfNature_Timer -= uiDiff; - //ArcaneBlast_Timer if (m_uiArcaneBlast_Timer < uiDiff) { @@ -156,7 +134,6 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI } else m_uiArcaneBlast_Timer -= uiDiff; - //BellowingRoar_Timer if (m_uiBellowingRoar_Timer < uiDiff) { @@ -165,7 +142,6 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI } else m_uiBellowingRoar_Timer -= uiDiff; - //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again) if (!m_bShades && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) { @@ -173,47 +149,36 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI { //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); - //horrible workaround, need to fix m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_SUMMONSHADE, m_creature); - int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); - - for(int i = 0; i < iSize; ++i) + for (int i = 0; i < iSize; ++i) m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true); - ++m_uiShadesSummoned; // prevent casting twice at same health m_bShades = true; } m_uiShades_Timer = 60000; } - DoMeleeAttackIfReady(); } }; - // Shades of Taerar Script struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI { boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiPoisonCloud_Timer; uint32 m_uiPosionBreath_Timer; - void Reset() { m_uiPoisonCloud_Timer = 8000; m_uiPosionBreath_Timer = 12000; } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //PoisonCloud_Timer if (m_uiPoisonCloud_Timer < uiDiff) { @@ -222,7 +187,6 @@ struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI } else m_uiPoisonCloud_Timer -= uiDiff; - //PosionBreath_Timer if (m_uiPosionBreath_Timer < uiDiff) { @@ -231,30 +195,24 @@ struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI } else m_uiPosionBreath_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_taerar(Creature* pCreature) { return new boss_taerarAI (pCreature); } - CreatureAI* GetAI_boss_shadeoftaerar(Creature* pCreature) { return new boss_shadeoftaerarAI (pCreature); } - void AddSC_boss_taerar() { Script *newscript; - newscript = new Script; newscript->Name = "boss_taerar"; newscript->GetAI = &GetAI_boss_taerar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_shade_of_taerar"; newscript->GetAI = &GetAI_boss_shadeoftaerar; diff --git a/src/bindings/scripts/scripts/world/boss_ysondre.cpp b/src/bindings/scripts/scripts/world/boss_ysondre.cpp index 2f3948d38d9..fe4d0eb159e 100644 --- a/src/bindings/scripts/scripts/world/boss_ysondre.cpp +++ b/src/bindings/scripts/scripts/world/boss_ysondre.cpp @@ -13,46 +13,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Ysondre SD%Complete: 90 SDComment: Mark of Nature & Teleport missing SDCategory: Bosses EndScriptData */ - #include "precompiled.h" - enum eEnums { SAY_AGGRO = -1000360, //signed for 17969 SAY_SUMMONDRUIDS = -1000361, //signed for 17969 - SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, SPELL_TAILSWEEP = 15847, //SPELL_MARKOFNATURE = 25040, // Not working SPELL_LIGHTNINGWAVE = 24819, SPELL_SUMMONDRUIDS = 24795, - SPELL_SUMMON_PLAYER = 24776, - //druid spells SPELL_MOONFIRE = 21669 }; - // Ysondre script struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI { boss_ysondreAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 m_uiSleep_Timer; uint32 m_uiNoxiousBreath_Timer; uint32 m_uiTailSweep_Timer; //uint32 m_uiMarkOfNature_Timer; uint32 m_uiLightningWave_Timer; uint32 m_uiSummonDruidModifier; - void Reset() { m_uiSleep_Timer = 15000 + rand()%5000; @@ -62,34 +53,28 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI m_uiLightningWave_Timer = 12000; m_uiSummonDruidModifier = 0; } - void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void JustSummoned(Creature* pSummoned) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //Sleep_Timer if (m_uiSleep_Timer < uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SLEEP); - m_uiSleep_Timer = 8000 + rand()%7000; } else m_uiSleep_Timer -= uiDiff; - //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer < uiDiff) { @@ -98,18 +83,15 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI } else m_uiNoxiousBreath_Timer -= uiDiff; - //Tailsweep every 2 seconds if (m_uiTailSweep_Timer < uiDiff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; } else m_uiTailSweep_Timer -= uiDiff; - //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer < uiDiff) //{ @@ -118,51 +100,40 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI //} //else // m_uiMarkOfNature_Timer -= uiDiff; - //LightningWave_Timer if (m_uiLightningWave_Timer < uiDiff) { //Cast LIGHTNINGWAVE on a Random target if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_LIGHTNINGWAVE); - m_uiLightningWave_Timer = 7000 + rand()%5000; } else m_uiLightningWave_Timer -= uiDiff; - //Summon Druids if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) { DoScriptText(SAY_SUMMONDRUIDS, m_creature); - - for(int i = 0; i < 10; ++i) + for (int i = 0; i < 10; ++i) DoCast(m_creature, SPELL_SUMMONDRUIDS, true); - ++m_uiSummonDruidModifier; } - DoMeleeAttackIfReady(); } }; - // Summoned druid script struct TRINITY_DLL_DECL mob_dementeddruidsAI : public ScriptedAI { mob_dementeddruidsAI(Creature *c) : ScriptedAI(c) {} - uint32 m_uiMoonFire_Timer; - void Reset() { m_uiMoonFire_Timer = 3000; } - void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; - //MoonFire_Timer if (m_uiMoonFire_Timer < uiDiff) { @@ -171,30 +142,24 @@ struct TRINITY_DLL_DECL mob_dementeddruidsAI : public ScriptedAI } else m_uiMoonFire_Timer -= uiDiff; - DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_boss_ysondre(Creature* pCreature) { return new boss_ysondreAI (pCreature); } - CreatureAI* GetAI_mob_dementeddruids(Creature* pCreature) { return new mob_dementeddruidsAI (pCreature); } - void AddSC_boss_ysondre() { Script *newscript; - newscript = new Script; newscript->Name = "boss_ysondre"; newscript->GetAI = &GetAI_boss_ysondre; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_dementeddruids"; newscript->GetAI = &GetAI_mob_dementeddruids; diff --git a/src/bindings/scripts/scripts/world/go_scripts.cpp b/src/bindings/scripts/scripts/world/go_scripts.cpp index 668dd513191..05f21918479 100644 --- a/src/bindings/scripts/scripts/world/go_scripts.cpp +++ b/src/bindings/scripts/scripts/world/go_scripts.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: GO_Scripts SD%Complete: 100 SDComment: Quest support: 4285,4287,4288(crystal pylons), 4296, 6481, 10990, 10991, 10992, Field_Repair_Bot->Teaches spell 22704. Barov_journal->Teaches spell 26089 SDCategory: Game Objects EndScriptData */ - /* ContentData go_cat_figurine (the "trap" version of GO, two different exist) go_northern_crystal_pylon @@ -40,28 +38,22 @@ go_tablet_of_the_seven go_tele_to_dalaran_crystal go_tele_to_violet_stand EndContentData */ - #include "precompiled.h" - /*###### ## go_cat_figurine ######*/ - enum eCatFigurine { SPELL_SUMMON_GHOST_SABER = 5968, }; - bool GOHello_go_cat_figurine(Player* pPlayer, GameObject* pGo) { pPlayer->CastSpell(pPlayer,SPELL_SUMMON_GHOST_SABER,true); return false; } - /*###### ## go_crystal_pylons (3x) ######*/ - bool GOHello_go_northern_crystal_pylon(Player* pPlayer, GameObject* pGo) { if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) @@ -69,13 +61,10 @@ bool GOHello_go_northern_crystal_pylon(Player* pPlayer, GameObject* pGo) pPlayer->PrepareQuestMenu(pGo->GetGUID()); pPlayer->SendPreparedQuest(pGo->GetGUID()); } - if (pPlayer->GetQuestStatus(4285) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(4285); - return true; } - bool GOHello_go_eastern_crystal_pylon(Player* pPlayer, GameObject* pGo) { if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) @@ -83,13 +72,10 @@ bool GOHello_go_eastern_crystal_pylon(Player* pPlayer, GameObject* pGo) pPlayer->PrepareQuestMenu(pGo->GetGUID()); pPlayer->SendPreparedQuest(pGo->GetGUID()); } - if (pPlayer->GetQuestStatus(4287) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(4287); - return true; } - bool GOHello_go_western_crystal_pylon(Player* pPlayer, GameObject* pGo) { if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) @@ -97,17 +83,13 @@ bool GOHello_go_western_crystal_pylon(Player* pPlayer, GameObject* pGo) pPlayer->PrepareQuestMenu(pGo->GetGUID()); pPlayer->SendPreparedQuest(pGo->GetGUID()); } - if (pPlayer->GetQuestStatus(4288) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(4288); - return true; } - /*###### ## go_barov_journal ######*/ - bool GOHello_go_barov_journal(Player* pPlayer, GameObject* pGo) { if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !pPlayer->HasSpell(26086)) @@ -116,11 +98,9 @@ bool GOHello_go_barov_journal(Player* pPlayer, GameObject* pGo) } return true; } - /*###### ## go_field_repair_bot_74A ######*/ - bool GOHello_go_field_repair_bot_74A(Player* pPlayer, GameObject* pGo) { if (pPlayer->HasSkill(SKILL_ENGINERING) && pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 300 && !pPlayer->HasSpell(22704)) @@ -129,41 +109,32 @@ bool GOHello_go_field_repair_bot_74A(Player* pPlayer, GameObject* pGo) } return true; } - /*###### ## go_gilded_brazier ######*/ - enum eGildedBrazier { NPC_STILLBLADE = 17716, }; - bool GOHello_go_gilded_brazier(Player* pPlayer, GameObject* pGO) { if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) if (Creature* pCreature = pPlayer->SummonCreature(NPC_STILLBLADE, 8087.632, -7542.740, 151.568, 0.122, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) pCreature->AI()->AttackStart(pPlayer); - return true; } - /*###### ## go_orb_of_command ######*/ - bool GOHello_go_orb_of_command(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestRewardStatus(7761)) pPlayer->CastSpell(pPlayer,23460,true); - return true; } - /*###### ## go_tablet_of_madness ######*/ - bool GOHello_go_tablet_of_madness(Player* pPlayer, GameObject* pGo) { if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetSkillValue(SKILL_ALCHEMY) >= 300 && !pPlayer->HasSpell(24266)) @@ -172,39 +143,30 @@ bool GOHello_go_tablet_of_madness(Player* pPlayer, GameObject* pGo) } return true; } - /*###### ## go_tablet_of_the_seven ######*/ - //TODO: use gossip option ("Transcript the Tablet") instead, if Trinity adds support. bool GOHello_go_tablet_of_the_seven(Player* pPlayer, GameObject* pGo) { if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) return true; - if (pPlayer->GetQuestStatus(4296) == QUEST_STATUS_INCOMPLETE) pPlayer->CastSpell(pPlayer,15065,false); - return true; } - /*##### ## go_jump_a_tron ######*/ - bool GOHello_go_jump_a_tron(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(10111) == QUEST_STATUS_INCOMPLETE) pPlayer->CastSpell(pPlayer,33382,true); - return true; } - /*###### ## go_ethereum_prison ######*/ - enum eEthereumPrison { SPELL_REP_LC = 39456, @@ -214,17 +176,14 @@ enum eEthereumPrison SPELL_REP_KT = 39475, SPELL_REP_SPOR = 39476 }; - const uint32 NpcPrisonEntry[] = { 22810, 22811, 22812, 22813, 22814, 22815, //good guys 20783, 20784, 20785, 20786, 20788, 20789, 20790 //bad guys }; - bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) { int Random = rand() % (sizeof(NpcPrisonEntry) / sizeof(uint32)); - if (Creature* pCreature = pPlayer->SummonCreature(NpcPrisonEntry[Random], pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) @@ -232,7 +191,6 @@ bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) if (!pCreature->IsHostileTo(pPlayer)) { uint32 Spell = 0; - if (FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry()) { switch(pFaction->faction) @@ -244,7 +202,6 @@ bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) case 989: Spell = SPELL_REP_KT; break; case 970: Spell = SPELL_REP_SPOR; break; } - if (Spell) pCreature->CastSpell(pPlayer, Spell, false); else @@ -252,65 +209,49 @@ bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) } } } - return false; } - /*###### ## go_ethereum_stasis ######*/ - const uint32 NpcStasisEntry[] = { 22825, 20888, 22827, 22826, 22828 }; - bool GOHello_go_ethereum_stasis(Player* pPlayer, GameObject* pGo) { int Random = rand() % (sizeof(NpcStasisEntry) / sizeof(uint32)); - pPlayer->SummonCreature(NpcStasisEntry[Random], pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - return false; } - /*###### ## go_resonite_cask ######*/ - enum eResoniteCask { NPC_GOGGEROC = 11920 }; - bool GOHello_go_resonite_cask(Player* pPlayer, GameObject* pGO) { if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) pGO->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); - return false; } - /*###### ## go_sacred_fire_of_life ######*/ - #define NPC_ARIKARA 10882 - bool GOHello_go_sacred_fire_of_life(Player* pPlayer, GameObject* pGO) { if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) pPlayer->SummonCreature(NPC_ARIKARA, -5008.338, -2118.894, 83.657, 0.874, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - return true; } - /*###### ## go_shrine_of_the_birds ######*/ - enum eShrineOfTheBirds { NPC_HAWK_GUARD = 22992, @@ -320,14 +261,11 @@ enum eShrineOfTheBirds GO_SHRINE_EAGLE = 185547, GO_SHRINE_FALCON = 185553 }; - bool GOHello_go_shrine_of_the_birds(Player* pPlayer, GameObject* pGo) { uint32 BirdEntry = 0; - float fX, fY, fZ; pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectSize(), INTERACTION_DISTANCE); - switch(pGo->GetEntry()) { case GO_SHRINE_HAWK: @@ -340,96 +278,73 @@ bool GOHello_go_shrine_of_the_birds(Player* pPlayer, GameObject* pGo) BirdEntry = NPC_FALCON_GUARD; break; } - if (BirdEntry) pPlayer->SummonCreature(BirdEntry, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - return false; } - /*###### ## go_southfury_moonstone ######*/ - enum eSouthfury { NPC_RIZZLE = 23002, SPELL_BLACKJACK = 39865, //stuns player SPELL_SUMMON_RIZZLE = 39866 - }; - bool GOHello_go_southfury_moonstone(Player* pPlayer, GameObject* pGo) { //implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose //pPlayer->CastSpell(pPlayer,SPELL_SUMMON_RIZZLE,false); - if (Creature* pCreature = pPlayer->SummonCreature(NPC_RIZZLE, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0)) pCreature->CastSpell(pPlayer,SPELL_BLACKJACK,false); - return false; } - /*###### ## go_tele_to_dalaran_crystal ######*/ - enum eDalaranCrystal { QUEST_LEARN_LEAVE_RETURN = 12790, QUEST_TELE_CRYSTAL_FLAG = 12845 }; - bool GOHello_go_tele_to_dalaran_crystal(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG)) return false; - //TODO: must send error message (what kind of message? On-screen?) return true; } - /*###### ## go_tele_to_violet_stand ######*/ - bool GOHello_go_tele_to_violet_stand(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestRewardStatus(QUEST_LEARN_LEAVE_RETURN) || pPlayer->GetQuestStatus(QUEST_LEARN_LEAVE_RETURN) == QUEST_STATUS_INCOMPLETE) return false; - return true; } - /*###### ## go_fel_crystalforge ######*/ - #define GOSSIP_FEL_CRYSTALFORGE_TEXT 31000 #define GOSSIP_FEL_CRYSTALFORGE_ITEM_TEXT_RETURN 31001 #define GOSSIP_FEL_CRYSTALFORGE_ITEM_1 "Purchase 1 Unstable Flask of the Beast for the cost of 10 Apexis Shards" #define GOSSIP_FEL_CRYSTALFORGE_ITEM_5 "Purchase 5 Unstable Flask of the Beast for the cost of 50 Apexis Shards" #define GOSSIP_FEL_CRYSTALFORGE_ITEM_RETURN "Use the fel crystalforge to make another purchase." - enum eFelCrystalforge { SPELL_CREATE_1_FLASK_OF_BEAST = 40964, SPELL_CREATE_5_FLASK_OF_BEAST = 40965, }; - bool GOHello_go_fel_crystalforge(Player* pPlayer, GameObject* pGO) { if ( pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER ) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ pPlayer->PrepareQuestMenu(pGO->GetGUID()); /* return true*/ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_TEXT, pGO->GetGUID()); - return true; } - bool GOSelect_go_fel_crystalforge(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -452,23 +367,19 @@ bool GOSelect_go_fel_crystalforge(Player* pPlayer, GameObject* pGO, uint32 uiSen } return true; } - /*###### ## go_bashir_crystalforge ######*/ - enum eBashirCrystalforge { SPELL_CREATE_1_FLASK_OF_SORCERER = 40968, SPELL_CREATE_5_FLASK_OF_SORCERER = 40970, }; - bool GOHello_go_bashir_crystalforge(Player* pPlayer, GameObject* pGO) { pPlayer->CastSpell(pPlayer,SPELL_CREATE_1_FLASK_OF_SORCERER,false); return false; } - bool GOHello_go_wg2voa_portal(Player* pPlayer, GameObject* pGO) { // teleport player inside VoA if faction controls WG, core has already set faction for this GO @@ -476,11 +387,9 @@ bool GOHello_go_wg2voa_portal(Player* pPlayer, GameObject* pGO) pPlayer->SetPvP(false); return false; } - /*###### ## matrix_punchograph ######*/ - enum eMatrixPunchograph { ITEM_WHITE_PUNCH_CARD = 9279, @@ -497,7 +406,6 @@ enum eMatrixPunchograph MATRIX_PUNCHOGRAPH_3005_C = 142476, MATRIX_PUNCHOGRAPH_3005_D = 142696, }; - bool GOHello_go_matrix_punchograph(Player* pPlayer, GameObject* pGo) { switch(pGo->GetEntry()) @@ -535,122 +443,98 @@ bool GOHello_go_matrix_punchograph(Player* pPlayer, GameObject* pGo) } return false; } - void AddSC_go_scripts() { Script *newscript; - newscript = new Script; newscript->Name = "go_cat_figurine"; newscript->pGOHello = &GOHello_go_cat_figurine; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_northern_crystal_pylon"; newscript->pGOHello = &GOHello_go_northern_crystal_pylon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_eastern_crystal_pylon"; newscript->pGOHello = &GOHello_go_eastern_crystal_pylon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_western_crystal_pylon"; newscript->pGOHello = &GOHello_go_western_crystal_pylon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_barov_journal"; newscript->pGOHello = &GOHello_go_barov_journal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_field_repair_bot_74A"; newscript->pGOHello = &GOHello_go_field_repair_bot_74A; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_gilded_brazier"; newscript->pGOHello = &GOHello_go_gilded_brazier; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_orb_of_command"; newscript->pGOHello = &GOHello_go_orb_of_command; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_shrine_of_the_birds"; newscript->pGOHello = &GOHello_go_shrine_of_the_birds; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_southfury_moonstone"; newscript->pGOHello = &GOHello_go_southfury_moonstone; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_tablet_of_madness"; newscript->pGOHello = &GOHello_go_tablet_of_madness; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_tablet_of_the_seven"; newscript->pGOHello = &GOHello_go_tablet_of_the_seven; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_jump_a_tron"; newscript->pGOHello = &GOHello_go_jump_a_tron; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_ethereum_prison"; newscript->pGOHello = &GOHello_go_ethereum_prison; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_ethereum_stasis"; newscript->pGOHello = &GOHello_go_ethereum_stasis; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_resonite_cask"; newscript->pGOHello = &GOHello_go_resonite_cask; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_sacred_fire_of_life"; newscript->pGOHello = &GOHello_go_sacred_fire_of_life; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_tele_to_dalaran_crystal"; newscript->pGOHello = &GOHello_go_tele_to_dalaran_crystal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_tele_to_violet_stand"; newscript->pGOHello = &GOHello_go_tele_to_violet_stand; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_fel_crystalforge"; newscript->pGOHello = &GOHello_go_fel_crystalforge; newscript->pGOSelect = &GOSelect_go_fel_crystalforge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_bashir_crystalforge"; newscript->pGOHello = &GOHello_go_bashir_crystalforge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_wg2voa_portal"; newscript->pGOHello = &GOHello_go_wg2voa_portal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "go_matrix_punchograph"; newscript->pGOHello = &GOHello_go_matrix_punchograph; diff --git a/src/bindings/scripts/scripts/world/guards.cpp b/src/bindings/scripts/scripts/world/guards.cpp index ead30387b18..218e6fc489a 100644 --- a/src/bindings/scripts/scripts/world/guards.cpp +++ b/src/bindings/scripts/scripts/world/guards.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Guards SD%Complete: 100 SDComment: All Guard gossip data, quite some npc_text-id's still missing, adding constantly as new id's are known. CombatAI should be organized better for future. SDCategory: Guards EndScriptData */ - /* ContentData guard_azuremyst guard_bluffwatcher @@ -44,19 +42,15 @@ guard_teldrassil guard_tirisfal guard_undercity EndContentData */ - #include "precompiled.h" #include "guard_ai.h" - //script spesific action #define GOSSIP_ACTION_TAVERN 101 #define GOSSIP_ACTION_GEMMERCHANT 102 #define GOSSIP_ACTION_MANALOOM 103 - //script spesific sender #define GOSSIP_SENDER_SEC_GEMMERCHANT 101 #define GOSSIP_SENDER_SEC_AUCTIONHOUSE 102 - //script spesific gossip text #define GOSSIP_TEXT_TAVERN "Worlds End Tavern" #define GOSSIP_TEXT_BANKSCYERS "Scyers bank" @@ -73,17 +67,13 @@ EndContentData */ #define GOSSIP_TEXT_GEMMERCHANT "Gem Merchant" #define GOSSIP_TEXT_GEMSCYERS "Scyers Gem Merchant" #define GOSSIP_TEXT_GEMALDOR "Aldor Gem Merchant" - #define GOSSIP_TEXT_AH_SILVERMOON_1 "Western Auction House" #define GOSSIP_TEXT_AH_SILVERMOON_2 "Royal Exchange Auction House" - #define GOSSIP_TEXT_INN_SILVERMOON_1 "Silvermoon City Inn" #define GOSSIP_TEXT_INN_SILVERMOON_2 "Wayfarer's Rest tavern" - /******************************************************* * guard_azuremyst start *******************************************************/ - bool GossipHello_guard_azuremyst(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -96,7 +86,6 @@ bool GossipHello_guard_azuremyst(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10066, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -150,7 +139,6 @@ void SendDefaultMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendClassTrainerMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -185,7 +173,6 @@ void SendClassTrainerMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -247,7 +234,6 @@ void SendProfTrainerMenu_guard_azuremyst(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -258,20 +244,16 @@ bool GossipSelect_guard_azuremyst(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_azuremyst end *******************************************************/ - CreatureAI* GetAI_guard_azuremyst(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_bluffwatcher start *******************************************************/ - bool GossipHello_guard_bluffwatcher(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -288,7 +270,6 @@ bool GossipHello_guard_bluffwatcher(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(3543, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -357,7 +338,6 @@ void SendDefaultMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, ui break; } } - void SendBattleMasterMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -376,7 +356,6 @@ void SendBattleMasterMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreatur break; } } - void SendClassTrainerMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -407,7 +386,6 @@ void SendClassTrainerMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreatur break; } } - void SendProfTrainerMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -462,7 +440,6 @@ void SendProfTrainerMenu_guard_bluffwatcher(Player* pPlayer, Creature* pCreature break; } } - bool GossipSelect_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -474,20 +451,16 @@ bool GossipSelect_guard_bluffwatcher(Player* pPlayer, Creature* pCreature, uint3 } return true; } - /******************************************************* * guard_bluffwatcher end *******************************************************/ - CreatureAI* GetAI_guard_bluffwatcher(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_contested start *******************************************************/ - CreatureAI* GetAI_guard_contested(Creature* pCreature) { return new guardAI (pCreature); @@ -495,11 +468,9 @@ CreatureAI* GetAI_guard_contested(Creature* pCreature) /******************************************************* * guard_contested end *******************************************************/ - /******************************************************* * guard_darnassus start *******************************************************/ - bool GossipHello_guard_darnassus(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_AUCTIONHOUSE , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -516,7 +487,6 @@ bool GossipHello_guard_darnassus(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(3016, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -582,7 +552,6 @@ void SendDefaultMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBattleMasterMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -601,7 +570,6 @@ void SendBattleMasterMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -628,7 +596,6 @@ void SendClassTrainerMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -675,7 +642,6 @@ void SendProfTrainerMenu_guard_darnassus(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -687,20 +653,16 @@ bool GossipSelect_guard_darnassus(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_darnassus end *******************************************************/ - CreatureAI* GetAI_guard_darnassus(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_dunmorogh start *******************************************************/ - bool GossipHello_guard_dunmorogh(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -711,10 +673,8 @@ bool GossipHello_guard_dunmorogh(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_CLASSTRAINER , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_PROFTRAINER , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); pPlayer->SEND_GOSSIP_MENU(4287, pCreature->GetGUID()); - return true; } - void SendDefaultMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -764,7 +724,6 @@ void SendDefaultMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendClassTrainerMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -799,7 +758,6 @@ void SendClassTrainerMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -851,7 +809,6 @@ void SendProfTrainerMenu_guard_dunmorogh(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -862,20 +819,16 @@ bool GossipSelect_guard_dunmorogh(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_dunmorogh end *******************************************************/ - CreatureAI* GetAI_guard_dunmorogh(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_durotar start *******************************************************/ - bool GossipHello_guard_durotar(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -887,7 +840,6 @@ bool GossipHello_guard_durotar(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(4037, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -934,7 +886,6 @@ void SendDefaultMenu_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 break; } } - void SendClassTrainerMenu_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -969,7 +920,6 @@ void SendClassTrainerMenu_guard_durotar(Player* pPlayer, Creature* pCreature, ui break; } } - void SendProfTrainerMenu_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1019,7 +969,6 @@ void SendProfTrainerMenu_guard_durotar(Player* pPlayer, Creature* pCreature, uin break; } } - bool GossipSelect_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -1030,20 +979,16 @@ bool GossipSelect_guard_durotar(Player* pPlayer, Creature* pCreature, uint32 uiS } return true; } - /******************************************************* * guard_durotar end *******************************************************/ - CreatureAI* GetAI_guard_durotar(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_elwynnforest start *******************************************************/ - bool GossipHello_guard_elwynnforest(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -1056,7 +1001,6 @@ bool GossipHello_guard_elwynnforest(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(933, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1106,7 +1050,6 @@ void SendDefaultMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreature, ui break; } } - void SendClassTrainerMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1143,7 +1086,6 @@ void SendClassTrainerMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreatur break; } } - void SendProfTrainerMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1199,7 +1141,6 @@ void SendProfTrainerMenu_guard_elwynnforest(Player* pPlayer, Creature* pCreature break; } } - bool GossipSelect_guard_elwynnforest(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -1210,20 +1151,16 @@ bool GossipSelect_guard_elwynnforest(Player* pPlayer, Creature* pCreature, uint3 } return true; } - /******************************************************* * guard_elwynnforest end *******************************************************/ - CreatureAI* GetAI_guard_elwynnforest(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_eversong start *******************************************************/ - bool GossipHello_guard_eversong(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BATHANDLER , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -1235,7 +1172,6 @@ bool GossipHello_guard_eversong(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10180, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1283,7 +1219,6 @@ void SendDefaultMenu_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 break; } } - void SendClassTrainerMenu_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1317,7 +1252,6 @@ void SendClassTrainerMenu_guard_eversong(Player* pPlayer, Creature* pCreature, u break; } } - void SendProfTrainerMenu_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1373,7 +1307,6 @@ void SendProfTrainerMenu_guard_eversong(Player* pPlayer, Creature* pCreature, ui break; } } - bool GossipSelect_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -1384,20 +1317,16 @@ bool GossipSelect_guard_eversong(Player* pPlayer, Creature* pCreature, uint32 ui } return true; } - /******************************************************* * guard_eversong end *******************************************************/ - CreatureAI* GetAI_guard_eversong(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_exodar start *******************************************************/ - bool GossipHello_guard_exodar(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_AUCTIONHOUSE , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -1414,7 +1343,6 @@ bool GossipHello_guard_exodar(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(9551, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1488,7 +1416,6 @@ void SendDefaultMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 u break; } } - void SendBattleMasterMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1515,7 +1442,6 @@ void SendBattleMasterMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uin break; } } - void SendClassTrainerMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1550,7 +1476,6 @@ void SendClassTrainerMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uin break; } } - void SendProfTrainerMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1613,7 +1538,6 @@ void SendProfTrainerMenu_guard_exodar(Player* pPlayer, Creature* pCreature, uint break; } } - bool GossipSelect_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -1625,20 +1549,16 @@ bool GossipSelect_guard_exodar(Player* pPlayer, Creature* pCreature, uint32 uiSe } return true; } - /******************************************************* * guard_exodar end *******************************************************/ - CreatureAI* GetAI_guard_exodar(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_ironforge start *******************************************************/ - bool GossipHello_guard_ironforge(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_AUCTIONHOUSE , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -1656,7 +1576,6 @@ bool GossipHello_guard_ironforge(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(2760, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1732,7 +1651,6 @@ void SendDefaultMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBattleMasterMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1751,7 +1669,6 @@ void SendBattleMasterMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1791,7 +1708,6 @@ void SendClassTrainerMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1850,7 +1766,6 @@ void SendProfTrainerMenu_guard_ironforge(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -1862,20 +1777,16 @@ bool GossipSelect_guard_ironforge(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_ironforge end *******************************************************/ - CreatureAI* GetAI_guard_ironforge(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_mulgore start *******************************************************/ - bool GossipHello_guard_mulgore(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -1887,7 +1798,6 @@ bool GossipHello_guard_mulgore(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(3543, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1930,7 +1840,6 @@ void SendDefaultMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 break; } } - void SendClassTrainerMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -1953,7 +1862,6 @@ void SendClassTrainerMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, ui break; } } - void SendProfTrainerMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2001,7 +1909,6 @@ void SendProfTrainerMenu_guard_mulgore(Player* pPlayer, Creature* pCreature, uin break; } } - bool GossipSelect_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -2012,20 +1919,16 @@ bool GossipSelect_guard_mulgore(Player* pPlayer, Creature* pCreature, uint32 uiS } return true; } - /******************************************************* * guard_mulgore end *******************************************************/ - CreatureAI* GetAI_guard_mulgore(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_orgrimmar start *******************************************************/ - bool GossipHello_guard_orgrimmar(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -2042,10 +1945,8 @@ bool GossipHello_guard_orgrimmar(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_CLASSTRAINER , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_PROFTRAINER , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); pPlayer->SEND_GOSSIP_MENU(2593, pCreature->GetGUID()); - return true; } - void SendDefaultMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2125,7 +2026,6 @@ void SendDefaultMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBattleMasterMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2144,7 +2044,6 @@ void SendBattleMasterMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2183,7 +2082,6 @@ void SendClassTrainerMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2242,7 +2140,6 @@ void SendProfTrainerMenu_guard_orgrimmar(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -2254,20 +2151,16 @@ bool GossipSelect_guard_orgrimmar(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_orgrimmar end *******************************************************/ - CreatureAI* GetAI_guard_orgrimmar(Creature* pCreature) { return new guardAI_orgrimmar (pCreature); } - /******************************************************* * guard_shattrath start *******************************************************/ - bool GossipHello_guard_shattrath(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_TAVERN , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -2282,10 +2175,8 @@ bool GossipHello_guard_shattrath(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_ALCHEMYLAB , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_GEMMERCHANT , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); pPlayer->SEND_GOSSIP_MENU(10321, pCreature->GetGUID()); - return true; } - void SendDefaultMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2352,7 +2243,6 @@ void SendDefaultMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBankMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -2366,7 +2256,6 @@ void SendBankMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 u pPlayer->SEND_GOSSIP_MENU(10381, pCreature->GetGUID()); } } - void SendInnMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -2380,7 +2269,6 @@ void SendInnMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 ui pPlayer->SEND_GOSSIP_MENU(10384, pCreature->GetGUID()); } } - void SendMailboxMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2403,7 +2291,6 @@ void SendMailboxMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendStableMasterMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -2417,7 +2304,6 @@ void SendStableMasterMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, pPlayer->SEND_GOSSIP_MENU(10321, pCreature->GetGUID()); } } - void SendBattleMasterMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2436,7 +2322,6 @@ void SendBattleMasterMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2475,7 +2360,6 @@ void SendProfTrainerMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, u break; } } - void SendGemMerchantMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -2489,7 +2373,6 @@ void SendGemMerchantMenu_guard_shattrath(Player* pPlayer, Creature* pCreature, u pPlayer->SEND_GOSSIP_MENU(10699, pCreature->GetGUID()); } } - bool GossipSelect_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -2505,34 +2388,27 @@ bool GossipSelect_guard_shattrath(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_shattrath end *******************************************************/ - CreatureAI* GetAI_guard_shattrath(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_shattrath_aldor *******************************************************/ - #define SPELL_BANISHED_SHATTRATH_A 36642 #define SPELL_BANISHED_SHATTRATH_S 36671 #define SPELL_BANISH_TELEPORT 36643 #define SPELL_EXILE 39533 - struct TRINITY_DLL_DECL guard_shattrath_aldorAI : public guardAI { guard_shattrath_aldorAI(Creature *c) : guardAI(c) {} - uint32 Exile_Timer; uint32 Banish_Timer; uint64 PlayerGUID; bool CanTeleport; - void Reset() { Banish_Timer = 5000; @@ -2540,14 +2416,11 @@ struct TRINITY_DLL_DECL guard_shattrath_aldorAI : public guardAI PlayerGUID = 0; CanTeleport = false; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CanTeleport) { if (Exile_Timer < diff) @@ -2574,11 +2447,9 @@ struct TRINITY_DLL_DECL guard_shattrath_aldorAI : public guardAI CanTeleport = true; } }else Banish_Timer -= diff; - DoMeleeAttackIfReady(); } }; - bool GossipHello_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_TAVERN , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -2595,7 +2466,6 @@ bool GossipHello_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10524, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2656,7 +2526,6 @@ void SendDefaultMenu_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2695,7 +2564,6 @@ void SendProfTrainerMenu_guard_shattrath_aldor(Player* pPlayer, Creature* pCreat break; } } - bool GossipSelect_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -2706,29 +2574,23 @@ bool GossipSelect_guard_shattrath_aldor(Player* pPlayer, Creature* pCreature, ui } return true; } - /******************************************************* * guard_shattrath_aldor end *******************************************************/ - CreatureAI* GetAI_guard_shattrath_aldor(Creature* pCreature) { return new guard_shattrath_aldorAI (pCreature); } - /******************************************************* * guard_shattrath_scryer *******************************************************/ - struct TRINITY_DLL_DECL guard_shattrath_scryerAI : public guardAI { guard_shattrath_scryerAI(Creature *c) : guardAI(c) {} - uint32 Exile_Timer; uint32 Banish_Timer; uint64 PlayerGUID; bool CanTeleport; - void Reset() { Banish_Timer = 5000; @@ -2736,14 +2598,11 @@ struct TRINITY_DLL_DECL guard_shattrath_scryerAI : public guardAI PlayerGUID = 0; CanTeleport = false; } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (CanTeleport) { if (Exile_Timer < diff) @@ -2770,11 +2629,9 @@ struct TRINITY_DLL_DECL guard_shattrath_scryerAI : public guardAI CanTeleport = true; } }else Banish_Timer -= diff; - DoMeleeAttackIfReady(); } }; - bool GossipHello_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_TAVERN , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -2791,7 +2648,6 @@ bool GossipHello_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(10430, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2851,7 +2707,6 @@ void SendDefaultMenu_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature break; } } - void SendProfTrainerMenu_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -2890,7 +2745,6 @@ void SendProfTrainerMenu_guard_shattrath_scryer(Player* pPlayer, Creature* pCrea break; } } - bool GossipSelect_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -2901,20 +2755,16 @@ bool GossipSelect_guard_shattrath_scryer(Player* pPlayer, Creature* pCreature, u } return true; } - /******************************************************* * guard_shattrath_scryer end *******************************************************/ - CreatureAI* GetAI_guard_shattrath_scryer(Creature* pCreature) { return new guard_shattrath_scryerAI (pCreature); } - /******************************************************* * guard_silvermoon start *******************************************************/ - bool GossipHello_guard_silvermoon(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_AUCTIONHOUSE , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -2931,7 +2781,6 @@ bool GossipHello_guard_silvermoon(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(9316, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3007,7 +2856,6 @@ void SendDefaultMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint break; } } - void SendAuctionhouseMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -3021,7 +2869,6 @@ void SendAuctionhouseMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, pPlayer->SEND_GOSSIP_MENU(9319, pCreature->GetGUID()); } } - void SendInnMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) @@ -3035,7 +2882,6 @@ void SendInnMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 u pPlayer->SEND_GOSSIP_MENU(9603, pCreature->GetGUID()); } } - void SendBattleMasterMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3062,7 +2908,6 @@ void SendBattleMasterMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3097,7 +2942,6 @@ void SendClassTrainerMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3160,7 +3004,6 @@ void SendProfTrainerMenu_guard_silvermoon(Player* pPlayer, Creature* pCreature, break; } } - bool GossipSelect_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -3174,20 +3017,16 @@ bool GossipSelect_guard_silvermoon(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /******************************************************* * guard_silvermoon end *******************************************************/ - CreatureAI* GetAI_guard_silvermoon(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_stormwind start *******************************************************/ - bool GossipHello_guard_stormwind(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_AUCTIONHOUSE , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -3206,7 +3045,6 @@ bool GossipHello_guard_stormwind(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(933, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3287,7 +3125,6 @@ void SendDefaultMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBattleMasterMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3306,7 +3143,6 @@ void SendBattleMasterMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3350,7 +3186,6 @@ void SendClassTrainerMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3409,7 +3244,6 @@ void SendProfTrainerMenu_guard_stormwind(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -3421,20 +3255,16 @@ bool GossipSelect_guard_stormwind(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_stormwind end *******************************************************/ - CreatureAI* GetAI_guard_stormwind(Creature* pCreature) { return new guardAI_stormwind (pCreature); } - /******************************************************* * guard_teldrassil start *******************************************************/ - bool GossipHello_guard_teldrassil(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -3447,7 +3277,6 @@ bool GossipHello_guard_teldrassil(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(4316, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3492,7 +3321,6 @@ void SendDefaultMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint break; } } - void SendClassTrainerMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3519,7 +3347,6 @@ void SendClassTrainerMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3563,7 +3390,6 @@ void SendProfTrainerMenu_guard_teldrassil(Player* pPlayer, Creature* pCreature, break; } } - bool GossipSelect_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -3574,20 +3400,16 @@ bool GossipSelect_guard_teldrassil(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /******************************************************* * guard_teldrassil end *******************************************************/ - CreatureAI* GetAI_guard_teldrassil(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_tirisfal start *******************************************************/ - bool GossipHello_guard_tirisfal(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -3599,7 +3421,6 @@ bool GossipHello_guard_tirisfal(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(4097, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3644,7 +3465,6 @@ void SendDefaultMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 break; } } - void SendClassTrainerMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3671,7 +3491,6 @@ void SendClassTrainerMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, u break; } } - void SendProfTrainerMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3725,7 +3544,6 @@ void SendProfTrainerMenu_guard_tirisfal(Player* pPlayer, Creature* pCreature, ui break; } } - bool GossipSelect_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -3736,20 +3554,16 @@ bool GossipSelect_guard_tirisfal(Player* pPlayer, Creature* pCreature, uint32 ui } return true; } - /******************************************************* * guard_tirisfal end *******************************************************/ - CreatureAI* GetAI_guard_tirisfal(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * guard_undercity start *******************************************************/ - bool GossipHello_guard_undercity(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_BANK , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -3767,7 +3581,6 @@ bool GossipHello_guard_undercity(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(3543, pCreature->GetGUID()); return true; } - void SendDefaultMenu_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3839,7 +3652,6 @@ void SendDefaultMenu_guard_undercity(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendBattleMasterMenu_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3858,7 +3670,6 @@ void SendBattleMasterMenu_guard_undercity(Player* pPlayer, Creature* pCreature, break; } } - void SendClassTrainerMenu_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3885,7 +3696,6 @@ void SendClassTrainerMenu_guard_undercity(Player* pPlayer, Creature* pCreature, break; } } - void SendProfTrainerMenu_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch (uiAction) @@ -3940,7 +3750,6 @@ void SendProfTrainerMenu_guard_undercity(Player* pPlayer, Creature* pCreature, u break; } } - bool GossipSelect_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch (uiSender) @@ -3952,155 +3761,131 @@ bool GossipSelect_guard_undercity(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /******************************************************* * guard_undercity end *******************************************************/ - CreatureAI* GetAI_guard_undercity(Creature* pCreature) { return new guardAI (pCreature); } - /******************************************************* * AddSC *******************************************************/ - void AddSC_guards() { Script *newscript; - newscript = new Script; newscript->Name = "guard_azuremyst"; newscript->pGossipHello = &GossipHello_guard_azuremyst; newscript->pGossipSelect = &GossipSelect_guard_azuremyst; newscript->GetAI = &GetAI_guard_azuremyst; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_bluffwatcher"; newscript->pGossipHello = &GossipHello_guard_bluffwatcher; newscript->pGossipSelect = &GossipSelect_guard_bluffwatcher; newscript->GetAI = &GetAI_guard_bluffwatcher; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_contested"; newscript->GetAI = &GetAI_guard_contested; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_darnassus"; newscript->pGossipHello = &GossipHello_guard_darnassus; newscript->pGossipSelect = &GossipSelect_guard_darnassus; newscript->GetAI = &GetAI_guard_darnassus; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_dunmorogh"; newscript->pGossipHello = &GossipHello_guard_dunmorogh; newscript->pGossipSelect = &GossipSelect_guard_dunmorogh; newscript->GetAI = &GetAI_guard_dunmorogh; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_durotar"; newscript->pGossipHello = &GossipHello_guard_durotar; newscript->pGossipSelect = &GossipSelect_guard_durotar; newscript->GetAI = &GetAI_guard_durotar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_elwynnforest"; newscript->pGossipHello = &GossipHello_guard_elwynnforest; newscript->pGossipSelect = &GossipSelect_guard_elwynnforest; newscript->GetAI = &GetAI_guard_elwynnforest; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_eversong"; newscript->pGossipHello = &GossipHello_guard_eversong; newscript->pGossipSelect = &GossipSelect_guard_eversong; newscript->GetAI = &GetAI_guard_eversong; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_exodar"; newscript->pGossipHello = &GossipHello_guard_exodar; newscript->pGossipSelect = &GossipSelect_guard_exodar; newscript->GetAI = &GetAI_guard_exodar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_ironforge"; newscript->pGossipHello = &GossipHello_guard_ironforge; newscript->pGossipSelect = &GossipSelect_guard_ironforge; newscript->GetAI = &GetAI_guard_ironforge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_mulgore"; newscript->pGossipHello = &GossipHello_guard_mulgore; newscript->pGossipSelect = &GossipSelect_guard_mulgore; newscript->GetAI = &GetAI_guard_mulgore; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_orgrimmar"; newscript->pGossipHello = &GossipHello_guard_orgrimmar; newscript->pGossipSelect = &GossipSelect_guard_orgrimmar; newscript->GetAI = &GetAI_guard_orgrimmar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_shattrath"; newscript->pGossipHello = &GossipHello_guard_shattrath; newscript->pGossipSelect = &GossipSelect_guard_shattrath; newscript->GetAI = &GetAI_guard_shattrath; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_shattrath_aldor"; newscript->GetAI = &GetAI_guard_shattrath_aldor; newscript->pGossipHello = &GossipHello_guard_shattrath_aldor; newscript->pGossipSelect = &GossipSelect_guard_shattrath_aldor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_shattrath_scryer"; newscript->GetAI = &GetAI_guard_shattrath_scryer; newscript->pGossipHello = &GossipHello_guard_shattrath_scryer; newscript->pGossipSelect = &GossipSelect_guard_shattrath_scryer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_silvermoon"; newscript->pGossipHello = &GossipHello_guard_silvermoon; newscript->pGossipSelect = &GossipSelect_guard_silvermoon; newscript->GetAI = &GetAI_guard_silvermoon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_stormwind"; newscript->pGossipHello = &GossipHello_guard_stormwind; newscript->pGossipSelect = &GossipSelect_guard_stormwind; newscript->GetAI = &GetAI_guard_stormwind; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_teldrassil"; newscript->pGossipHello = &GossipHello_guard_teldrassil; newscript->pGossipSelect = &GossipSelect_guard_teldrassil; newscript->GetAI = &GetAI_guard_teldrassil; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_tirisfal"; newscript->pGossipHello = &GossipHello_guard_tirisfal; newscript->pGossipSelect = &GossipSelect_guard_tirisfal; newscript->GetAI = &GetAI_guard_tirisfal; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "guard_undercity"; newscript->pGossipHello = &GossipHello_guard_undercity; diff --git a/src/bindings/scripts/scripts/world/item_scripts.cpp b/src/bindings/scripts/scripts/world/item_scripts.cpp index 0e0f5795be9..b1f04f67e56 100644 --- a/src/bindings/scripts/scripts/world/item_scripts.cpp +++ b/src/bindings/scripts/scripts/world/item_scripts.cpp @@ -13,14 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Item_Scripts SD%Complete: 100 SDComment: Items for a range of different items. See content below (in script) SDCategory: Items EndScriptData */ - /* ContentData item_draenei_fishing_net(i23654) Hacklike implements chance to spawn item or creature item_nether_wraith_beacon(i31742) Summons creatures for quest Becoming a Spellfire Tailor (q10832) @@ -28,24 +26,19 @@ item_flying_machine(i34060,i34061) Engineering crafted flying machines item_gor_dreks_ointment(i30175) Protecting Our Own(q10488) item_only_for_flight Items which should only useable while flying EndContentData */ - #include "precompiled.h" #include "Spell.h" - /*##### # item_only_for_flight #####*/ - enum eOnlyForFlight { SPELL_ARCANE_CHARGES = 45072 }; - bool ItemUse_item_only_for_flight(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { uint32 itemId = _Item->GetEntry(); bool disabled = false; - //for special scripts switch(itemId) { @@ -62,20 +55,16 @@ bool ItemUse_item_only_for_flight(Player* pPlayer, Item* _Item, SpellCastTargets Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); break; } - // allow use in flight only if (pPlayer->isInFlight() && !disabled) return false; - // error pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL); return true; } - /*##### # item_draenei_fishing_net #####*/ - //This is just a hack and should be removed from here. //Creature/Item are in fact created before spell are sucessfully casted, without any checks at all to ensure proper/expected behavior. bool ItemUse_item_draenei_fishing_net(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) @@ -107,11 +96,9 @@ bool ItemUse_item_draenei_fishing_net(Player* pPlayer, Item* _Item, SpellCastTar //} return false; } - /*##### # item_nether_wraith_beacon #####*/ - bool ItemUse_item_nether_wraith_beacon(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { if (pPlayer->GetQuestStatus(10832) == QUEST_STATUS_INCOMPLETE) @@ -124,45 +111,36 @@ bool ItemUse_item_nether_wraith_beacon(Player* pPlayer, Item* _Item, SpellCastTa } return false; } - /*##### # item_flying_machine #####*/ - bool ItemUse_item_flying_machine(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { uint32 itemId = _Item->GetEntry(); if (itemId == 34060) if (pPlayer->GetBaseSkillValue(SKILL_RIDING) >= 225) return false; - if (itemId == 34061) if (pPlayer->GetBaseSkillValue(SKILL_RIDING) == 300) return false; - debug_log("TSCR: Player attempt to use item %u, but did not meet riding requirement",itemId); pPlayer->SendEquipError(EQUIP_ERR_ERR_CANT_EQUIP_SKILL,_Item,NULL); return true; } - /*##### # item_gor_dreks_ointment #####*/ - bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT && targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578)) return false; - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL); return true; } - /*##### # item_incendiary_explosives #####*/ - bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) { if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15)) @@ -175,11 +153,9 @@ bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* _Item, SpellCastT return true; } } - /*##### # item_mysterious_egg #####*/ - bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * _ItemProto) { ItemPosCountVec dest; @@ -190,11 +166,9 @@ bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * _Item } return true; } - /*##### # item_disgusting_jar #####*/ - bool ItemExpire_item_disgusting_jar(Player* pPlayer, ItemPrototype const * _ItemProto) { ItemPosCountVec dest; @@ -205,7 +179,6 @@ bool ItemExpire_item_disgusting_jar(Player* pPlayer, ItemPrototype const * _Item } return true; } - /*##### # item_harvesters_gift #####*/ @@ -214,7 +187,6 @@ bool ItemUse_item_harvesters_gift(Player* pPlayer, Item* _Item, SpellCastTargets { std::list MinionList; pPlayer->GetAllMinionsByEntry(MinionList,GHOULS); - if (pPlayer->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) { if (!MinionList.empty()) @@ -237,51 +209,41 @@ bool ItemUse_item_harvesters_gift(Player* pPlayer, Item* _Item, SpellCastTargets return true; } } - void AddSC_item_scripts() { Script *newscript; - newscript = new Script; newscript->Name = "item_only_for_flight"; newscript->pItemUse = &ItemUse_item_only_for_flight; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_draenei_fishing_net"; newscript->pItemUse = &ItemUse_item_draenei_fishing_net; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_nether_wraith_beacon"; newscript->pItemUse = &ItemUse_item_nether_wraith_beacon; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_flying_machine"; newscript->pItemUse = &ItemUse_item_flying_machine; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_gor_dreks_ointment"; newscript->pItemUse = &ItemUse_item_gor_dreks_ointment; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_incendiary_explosives"; newscript->pItemUse = &ItemUse_item_incendiary_explosives; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_mysterious_egg"; newscript->pItemExpire = &ItemExpire_item_mysterious_egg; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_disgusting_jar"; newscript->pItemExpire = &ItemExpire_item_disgusting_jar; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "item_harvesters_gift"; newscript->pItemUse = &ItemUse_item_harvesters_gift; diff --git a/src/bindings/scripts/scripts/world/mob_generic_creature.cpp b/src/bindings/scripts/scripts/world/mob_generic_creature.cpp index 45807337f5e..6c398779410 100644 --- a/src/bindings/scripts/scripts/world/mob_generic_creature.cpp +++ b/src/bindings/scripts/scripts/world/mob_generic_creature.cpp @@ -13,33 +13,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Generic_Creature SD%Complete: 80 SDComment: Should be replaced with core based AI SDCategory: Creatures EndScriptData */ - #include "precompiled.h" - #define GENERIC_CREATURE_COOLDOWN 5000 - struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI { generic_creatureAI(Creature *c) : ScriptedAI(c) {} - uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs bool IsSelfRooted; - void Reset() { GlobalCooldown = 0; BuffTimer = 0; //Rebuff as soon as we can IsSelfRooted = false; } - void EnterCombat(Unit *who) { if (!m_creature->IsWithinMeleeRange(who)) @@ -47,39 +40,32 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI IsSelfRooted = true; } } - void UpdateAI(const uint32 diff) { //Always decrease our global cooldown first if (GlobalCooldown > diff) GlobalCooldown -= diff; else GlobalCooldown = 0; - //Buff timer (only buff when we are alive and not in combat if (!m_creature->isInCombat() && m_creature->isAlive()) if (BuffTimer < diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); - if (info && !GlobalCooldown) { //Cast the buff spell DoCastSpell(m_creature, info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - //Set our timer to 10 minutes before rebuff BuffTimer = 600000; }//Try agian in 30 seconds else BuffTimer = 30000; }else BuffTimer -= diff; - //Return since we have no target if (!UpdateVictim()) return; - //If we are within range melee the target if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { @@ -88,27 +74,22 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI { bool Healing = false; SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, select a hostile spell if (info) Healing = true; else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); - //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell if (info && (rand() % (m_creature->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) { //Cast the spell if (Healing)DoCastSpell(m_creature, info); else DoCastSpell(m_creature->getVictim(), info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; } else m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); } } @@ -119,15 +100,12 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI { bool Healing = false; SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp ONLY 33% of the time if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0) info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) if (info) Healing = true; else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); - //Found a spell, check if we arn't on cooldown if (info && !GlobalCooldown) { @@ -136,15 +114,12 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI { IsSelfRooted = true; } - //Cast spell if (Healing) DoCastSpell(m_creature,info); else DoCastSpell(m_creature->getVictim(),info); - //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - }//If no spells available and we arn't moving run to target else if (IsSelfRooted) { @@ -156,12 +131,10 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI } } }; - CreatureAI* GetAI_generic_creature(Creature* pCreature) { return new generic_creatureAI (pCreature); } - struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI { trigger_periodicAI(Creature* c) : NullCreatureAI(c) @@ -170,10 +143,8 @@ struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI interval = me->GetAttackTime(BASE_ATTACK); timer = interval; } - uint32 timer, interval; const SpellEntry * spell; - void UpdateAI(const uint32 diff) { if (timer < diff) @@ -186,7 +157,6 @@ struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI timer -= diff; } }; - struct TRINITY_DLL_DECL trigger_deathAI : public NullCreatureAI { trigger_deathAI(Creature* c) : NullCreatureAI(c) {} @@ -196,13 +166,10 @@ struct TRINITY_DLL_DECL trigger_deathAI : public NullCreatureAI me->CastSpell(killer, me->m_spells[0], true); } }; - struct TRINITY_DLL_DECL mob_webwrapAI : public NullCreatureAI { mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} - uint64 victimGUID; - void SetGUID(const uint64 &guid, int32 param) { victimGUID = guid; @@ -210,7 +177,6 @@ struct TRINITY_DLL_DECL mob_webwrapAI : public NullCreatureAI if (Unit *victim = Unit::GetUnit(*me, victimGUID)) victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); } - void JustDied(Unit *killer) { if (me->m_spells[0] && victimGUID) @@ -218,22 +184,18 @@ struct TRINITY_DLL_DECL mob_webwrapAI : public NullCreatureAI victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); } }; - CreatureAI* GetAI_trigger_periodic(Creature* pCreature) { return new trigger_periodicAI (pCreature); } - CreatureAI* GetAI_trigger_death(Creature* pCreature) { return new trigger_deathAI (pCreature); } - CreatureAI* GetAI_mob_webwrap(Creature* pCreature) { return new mob_webwrapAI (pCreature); } - void AddSC_generic_creature() { Script *newscript; @@ -241,17 +203,14 @@ void AddSC_generic_creature() newscript->Name = "generic_creature"; newscript->GetAI = &GetAI_generic_creature; newscript->RegisterSelf();*/ - newscript = new Script; newscript->Name = "trigger_periodic"; newscript->GetAI = &GetAI_trigger_periodic; newscript->RegisterSelf(); - /*newscript = new Script; newscript->Name = "trigger_death"; newscript->GetAI = &GetAI_trigger_death; newscript->RegisterSelf();*/ - newscript = new Script; newscript->Name = "mob_webwrap"; newscript->GetAI = &GetAI_mob_webwrap; diff --git a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp index da124eeb720..865de42c0e8 100644 --- a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp +++ b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp @@ -13,25 +13,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Npc_Innkeeper SD%Complete: 50 SDComment: This script are currently not in use. EventSystem cannot be used on Windows build of SD2 SDCategory: NPCs EndScriptData */ - #include "precompiled.h" - #define HALLOWEEN_EVENTID 12 #define SPELL_TRICK_OR_TREATED 24755 #define SPELL_TREAT 24715 - #define LOCALE_TRICK_OR_TREAT_0 "Trick or Treat!" #define LOCALE_TRICK_OR_TREAT_2 "Des bonbons ou des blagues!" #define LOCALE_TRICK_OR_TREAT_3 "Süßes oder Saures!" #define LOCALE_TRICK_OR_TREAT_6 "¡Truco o trato!" - bool isEventActive() { /* @@ -46,12 +41,10 @@ bool isEventActive() }*/ return false; } - bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (isEventActive()&& !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) { char* localizedEntry; @@ -72,22 +65,18 @@ bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature) default: localizedEntry=LOCALE_TRICK_OR_TREAT_0; } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID); } - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_innkeeper(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && isEventActive() && !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) { pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true); - // either trick or treat, 50% chance if (rand()%2) { @@ -132,7 +121,6 @@ bool GossipSelect_npc_innkeeper(Player* pPlayer, Creature* pCreature, uint32 uiS } return false; // the player didn't select "trick or treat" or cheated, normal core handling } - void AddSC_npc_innkeeper() { Script *newscript; diff --git a/src/bindings/scripts/scripts/world/npc_professions.cpp b/src/bindings/scripts/scripts/world/npc_professions.cpp index 484339c59bb..59b4f4c5ff4 100644 --- a/src/bindings/scripts/scripts/world/npc_professions.cpp +++ b/src/bindings/scripts/scripts/world/npc_professions.cpp @@ -13,186 +13,144 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Npc_Professions SD%Complete: 80 SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering, re-learn leatherworking. SDCategory: NPCs EndScriptData */ - #include "precompiled.h" - /* A few notes for future developement: - A full implementation of gossip for GO's is required. They must have the same scripting capabilities as creatures. Basically, there is no difference here (except that default text is chosen with `gameobject_template`.`data3` (for GO type2, different dataN for a few others) - It's possible blacksmithing still require some tweaks and adjustments due to the way we _have_ to use reputation. */ - /* -- UPDATE `gameobject_template` SET `ScriptName` = 'go_soothsaying_for_dummies' WHERE `entry` = 177226; */ - /*### # to be removed from here (->ncp_text). This is data for database projects. ###*/ #define TALK_MUST_UNLEARN_WEAPON "You must forget your weapon type specialty before I can help you. Go to Everlook in Winterspring and seek help there." - #define TALK_HAMMER_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the hammersmith." #define TALK_AXE_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the axesmith." #define TALK_SWORD_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the swordsmith." - #define TALK_HAMMER_UNLEARN "Forgetting your Hammersmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Hammersmithing to create!" #define TALK_AXE_UNLEARN "Forgetting your Axesmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Axesmithing to create!" #define TALK_SWORD_UNLEARN "Forgetting your Swordsmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Swordsmithing to create!" - /*### # generic defines ###*/ - #define GOSSIP_SENDER_LEARN 50 #define GOSSIP_SENDER_UNLEARN 51 #define GOSSIP_SENDER_CHECK 52 - /*### # gossip item and box texts ###*/ - #define GOSSIP_LEARN_POTION "Please teach me how to become a Master of Potions, Lauranna" #define GOSSIP_UNLEARN_POTION "I wish to unlearn Potion Mastery" #define GOSSIP_LEARN_TRANSMUTE "Please teach me how to become a Master of Transmutations, Zarevhi" #define GOSSIP_UNLEARN_TRANSMUTE "I wish to unlearn Transmutation Mastery" #define GOSSIP_LEARN_ELIXIR "Please teach me how to become a Master of Elixirs, Lorokeem" #define GOSSIP_UNLEARN_ELIXIR "I wish to unlearn Elixir Mastery" - #define BOX_UNLEARN_ALCHEMY_SPEC "Do you really want to unlearn your alchemy specialty and lose all associated recipes? \n Cost: " - #define GOSSIP_WEAPON_LEARN "Please teach me how to become a Weaponsmith" #define GOSSIP_WEAPON_UNLEARN "I wish to unlearn the art of Weaponsmithing" #define GOSSIP_ARMOR_LEARN "Please teach me how to become a Armorsmith" #define GOSSIP_ARMOR_UNLEARN "I wish to unlearn the art of Armorsmithing" - #define GOSSIP_UNLEARN_SMITH_SPEC "I wish to unlearn my blacksmith specialty" #define BOX_UNLEARN_ARMORORWEAPON "Do you really want to unlearn your blacksmith specialty and lose all associated recipes? \n Cost: " - #define GOSSIP_LEARN_HAMMER "Please teach me how to become a Hammersmith, Lilith" #define GOSSIP_UNLEARN_HAMMER "I wish to unlearn Hammersmithing" #define GOSSIP_LEARN_AXE "Please teach me how to become a Axesmith, Kilram" #define GOSSIP_UNLEARN_AXE "I wish to unlearn Axesmithing" #define GOSSIP_LEARN_SWORD "Please teach me how to become a Swordsmith, Seril" #define GOSSIP_UNLEARN_SWORD "I wish to unlearn Swordsmithing" - #define BOX_UNLEARN_WEAPON_SPEC "Do you really want to unlearn your weaponsmith specialty and lose all associated recipes? \n Cost: " - #define GOSSIP_LEARN_DRAGON "I am absolutely certain that i want to learn dragonscale leatherworking" #define GOSSIP_UNLEARN_DRAGON "I wish to unlearn Dragonscale Leatherworking" #define GOSSIP_LEARN_ELEMENTAL "I am absolutely certain that i want to learn elemental leatherworking" #define GOSSIP_UNLEARN_ELEMENTAL "I wish to unlearn Elemental Leatherworking" #define GOSSIP_LEARN_TRIBAL "I am absolutely certain that i want to learn tribal leatherworking" #define GOSSIP_UNLEARN_TRIBAL "I wish to unlearn Tribal Leatherworking" - #define BOX_UNLEARN_LEATHER_SPEC "Do you really want to unlearn your leatherworking specialty and lose all associated recipes? \n Cost: " - #define GOSSIP_LEARN_SPELLFIRE "Please teach me how to become a Spellcloth tailor" #define GOSSIP_UNLEARN_SPELLFIRE "I wish to unlearn Spellfire Tailoring" #define GOSSIP_LEARN_MOONCLOTH "Please teach me how to become a Mooncloth tailor" #define GOSSIP_UNLEARN_MOONCLOTH "I wish to unlearn Mooncloth Tailoring" #define GOSSIP_LEARN_SHADOWEAVE "Please teach me how to become a Shadoweave tailor" #define GOSSIP_UNLEARN_SHADOWEAVE "I wish to unlearn Shadoweave Tailoring" - #define BOX_UNLEARN_TAILOR_SPEC "Do you really want to unlearn your tailoring specialty and lose all associated recipes? \n Cost: " - #define GOSSIP_LEARN_GOBLIN "I am absolutely certain that i want to learn Goblin engineering" #define GOSSIP_LEARN_GNOMISH "I am absolutely certain that i want to learn Gnomish engineering" - /*### # spells defines ###*/ - #define S_WEAPON 9787 #define S_ARMOR 9788 #define S_HAMMER 17040 #define S_AXE 17041 #define S_SWORD 17039 - #define S_LEARN_WEAPON 9789 #define S_LEARN_ARMOR 9790 #define S_LEARN_HAMMER 39099 #define S_LEARN_AXE 39098 #define S_LEARN_SWORD 39097 - #define S_UNLEARN_WEAPON 36436 #define S_UNLEARN_ARMOR 36435 #define S_UNLEARN_HAMMER 36441 #define S_UNLEARN_AXE 36439 #define S_UNLEARN_SWORD 36438 - #define S_REP_ARMOR 17451 #define S_REP_WEAPON 17452 - #define REP_ARMOR 46 #define REP_WEAPON 289 #define REP_HAMMER 569 #define REP_AXE 570 #define REP_SWORD 571 - #define S_DRAGON 10656 #define S_ELEMENTAL 10658 #define S_TRIBAL 10660 - #define S_LEARN_DRAGON 10657 #define S_LEARN_ELEMENTAL 10659 #define S_LEARN_TRIBAL 10661 - #define S_UNLEARN_DRAGON 36434 #define S_UNLEARN_ELEMENTAL 36328 #define S_UNLEARN_TRIBAL 36433 - #define S_GOBLIN 20222 #define S_GNOMISH 20219 - #define S_LEARN_GOBLIN 20221 #define S_LEARN_GNOMISH 20220 - #define S_SPELLFIRE 26797 #define S_MOONCLOTH 26798 #define S_SHADOWEAVE 26801 - #define S_LEARN_SPELLFIRE 26796 #define S_LEARN_MOONCLOTH 26799 #define S_LEARN_SHADOWEAVE 26800 - #define S_UNLEARN_SPELLFIRE 41299 #define S_UNLEARN_MOONCLOTH 41558 #define S_UNLEARN_SHADOWEAVE 41559 - #define S_TRANSMUTE 28672 #define S_ELIXIR 28677 #define S_POTION 28675 - #define S_LEARN_TRANSMUTE 28674 #define S_LEARN_ELIXIR 28678 #define S_LEARN_POTION 28676 - #define S_UNLEARN_TRANSMUTE 41565 #define S_UNLEARN_ELIXIR 41564 #define S_UNLEARN_POTION 41563 - /*### # formulas to calculate unlearning cost ###*/ - int32 DoLearnCost(Player* pPlayer) //tailor, alchemy { return 200000; } - int32 DoHighUnlearnCost(Player* pPlayer) //tailor, alchemy { return 1500000; } - int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork { uint32 level = pPlayer->getLevel(); @@ -203,7 +161,6 @@ int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leath else return 1000000; } - int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith { uint32 level = pPlayer->getLevel(); @@ -212,26 +169,21 @@ int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith else return 100000; } - /*### # unlearning related profession spells ###*/ - bool EquippedOk(Player* pPlayer, uint32 spellId) { SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId); - if (!spell) return false; - - for(uint8 i=0; i<3; ++i) + for (uint8 i=0; i<3; ++i) { uint32 reqSpell = spell->EffectTriggerSpell[i]; if (!reqSpell) continue; - Item* pItem; - for(uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; j++) + for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; j++) { pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, j); if (pItem) @@ -245,7 +197,6 @@ bool EquippedOk(Player* pPlayer, uint32 spellId) } return true; } - void ProfessionUnlearnSpells(Player* pPlayer, uint32 type) { switch (type) @@ -338,18 +289,15 @@ void ProfessionUnlearnSpells(Player* pPlayer, uint32 type) break; } } - /*### # start menues alchemy ###*/ - bool HasAlchemySpell(Player* pPlayer) { if (pPlayer->HasSpell(S_TRANSMUTE) || pPlayer->HasSpell(S_ELIXIR) || pPlayer->HasSpell(S_POTION)) return true; return false; } - bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) @@ -358,9 +306,7 @@ bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pCreature->isTrainer()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - uint32 eCreature = pCreature->GetEntry(); - if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetBaseSkillValue(SKILL_ALCHEMY)>=350 && pPlayer->getLevel() > 67) { if (pPlayer->GetQuestRewardStatus(10899) || pPlayer->GetQuestRewardStatus(10902) || pPlayer->GetQuestRewardStatus(10897)) @@ -388,11 +334,9 @@ bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) } } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - void SendActionMenu_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch(uiAction) @@ -461,7 +405,6 @@ void SendActionMenu_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -487,7 +430,6 @@ void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uin } } } - void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -513,7 +455,6 @@ void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, u } } } - bool GossipSelect_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -525,18 +466,15 @@ bool GossipSelect_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*### # start menues blacksmith ###*/ - bool HasWeaponSub(Player* pPlayer) { if (pPlayer->HasSpell(S_HAMMER) || pPlayer->HasSpell(S_AXE) || pPlayer->HasSpell(S_SWORD)) return true; return false; } - bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) @@ -545,7 +483,6 @@ bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pCreature->isTrainer()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - uint32 eCreature = pCreature->GetEntry(); //WEAPONSMITH & ARMORSMITH if (pPlayer->GetBaseSkillValue(SKILL_BLACKSMITHING)>=225) @@ -596,11 +533,9 @@ bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) break; } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - void SendActionMenu_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch(uiAction) @@ -726,7 +661,6 @@ void SendActionMenu_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, ui break; } } - void SendConfirmLearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -752,7 +686,6 @@ void SendConfirmLearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, } } } - void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -768,7 +701,6 @@ void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature //unknown textID (TALK_UNLEARN_AXEORWEAPON) pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); break; - case 11191: pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID (TALK_HAMMER_UNLEARN) @@ -787,7 +719,6 @@ void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature } } } - bool GossipSelect_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -799,54 +730,43 @@ bool GossipSelect_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint } return true; } - /*bool QuestComplete_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, Quest const *_Quest) { if ((_Quest->GetQuestId() == 5283) || (_Quest->GetQuestId() == 5301)) //armorsmith pCreature->CastSpell(pPlayer, 17451, true); - if ((_Quest->GetQuestId() == 5284) || (_Quest->GetQuestId() == 5302)) //weaponsmith pCreature->CastSpell(pPlayer, 17452, true); - return true; }*/ - /*### # engineering trinkets ###*/ - enum eEngineeringTrinkets { NPC_ZAP = 14742, NPC_JHORDY = 14743, NPC_KABLAM = 21493, NPC_SMILES = 21494, - SPELL_LEARN_TO_EVERLOOK = 23490, SPELL_LEARN_TO_GADGET = 23491, SPELL_LEARN_TO_AREA52 = 36956, SPELL_LEARN_TO_TOSHLEY = 36957, - SPELL_TO_EVERLOOK = 23486, SPELL_TO_GADGET = 23489, SPELL_TO_AREA52 = 36954, SPELL_TO_TOSHLEY = 36955, - ITEM_GNOMISH_CARD = 10790, ITEM_GOBLIN_CARD = 10791 }; - #define GOSSIP_ITEM_ZAP "[PH] Unknown" #define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!" #define GOSSIP_ITEM_KABLAM "[PH] Unknown" #define GOSSIP_ITEM_SMILES "[PH] Unknown" - bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature) { uint32 NpcTextId = 0; std::string GossipItem; bool CanLearn = false; - if (pPlayer->HasSkill(SKILL_ENGINERING)) { switch(pCreature->GetEntry()) @@ -905,25 +825,20 @@ bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreatu break; } } - if (CanLearn) { if (pPlayer->HasItemCount(ITEM_GOBLIN_CARD,1) || pPlayer->HasItemCount(ITEM_GNOMISH_CARD,1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GossipItem, pCreature->GetEntry(), GOSSIP_ACTION_INFO_DEF+1); } - pPlayer->SEND_GOSSIP_MENU(NpcTextId ? NpcTextId : pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) pPlayer->CLOSE_GOSSIP_MENU(); - if (uiSender != pCreature->GetEntry()) return true; - switch(uiSender) { case NPC_ZAP: @@ -939,14 +854,11 @@ bool GossipSelect_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreat pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_TOSHLEY, false); break; } - return true; } - /*### # start menues leatherworking ###*/ - bool GossipHello_npc_prof_leather(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) @@ -955,9 +867,7 @@ bool GossipHello_npc_prof_leather(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pCreature->isTrainer()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - uint32 eCreature = pCreature->GetEntry(); - if (pPlayer->HasSkill(SKILL_LEATHERWORKING) && pPlayer->GetBaseSkillValue(SKILL_LEATHERWORKING)>=250 && pPlayer->getLevel() > 49) { switch (eCreature) @@ -979,11 +889,9 @@ bool GossipHello_npc_prof_leather(Player* pPlayer, Creature* pCreature) break; } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - void SendActionMenu_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch(uiAction) @@ -1039,7 +947,6 @@ void SendActionMenu_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint3 break; } } - void SendConfirmUnlearn_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -1068,7 +975,6 @@ void SendConfirmUnlearn_npc_prof_leather(Player* pPlayer, Creature* pCreature, u } } } - bool GossipSelect_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -1079,18 +985,15 @@ bool GossipSelect_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*### # start menues tailoring ###*/ - bool HasTailorSpell(Player* pPlayer) { if (pPlayer->HasSpell(S_MOONCLOTH) || pPlayer->HasSpell(S_SHADOWEAVE) || pPlayer->HasSpell(S_SPELLFIRE)) return true; return false; } - bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) @@ -1099,7 +1002,6 @@ bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pCreature->isTrainer()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - uint32 eCreature = pCreature->GetEntry(); //TAILORING SPEC if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING)>=350 && pPlayer->getLevel() > 59) @@ -1129,11 +1031,9 @@ bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) } } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - void SendActionMenu_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch(uiAction) @@ -1217,7 +1117,6 @@ void SendActionMenu_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 break; } } - void SendConfirmLearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -1243,7 +1142,6 @@ void SendConfirmLearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint } } } - void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) { if (uiAction) @@ -1269,7 +1167,6 @@ void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, ui } } } - bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -1281,58 +1178,46 @@ bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 u } return true; } - /*### # start menues for GO (engineering and leatherworking) ###*/ - /*bool GOHello_go_soothsaying_for_dummies(Player* pPlayer, GameObject* pGo) { pPlayer->PlayerTalkClass->GetGossipMenu()->AddMenuItem(0,GOSSIP_LEARN_DRAGON, GOSSIP_SENDER_INFO, GOSSIP_ACTION_INFO_DEF, "", 0); - pPlayer->SEND_GOSSIP_MENU(5584, pGo->GetGUID()); - return true; }*/ - /*### # ###*/ - void AddSC_npc_professions() { Script *newscript; - newscript = new Script; newscript->Name = "npc_prof_alchemy"; newscript->pGossipHello = &GossipHello_npc_prof_alchemy; newscript->pGossipSelect = &GossipSelect_npc_prof_alchemy; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_prof_blacksmith"; newscript->pGossipHello = &GossipHello_npc_prof_blacksmith; newscript->pGossipSelect = &GossipSelect_npc_prof_blacksmith; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_engineering_tele_trinket"; newscript->pGossipHello = &GossipHello_npc_engineering_tele_trinket; newscript->pGossipSelect = &GossipSelect_npc_engineering_tele_trinket; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_prof_leather"; newscript->pGossipHello = &GossipHello_npc_prof_leather; newscript->pGossipSelect = &GossipSelect_npc_prof_leather; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_prof_tailor"; newscript->pGossipHello = &GossipHello_npc_prof_tailor; newscript->pGossipSelect = &GossipSelect_npc_prof_tailor; newscript->RegisterSelf(); - /*newscript = new Script; newscript->Name = "go_soothsaying_for_dummies"; newscript->pGOHello = &GOHello_go_soothsaying_for_dummies; diff --git a/src/bindings/scripts/scripts/world/npc_taxi.cpp b/src/bindings/scripts/scripts/world/npc_taxi.cpp index 44f05abbfc0..0dfc0f7e51d 100644 --- a/src/bindings/scripts/scripts/world/npc_taxi.cpp +++ b/src/bindings/scripts/scripts/world/npc_taxi.cpp @@ -13,7 +13,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Npc_Taxi SD%Complete: 0% @@ -21,9 +20,7 @@ SDComment: To be used for taxi NPCs that are located globally. SDCategory: NPCs EndScriptData */ - #include "precompiled.h" - #define GOSSIP_SUSURRUS "I am ready." #define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!" #define GOSSIP_BRAZEN "I am ready to go to Durnholde Keep." @@ -52,12 +49,10 @@ EndScriptData #define GOSSIP_CRIMSONWING "" #define GOSSIP_THRICESTAR1 "Do you think I could take a ride on one of those flying machines?" #define GOSSIP_THRICESTAR2 "Kara, I need to be flown out the Dens of Dying to find Bixie." - bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - switch(pCreature->GetEntry()) { case 17435: // Azuremyst Isle - Susurrus if (pPlayer->HasItemCount(23843,1,true)) @@ -77,7 +72,6 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) //Mission: The Murketh and Shaadraz Gateways if (pPlayer->GetQuestStatus(10146) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - //Shatter Point if (!pPlayer->GetQuestRewardStatus(10340)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); @@ -86,7 +80,6 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) //Mission: The Abyssal Shelf || Return to the Abyssal Shelf if (pPlayer->GetQuestStatus(10163) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10346) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - //Go to the Front if (pPlayer->GetQuestStatus(10382) != QUEST_STATUS_NONE && !pPlayer->GetQuestRewardStatus(10382)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); @@ -95,11 +88,9 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) //Mission: The Murketh and Shaadraz Gateways if (pPlayer->GetQuestStatus(10129) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); - //Mission: The Abyssal Shelf || Return to the Abyssal Shelf if (pPlayer->GetQuestStatus(10162) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10347) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - //Spinebreaker Post if (pPlayer->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(10242)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); @@ -111,7 +102,6 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) case 25059: // Isle of Quel'Danas - Ayren Cloudbreaker if (pPlayer->GetQuestStatus(11532) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11533) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); break; @@ -163,11 +153,9 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_THRICESTAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 27); break; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) { @@ -289,14 +277,11 @@ bool GossipSelect_npc_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender pPlayer->CastSpell(pPlayer, 51446, false); break; } - return true; } - void AddSC_npc_taxi() { Script *newscript; - newscript = new Script; newscript->Name = "npc_taxi"; newscript->pGossipHello = &GossipHello_npc_taxi; diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index ce1d73caf5e..422713cfff3 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -13,7 +13,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* ScriptData SDName: Npcs_Special SD%Complete: 100 @@ -21,7 +20,6 @@ SDComment: To be used for special NPCs that are located globally. SDCategory: NPCs EndScriptData */ - /* ContentData npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell npc_chicken_cluck 100% support for quest 3861 (Cluck!) @@ -36,37 +34,30 @@ npc_rogue_trainer 80% Scripted trainers, so they are able to offer ite npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap EndContentData */ - #include "precompiled.h" #include "escort_ai.h" #include "ObjectMgr.h" - /*######## # npc_air_force_bots #########*/ - enum SpawnType { SPAWNTYPE_TRIPWIRE_ROOFTOP, // no warning, summon Creature at smaller range SPAWNTYPE_ALARMBOT, // cast guards mark and summon npc - if player shows up with that buff duration < 5 seconds attack }; - struct SpawnAssociation { uint32 m_uiThisCreatureEntry; uint32 m_uiSpawnedCreatureEntry; SpawnType m_SpawnType; }; - enum eEnums { SPELL_GUARDS_MARK = 38067, AURA_DURATION_TIME_LEFT = 5000 }; - const float RANGE_TRIPWIRE = 15.0f; const float RANGE_GUARDS_MARK = 50.0f; - SpawnAssociation m_aSpawnAssociations[] = { {2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance) @@ -97,17 +88,14 @@ SpawnAssociation m_aSpawnAssociations[] = {22125, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Cenarion - Stormcrow) {22126, 22122, SPAWNTYPE_ALARMBOT} //Air Force Trip Wire - Rooftop (Cenarion Expedition) }; - struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI { npc_air_force_botsAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pSpawnAssoc = NULL; m_uiSpawnedGUID = 0; - // find the correct spawnhandling static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation); - for (uint8 i=0; iGetEntry()) @@ -116,13 +104,11 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI break; } } - if (!m_pSpawnAssoc) error_db_log("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", pCreature->GetEntry()); else { CreatureInfo const* spawnedTemplate = GetCreatureTemplateStore(m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - if (!spawnedTemplate) { m_pSpawnAssoc = NULL; @@ -131,16 +117,12 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI } } } - SpawnAssociation* m_pSpawnAssoc; uint64 m_uiSpawnedGUID; - void Reset() { } - Creature* SummonGuard() { Creature* pSummoned = m_creature->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); - if (pSummoned) m_uiSpawnedGUID = pSummoned->GetGUID(); else @@ -148,46 +130,35 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI error_db_log("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); m_pSpawnAssoc = NULL; } - return pSummoned; } - Creature* GetSummonedGuard() { Creature* pCreature = Unit::GetCreature(*m_creature, m_uiSpawnedGUID); - if (pCreature && pCreature->isAlive()) return pCreature; - return NULL; } - void MoveInLineOfSight(Unit* pWho) { if (!m_pSpawnAssoc) return; - if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) { Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; - // airforce guards only spawn for players if (!pPlayerTarget) return; - Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); - // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup if (!pLastSpawnedGuard) m_uiSpawnedGUID = 0; - switch(m_pSpawnAssoc->m_SpawnType) { case SPAWNTYPE_ALARMBOT: { if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) return; - Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0); if (pMarkAura) { @@ -195,11 +166,9 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI if (!pLastSpawnedGuard) { pLastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) return; } - if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT) { if (!pLastSpawnedGuard->getVictim()) @@ -210,10 +179,8 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI { if (!pLastSpawnedGuard) pLastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) return; - pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); } break; @@ -222,13 +189,10 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI { if (!pWho->IsWithinDistInMap(m_creature, RANGE_TRIPWIRE)) return; - if (!pLastSpawnedGuard) pLastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) return; - // ROOFTOP only triggers if the player is on the ground if (!pPlayerTarget->IsFlying()) { @@ -241,38 +205,29 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) { return new npc_air_force_botsAI(pCreature); } - /*######## # npc_chicken_cluck #########*/ - #define EMOTE_HELLO -1070004 #define EMOTE_CLUCK_TEXT -1070006 - #define QUEST_CLUCK 3861 #define FACTION_FRIENDLY 35 #define FACTION_CHICKEN 31 - struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI { npc_chicken_cluckAI(Creature *c) : ScriptedAI(c) {} - uint32 ResetFlagTimer; - void Reset() { ResetFlagTimer = 120000; m_creature->setFaction(FACTION_CHICKEN); m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { // Reset flags after a certain time has passed so that the next player has to start the 'event' again @@ -284,11 +239,9 @@ struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI return; }else ResetFlagTimer -= diff; } - if (UpdateVictim()) DoMeleeAttackIfReady(); } - void ReceiveEmote(Player* pPlayer, uint32 emote) { switch(emote) @@ -312,43 +265,33 @@ struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_chicken_cluck(Creature* pCreature) { return new npc_chicken_cluckAI(pCreature); } - bool QuestAccept_npc_chicken_cluck(Player* pPlayer, Creature* pCreature, const Quest *_Quest) { if (_Quest->GetQuestId() == QUEST_CLUCK) CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); - return true; } - bool QuestComplete_npc_chicken_cluck(Player* pPlayer, Creature* pCreature, const Quest *_Quest) { if (_Quest->GetQuestId() == QUEST_CLUCK) CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); - return true; } - /*###### ## npc_dancing_flames ######*/ - #define SPELL_BRAZIER 45423 #define SPELL_SEDUCTION 47057 #define SPELL_FIERY_AURA 45427 - struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI { npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {} - bool active; uint32 can_iteract; - void Reset() { active = true; @@ -364,7 +307,6 @@ struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI m_creature->BuildHeartBeatMsg(&data); m_creature->SendMessageToSet(&data,true); } - void UpdateAI(const uint32 diff) { if (!active) @@ -376,16 +318,13 @@ struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI }else can_iteract -= diff; } } - void EnterCombat(Unit* who){} - void ReceiveEmote(Player* pPlayer, uint32 emote) { if (m_creature->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && m_creature->IsWithinDistInMap(pPlayer,30.0f)) { m_creature->SetInFront(pPlayer); active = false; - WorldPacket data; m_creature->BuildHeartBeatMsg(&data); m_creature->SendMessageToSet(&data,true); @@ -405,31 +344,25 @@ struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_dancing_flames(Creature* pCreature) { return new npc_dancing_flamesAI(pCreature); } - /*###### ## Triage quest ######*/ - //signed for 9623 #define SAY_DOC1 -1000201 #define SAY_DOC2 -1000202 #define SAY_DOC3 -1000203 - #define DOCTOR_ALLIANCE 12939 #define DOCTOR_HORDE 12920 #define ALLIANCE_COORDS 7 #define HORDE_COORDS 6 - struct Location { float x, y, z, o; }; - static Location AllianceCoords[]= { {-3757.38, -4533.05, 14.16, 3.62}, // Top-far-right bunk as seen from entrance @@ -440,12 +373,10 @@ static Location AllianceCoords[]= {-3749.51, -4527.08, 14.07, 5.26}, // Mid-left bunk {-3746.37, -4525.35, 14.16, 5.22}, // Left bunk near entrance }; - //alliance run to where #define A_RUNTOX -3742.96 #define A_RUNTOY -4531.52 #define A_RUNTOZ 11.91 - static Location HordeCoords[]= { {-1013.75, -3492.59, 62.62, 4.34}, // Left, Behind @@ -455,98 +386,73 @@ static Location HordeCoords[]= {-1017.25, -3500.85, 62.98, 4.34}, // Left, front {-1020.95, -3499.21, 62.98, 4.34} // Right, Front }; - //horde run to where #define H_RUNTOX -1016.44 #define H_RUNTOY -3508.48 #define H_RUNTOZ 62.96 - const uint32 AllianceSoldierId[3] = { 12938, // 12938 Injured Alliance Soldier 12936, // 12936 Badly injured Alliance Soldier 12937 // 12937 Critically injured Alliance Soldier }; - const uint32 HordeSoldierId[3] = { 12923, //12923 Injured Soldier 12924, //12924 Badly injured Soldier 12925 //12925 Critically injured Soldier }; - /*###### ## npc_doctor (handles both Gustaf Vanhowzen and Gregory Victor) ######*/ - struct TRINITY_DLL_DECL npc_doctorAI : public ScriptedAI { npc_doctorAI(Creature *c) : ScriptedAI(c) {} - uint64 PlayerGUID; - uint32 SummonPatient_Timer; uint32 SummonPatientCount; uint32 PatientDiedCount; uint32 PatientSavedCount; - bool Event; - std::list Patients; std::vector Coordinates; - void Reset() { PlayerGUID = 0; - SummonPatient_Timer = 10000; SummonPatientCount = 0; PatientDiedCount = 0; PatientSavedCount = 0; - Patients.clear(); Coordinates.clear(); - Event = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void BeginEvent(Player* pPlayer); void PatientDied(Location* Point); void PatientSaved(Creature* soldier, Player* pPlayer, Location* Point); void UpdateAI(const uint32 diff); - void EnterCombat(Unit* who){} }; - /*##### ## npc_injured_patient (handles all the patients, no matter Horde or Alliance) #####*/ - struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI { npc_injured_patientAI(Creature *c) : ScriptedAI(c) {} - uint64 Doctorguid; Location* Coord; - void Reset() { Doctorguid = 0; Coord = NULL; - //no select m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //no regen health m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - //to make them lay with face down m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); - uint32 mobId = m_creature->GetEntry(); - switch (mobId) { //lower max health case 12923: @@ -563,9 +469,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI break; } } - void EnterCombat(Unit* who){} - void SpellHit(Unit *caster, const SpellEntry *spell) { if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->isAlive() && spell->Id == 20804) @@ -574,21 +478,15 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI if (Doctorguid) if (Creature* Doctor = Unit::GetCreature(*m_creature, Doctorguid)) CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord); - //make not selectable m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //regen health m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - //stand up m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - DoScriptText(RAND(SAY_DOC1,SAY_DOC2,SAY_DOC3), m_creature); - uint32 mobId = m_creature->GetEntry(); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - switch (mobId) { case 12923: @@ -604,7 +502,6 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { //lower HP on every world tick makes it a useful counter, not officlone though @@ -612,14 +509,12 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI { m_creature->SetHealth(uint32(m_creature->GetHealth()-5)); } - if (m_creature->isAlive() && m_creature->GetHealth() <= 6) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setDeathState(JUST_DIED); m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, 32); - if (Doctorguid) { if (Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid)) @@ -628,66 +523,55 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_injured_patient(Creature* pCreature) { return new npc_injured_patientAI (pCreature); } - /* npc_doctor (continue) */ - void npc_doctorAI::BeginEvent(Player* pPlayer) { PlayerGUID = pPlayer->GetGUID(); - SummonPatient_Timer = 10000; SummonPatientCount = 0; PatientDiedCount = 0; PatientSavedCount = 0; - switch(m_creature->GetEntry()) { case DOCTOR_ALLIANCE: - for(uint8 i = 0; i < ALLIANCE_COORDS; ++i) + for (uint8 i = 0; i < ALLIANCE_COORDS; ++i) Coordinates.push_back(&AllianceCoords[i]); break; case DOCTOR_HORDE: - for(uint8 i = 0; i < HORDE_COORDS; ++i) + for (uint8 i = 0; i < HORDE_COORDS; ++i) Coordinates.push_back(&HordeCoords[i]); break; } - Event = true; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void npc_doctorAI::PatientDied(Location* Point) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (pPlayer && ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) { ++PatientDiedCount; - if (PatientDiedCount > 5 && Event) { if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) pPlayer->FailQuest(6624); else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) pPlayer->FailQuest(6622); - Reset(); return; } - Coordinates.push_back(Point); } else // If no player or player abandon quest in progress Reset(); } - void npc_doctorAI::PatientSaved(Creature* soldier, Player* pPlayer, Location* Point) { if (pPlayer && PlayerGUID == pPlayer->GetGUID()) @@ -695,33 +579,28 @@ void npc_doctorAI::PatientSaved(Creature* soldier, Player* pPlayer, Location* Po if ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) { ++PatientSavedCount; - if (PatientSavedCount == 15) { if (!Patients.empty()) { std::list::iterator itr; - for(itr = Patients.begin(); itr != Patients.end(); ++itr) + for (itr = Patients.begin(); itr != Patients.end(); ++itr) { if (Creature* Patient = Unit::GetCreature((*m_creature), *itr)) Patient->setDeathState(JUST_DIED); } } - if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(6624); else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(6622); - Reset(); return; } - Coordinates.push_back(Point); } } } - void npc_doctorAI::UpdateAI(const uint32 diff) { if (Event && SummonPatientCount >= 20) @@ -729,20 +608,16 @@ void npc_doctorAI::UpdateAI(const uint32 diff) Reset(); return; } - if (Event) { if (SummonPatient_Timer < diff) { Creature* Patient = NULL; Location* Point = NULL; - if (Coordinates.empty()) return; - std::vector::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); uint32 patientEntry = 0; - switch(m_creature->GetEntry()) { case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; @@ -751,22 +626,16 @@ void npc_doctorAI::UpdateAI(const uint32 diff) error_log("TSCR: Invalid entry for Triage doctor. Please check your database"); return; } - Point = *itr; - Patient = m_creature->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (Patient) { //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - Patients.push_back(Patient->GetGUID()); CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = m_creature->GetGUID(); - if (Point) CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point; - Coordinates.erase(itr); } SummonPatient_Timer = 10000; @@ -774,43 +643,34 @@ void npc_doctorAI::UpdateAI(const uint32 diff) }else SummonPatient_Timer -= diff; } } - bool QuestAccept_npc_doctor(Player* pPlayer, Creature* pCreature, Quest const *quest) { if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) CAST_AI(npc_doctorAI, pCreature->AI())->BeginEvent(pPlayer); - return true; } - CreatureAI* GetAI_npc_doctor(Creature* pCreature) { return new npc_doctorAI (pCreature); } - /*###### ## npc_garments_of_quests ######*/ - //TODO: get text for each NPC - enum eGarments { SPELL_LESSER_HEAL_R2 = 2052, SPELL_FORTITUDE_R1 = 1243, - QUEST_MOON = 5621, QUEST_LIGHT_1 = 5624, QUEST_LIGHT_2 = 5625, QUEST_SPIRIT = 5648, QUEST_DARKNESS = 5650, - ENTRY_SHAYA = 12429, ENTRY_ROBERTS = 12423, ENTRY_DOLF = 12427, ENTRY_KORJA = 12430, ENTRY_DG_KEL = 12428, - //used by 12429,12423,12427,12430,12428, but signed for 12429 SAY_COMMON_HEALED = -1000164, SAY_DG_KEL_THANKS = -1000165, @@ -824,34 +684,24 @@ enum eGarments SAY_SHAYA_THANKS = -1000173, SAY_SHAYA_GOODBYE = -1000174, //signed for 21469 }; - struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI { npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();} - uint64 caster; - bool bIsHealed; bool bCanRun; - uint32 RunAwayTimer; - void Reset() { caster = 0; - bIsHealed = false; bCanRun = false; - RunAwayTimer = 5000; - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); //expect database to have RegenHealth=0 m_creature->SetHealth(int(m_creature->GetMaxHealth()*0.7)); } - void EnterCombat(Unit *who) {} - void SpellHit(Unit* pCaster, const SpellEntry *Spell) { if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) @@ -859,11 +709,9 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI //not while in combat if (m_creature->isInCombat()) return; - //nothing to be done now if (bIsHealed && bCanRun) return; - if (pCaster->GetTypeId() == TYPEID_PLAYER) { switch(m_creature->GetEntry()) @@ -954,18 +802,15 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI } break; } - //give quest credit, not expect any special quest objectives if (bCanRun) CAST_PLR(pCaster)->TalkedToCreature(m_creature->GetEntry(),m_creature->GetGUID()); } } } - void WaypointReached(uint32 uiPoint) { } - void UpdateAI(const uint32 diff) { if (bCanRun && !m_creature->isInCombat()) @@ -982,49 +827,38 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit); break; case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit); break; } - Start(false,true,true); } else EnterEvadeMode(); //something went wrong - RunAwayTimer = 30000; }else RunAwayTimer -= diff; } - npc_escortAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_garments_of_quests(Creature* pCreature) { return new npc_garments_of_questsAI(pCreature); } - /*###### ## npc_guardian ######*/ - #define SPELL_DEATHTOUCH 5 - struct TRINITY_DLL_DECL npc_guardianAI : public ScriptedAI { npc_guardianAI(Creature *c) : ScriptedAI(c) {} - void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void EnterCombat(Unit *who) { } - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - if (m_creature->isAttackReady()) { m_creature->CastSpell(m_creature->getVictim(),SPELL_DEATHTOUCH, true); @@ -1032,16 +866,13 @@ struct TRINITY_DLL_DECL npc_guardianAI : public ScriptedAI } } }; - CreatureAI* GetAI_npc_guardian(Creature* pCreature) { return new npc_guardianAI (pCreature); } - /*###### ## npc_kingdom_of_dalaran_quests ######*/ - enum eKingdomDalaran { SPELL_TELEPORT_DALARAN = 53360, @@ -1050,22 +881,17 @@ enum eKingdomDalaran QUEST_MAGICAL_KINGDOM_H = 12791, QUEST_MAGICAL_KINGDOM_N = 12796 }; - #define GOSSIP_ITEM_TELEPORT_TO "I am ready to be teleported to Dalaran." - bool GossipHello_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->HasItemCount(ITEM_KT_SIGNET,1) && (!pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) || !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); return true; } - bool GossipSelect_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) @@ -1075,21 +901,17 @@ bool GossipSelect_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* pCrea } return true; } - /*###### ## npc_mount_vendor ######*/ - bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - bool canBuy; canBuy = false; uint32 vendor = pCreature->GetEntry(); uint8 race = pPlayer->getRace(); - switch (vendor) { case 384: //Katie Hunter @@ -1146,7 +968,6 @@ bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) else canBuy = true; break; } - if (canBuy) { if (pCreature->isVendor()) @@ -1155,43 +976,33 @@ bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) } return true; } - bool GossipSelect_npc_mount_vendor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; } - /*###### ## npc_rogue_trainer ######*/ - #define GOSSIP_HELLO_ROGUE1 "I wish to unlearn my talents" #define GOSSIP_HELLO_ROGUE2 "" - bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isTrainer()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE1, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_UNLEARNTALENTS); - if (pPlayer->getClass() == CLASS_ROGUE && pPlayer->getLevel() >= 24 && !pPlayer->HasItemCount(17126,1) && !pPlayer->GetQuestRewardStatus(6681)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); } else pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; } - bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiAction) @@ -1210,11 +1021,9 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 } return true; } - /*###### ## npc_sayge ######*/ - #define SPELL_DMG 23768 //dmg #define SPELL_RES 23769 //res #define SPELL_ARM 23767 //arm @@ -1224,7 +1033,6 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 #define SPELL_STR 23735 //str #define SPELL_AGI 23736 //agi #define SPELL_FORTUNE 23765 //faire fortune - #define GOSSIP_HELLO_SAYGE "Yes" #define GOSSIP_SENDACTION_SAYGE1 "Slay the Man" #define GOSSIP_SENDACTION_SAYGE2 "Turn him over to liege" @@ -1243,12 +1051,10 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_SENDACTION_SAYGE15 "Take credit, share the gold" #define GOSSIP_SENDACTION_SAYGE16 "Let the knight take credit" #define GOSSIP_SENDACTION_SAYGE17 "Thanks" - bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->HasSpellCooldown(SPELL_INT) || pPlayer->HasSpellCooldown(SPELL_ARM) || pPlayer->HasSpellCooldown(SPELL_DMG) || @@ -1263,10 +1069,8 @@ bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(7339, pCreature->GetGUID()); } - return true; } - void SendAction_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiAction) { switch(uiAction) @@ -1312,7 +1116,6 @@ void SendAction_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiAction) break; } } - bool GossipSelect_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { switch(uiSender) @@ -1363,14 +1166,11 @@ bool GossipSelect_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiSende } return true; } - struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI { npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} void EnterCombat(Unit *who) {} - void OnPossess(bool apply) { if (apply) @@ -1378,40 +1178,31 @@ struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI // Initialize the action bar without the melee attack command m_creature->InitCharmInfo(); m_creature->GetCharmInfo()->InitEmptyActionBar(false); - m_creature->SetReactState(REACT_PASSIVE); } else m_creature->SetReactState(REACT_AGGRESSIVE); } - }; - CreatureAI* GetAI_npc_steam_tonk(Creature* pCreature) { return new npc_steam_tonkAI(pCreature); } - #define SPELL_TONK_MINE_DETONATE 25099 - struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI { npc_tonk_mineAI(Creature *c) : ScriptedAI(c) { m_creature->SetReactState(REACT_PASSIVE); } - uint32 ExplosionTimer; - void Reset() { ExplosionTimer = 3000; } - void EnterCombat(Unit *who) {} void AttackStart(Unit *who) {} void MoveInLineOfSight(Unit *who) {} - void UpdateAI(const uint32 diff) { if (ExplosionTimer < diff) @@ -1422,22 +1213,18 @@ struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI ExplosionTimer -= diff; } }; - CreatureAI* GetAI_npc_tonk_mine(Creature* pCreature) { return new npc_tonk_mineAI(pCreature); } - /*#### ## npc_winter_reveler ####*/ - bool ReceiveEmote_npc_winter_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) { //TODO: check auralist. if (pPlayer->HasAura(26218)) return false; - if (emote == TEXTEMOTE_KISS) { pCreature->CastSpell(pCreature, 26218, false); @@ -1451,68 +1238,51 @@ bool ReceiveEmote_npc_winter_reveler(Player* pPlayer, Creature* pCreature, uint3 } return true; } - /*#### ## npc_brewfest_reveler ####*/ - bool ReceiveEmote_npc_brewfest_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) { if (emote == TEXTEMOTE_DANCE) pCreature->CastSpell(pPlayer, 41586, false); - return true; } - /*#### ## npc_snake_trap_serpents ####*/ - #define SPELL_MIND_NUMBING_POISON 8692 //Viper #define SPELL_DEADLY_POISON 34655 //Venomous Snake #define SPELL_CRIPPLING_POISON 3409 //Viper - #define VENOMOUS_SNAKE_TIMER 1200 #define VIPER_TIMER 3000 - #define C_VIPER 19921 - #define RAND 5 - struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI { npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {} - uint32 SpellTimer; bool IsViper; bool Spawn; - void EnterCombat(Unit *who) {} - void Reset() { Spawn = true; SpellTimer = 0; - CreatureInfo const *Info = m_creature->GetCreatureInfo(); - if (Info->Entry == C_VIPER) IsViper = true; else IsViper = false; - //We have to reload the states from db for summoned guardians m_creature->SetMaxHealth(Info->maxhealth); m_creature->SetHealth(Info->maxhealth); m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg); m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg); - //Add delta to make them not all hit the same time uint32 delta = (rand() % 7) *100; m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); } - //Redefined for random target selection: void MoveInLineOfSight(Unit *who) { @@ -1520,7 +1290,6 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI { if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) { @@ -1533,7 +1302,6 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI } } } - void UpdateAI(const uint32 diff) { if (Spawn) @@ -1545,14 +1313,12 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI if (Owner->getAttackerForHelper()) AttackStart(Owner->getAttackerForHelper()); } - if (!m_creature->getVictim()) { if (m_creature->isInCombat()) DoStopAttack(); return; } - if (SpellTimer < diff) { if (IsViper) //Viper @@ -1564,10 +1330,8 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI spell = SPELL_MIND_NUMBING_POISON; else spell = SPELL_CRIPPLING_POISON; - DoCast(m_creature->getVictim(),spell); } - SpellTimer = VIPER_TIMER; } else //Venomous Snake @@ -1580,12 +1344,10 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) { return new npc_snake_trap_serpentsAI(pCreature); } - #define SAY_RANDOM_MOJO0 "Now that's what I call froggy-style!" #define SAY_RANDOM_MOJO1 "Your lily pad or mine?" #define SAY_RANDOM_MOJO2 "This won't take long, did it?" @@ -1595,7 +1357,6 @@ CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) #define SAY_RANDOM_MOJO6a "Listen, " #define SAY_RANDOM_MOJO6b ", I know of a little swamp not too far from here...." #define SAY_RANDOM_MOJO7 "There's just never enough Mojo to go around..." - struct TRINITY_DLL_DECL mob_mojoAI : public ScriptedAI { mob_mojoAI(Creature *c) : ScriptedAI(c) {Reset();} @@ -1660,16 +1421,13 @@ struct TRINITY_DLL_DECL mob_mojoAI : public ScriptedAI } } }; - CreatureAI* GetAI_mob_mojo(Creature* pCreature) { return new mob_mojoAI (pCreature); } - struct TRINITY_DLL_DECL npc_mirror_image : CasterAI { npc_mirror_image(Creature *c) : CasterAI(c) {} - void InitializeAI() { CasterAI::InitializeAI(); @@ -1683,15 +1441,12 @@ struct TRINITY_DLL_DECL npc_mirror_image : CasterAI // Clone Me! owner->CastSpell(me, 45204, false); } - // Do not reload Creature templates on evade mode enter - prevent visual lost void EnterEvadeMode() { if (me->IsInEvadeMode() || !me->isAlive()) return; - Unit *owner = me->GetCharmerOrOwner(); - me->CombatStop(true); if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) { @@ -1700,18 +1455,14 @@ struct TRINITY_DLL_DECL npc_mirror_image : CasterAI } } }; - CreatureAI* GetAI_npc_mirror_image(Creature* pCreature) { return new npc_mirror_image (pCreature); } - struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : CasterAI { npc_ebon_gargoyleAI(Creature *c) : CasterAI(c) {} - int despawnTimer; - void InitializeAI() { CasterAI::InitializeAI(); @@ -1725,38 +1476,32 @@ struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : CasterAI Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); Trinity::UnitListSearcher searcher(m_creature, targets, u_check); m_creature->VisitNearbyObject(30, searcher); - for(std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) + for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) if((*iter)->GetAura(49206,owner->GetGUID())) { me->Attack((*iter),false); break; } } - void JustDied(Unit *killer) { // Stop Feeding Gargoyle when it dies if (Unit *owner = me->GetOwner()) owner->RemoveAurasDueToSpell(50514); } - // Fly away when dismissed void SpellHit(Unit *source, const SpellEntry *spell) { if(spell->Id != 50515 || !me->isAlive() ) return; - Unit *owner = me->GetOwner(); - if (!owner || owner != source) return; - // Stop Fighting me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); // Sanctuary me->CastSpell(m_creature, 54661, true); me->SetReactState(REACT_PASSIVE); - // Fly Away me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE); me->SetSpeed(MOVE_FLIGHT, 0.25f, true); @@ -1765,11 +1510,9 @@ struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : CasterAI float y = me->GetPositionY() + 10 * sin(me->GetOrientation()); float z = me->GetPositionZ() + 25; me->GetMotionMaster()->MovePoint(0, x, y, z); - // Despawn as soon as possible despawnTimer = 4 * IN_MILISECONDS; } - void UpdateAI(const uint32 diff) { if (despawnTimer > 0) @@ -1785,31 +1528,25 @@ struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : CasterAI CasterAI::UpdateAI(diff); } }; - CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature) { return new npc_ebon_gargoyleAI (pCreature); } - struct TRINITY_DLL_DECL npc_lightwellAI : public PassiveAI { npc_lightwellAI(Creature *c) : PassiveAI(c) {} - void Reset() { m_creature->CastSpell(m_creature, 59907, false); // Spell for Lightwell Charges } }; - CreatureAI* GetAI_npc_lightwellAI(Creature* pCreature) { return new npc_lightwellAI (pCreature); } - struct TRINITY_DLL_DECL npc_training_dummy : Scripted_NoMovementAI { npc_training_dummy(Creature *c) : Scripted_NoMovementAI(c) {} - uint32 ResetTimer; void Reset() { @@ -1818,15 +1555,12 @@ struct TRINITY_DLL_DECL npc_training_dummy : Scripted_NoMovementAI m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); ResetTimer = 10000; } - void DamageTaken(Unit *done_by, uint32 &damage) { ResetTimer = 10000; damage = 0; } - void EnterCombat(Unit *who){return;} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -1842,123 +1576,100 @@ struct TRINITY_DLL_DECL npc_training_dummy : Scripted_NoMovementAI } void MoveInLineOfSight(Unit *who){return;} }; - CreatureAI* GetAI_npc_training_dummy(Creature* pCreature) { return new npc_training_dummy (pCreature); } - void AddSC_npcs_special() { Script *newscript; - newscript = new Script; newscript->Name = "npc_air_force_bots"; newscript->GetAI = &GetAI_npc_air_force_bots; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_chicken_cluck"; newscript->GetAI = &GetAI_npc_chicken_cluck; newscript->pQuestAccept = &QuestAccept_npc_chicken_cluck; newscript->pQuestComplete = &QuestComplete_npc_chicken_cluck; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_dancing_flames"; newscript->GetAI = &GetAI_npc_dancing_flames; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_injured_patient"; newscript->GetAI = &GetAI_npc_injured_patient; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_doctor"; newscript->GetAI = &GetAI_npc_doctor; newscript->pQuestAccept = &QuestAccept_npc_doctor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_garments_of_quests"; newscript->GetAI = &GetAI_npc_garments_of_quests; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_guardian"; newscript->GetAI = &GetAI_npc_guardian; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_kingdom_of_dalaran_quests"; newscript->pGossipHello = &GossipHello_npc_kingdom_of_dalaran_quests; newscript->pGossipSelect = &GossipSelect_npc_kingdom_of_dalaran_quests; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_mount_vendor"; newscript->pGossipHello = &GossipHello_npc_mount_vendor; newscript->pGossipSelect = &GossipSelect_npc_mount_vendor; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_rogue_trainer"; newscript->pGossipHello = &GossipHello_npc_rogue_trainer; newscript->pGossipSelect = &GossipSelect_npc_rogue_trainer; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_sayge"; newscript->pGossipHello = &GossipHello_npc_sayge; newscript->pGossipSelect = &GossipSelect_npc_sayge; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_steam_tonk"; newscript->GetAI = &GetAI_npc_steam_tonk; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_tonk_mine"; newscript->GetAI = &GetAI_npc_tonk_mine; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_winter_reveler"; //newscript->pReceiveEmote = &ReceiveEmote_npc_winter_reveler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_brewfest_reveler"; //newscript->pReceiveEmote = &ReceiveEmote_npc_brewfest_reveler; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_snake_trap_serpents"; newscript->GetAI = &GetAI_npc_snake_trap_serpents; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_mirror_image"; newscript->GetAI = &GetAI_npc_mirror_image; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_ebon_gargoyle"; newscript->GetAI = &GetAI_npc_ebon_gargoyle; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_lightwell"; newscript->GetAI = &GetAI_npc_lightwellAI; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "mob_mojo"; newscript->GetAI = &GetAI_mob_mojo; newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "npc_training_dummy"; newscript->GetAI = &GetAI_npc_training_dummy; diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index aa36753cf84..c19015181c5 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -1,17 +1,13 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #include "precompiled.h" - //custom - //examples extern void AddSC_example_creature(); extern void AddSC_example_escort(); extern void AddSC_example_gossip_codebox(); extern void AddSC_example_misc(); - //world extern void AddSC_areatrigger_scripts(); extern void AddSC_boss_emeriss(); @@ -24,7 +20,6 @@ extern void AddSC_item_scripts(); extern void AddSC_npc_professions(); extern void AddSC_npcs_special(); extern void AddSC_npc_taxi(); - //eastern kingdoms extern void AddSC_blackrock_depths(); //Blackrock Depths extern void AddSC_boss_ambassador_flamelash(); @@ -169,7 +164,6 @@ extern void AddSC_boss_hazzarah(); extern void AddSC_boss_renataki(); extern void AddSC_boss_wushoolay(); extern void AddSC_instance_zulgurub(); - //extern void AddSC_alterac_mountains(); extern void AddSC_arathi_highlands(); extern void AddSC_blasted_lands(); @@ -195,7 +189,6 @@ extern void AddSC_undercity(); extern void AddSC_western_plaguelands(); extern void AddSC_westfall(); extern void AddSC_wetlands(); - //kalimdor extern void AddSC_instance_blackfathom_deeps(); //Blackfathom Depths extern void AddSC_hyjal(); //CoT Battle for Mt. Hyjal @@ -236,7 +229,6 @@ extern void AddSC_instance_temple_of_ahnqiraj(); extern void AddSC_wailing_caverns(); //Wailing caverns extern void AddSC_instance_wailing_caverns(); extern void AddSC_zulfarrak(); //Zul'Farrak - extern void AddSC_ashenvale(); extern void AddSC_azshara(); extern void AddSC_azuremyst_isle(); @@ -259,7 +251,6 @@ extern void AddSC_thousand_needles(); extern void AddSC_thunder_bluff(); extern void AddSC_ungoro_crater(); extern void AddSC_winterspring(); - //northrend extern void AddSC_boss_slad_ran(); extern void AddSC_boss_moorabi(); @@ -339,7 +330,6 @@ extern void AddSC_boss_xevozz(); extern void AddSC_boss_zuramat(); extern void AddSC_instance_violet_hold(); extern void AddSC_violet_hold(); - extern void AddSC_borean_tundra(); extern void AddSC_dragonblight(); extern void AddSC_grizzly_hills(); @@ -349,7 +339,6 @@ extern void AddSC_sholazar_basin(); extern void AddSC_storm_peaks(); extern void AddSC_wintergrasp(); extern void AddSC_zuldrak(); - //outland extern void AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts extern void AddSC_boss_shirrak_the_dead_watcher(); @@ -420,7 +409,6 @@ extern void AddSC_boss_gatewatcher_iron_hand(); //TK The Mechanar extern void AddSC_boss_nethermancer_sepethrea(); extern void AddSC_boss_pathaleon_the_calculator(); extern void AddSC_instance_mechanar(); - extern void AddSC_blades_edge_mountains(); extern void AddSC_boss_doomlordkazzak(); extern void AddSC_boss_doomwalker(); @@ -432,17 +420,14 @@ extern void AddSC_shattrath_city(); extern void AddSC_terokkar_forest(); extern void AddSC_zangarmarsh(); extern void AddSC_onevents(); - void AddScripts() { //custom - //examples AddSC_example_creature(); AddSC_example_escort(); AddSC_example_gossip_codebox(); AddSC_example_misc(); - //world AddSC_areatrigger_scripts(); AddSC_boss_emeriss(); @@ -455,7 +440,6 @@ void AddScripts() AddSC_npc_professions(); AddSC_npcs_special(); AddSC_npc_taxi(); - //eastern kingdoms AddSC_blackrock_depths(); //Blackrock Depths AddSC_boss_ambassador_flamelash(); @@ -600,7 +584,6 @@ void AddScripts() AddSC_boss_renataki(); AddSC_boss_wushoolay(); AddSC_instance_zulgurub(); - //AddSC_alterac_mountains(); AddSC_arathi_highlands(); AddSC_blasted_lands(); @@ -626,7 +609,6 @@ void AddScripts() AddSC_western_plaguelands(); AddSC_westfall(); AddSC_wetlands(); - //kalimdor AddSC_instance_blackfathom_deeps(); //Blackfathom Depths AddSC_hyjal(); //CoT Battle for Mt. Hyjal @@ -667,7 +649,6 @@ void AddScripts() AddSC_wailing_caverns(); //Wailing caverns AddSC_instance_wailing_caverns(); AddSC_zulfarrak(); //Zul'Farrak - AddSC_ashenvale(); AddSC_azshara(); AddSC_azuremyst_isle(); @@ -690,7 +671,6 @@ void AddScripts() AddSC_thunder_bluff(); AddSC_ungoro_crater(); AddSC_winterspring(); - //northrend AddSC_boss_slad_ran(); //Gundrak AddSC_boss_moorabi(); @@ -770,7 +750,6 @@ void AddScripts() AddSC_boss_zuramat(); AddSC_instance_violet_hold(); AddSC_violet_hold(); - AddSC_borean_tundra(); AddSC_dragonblight(); AddSC_grizzly_hills(); @@ -780,7 +759,6 @@ void AddScripts() AddSC_storm_peaks(); AddSC_wintergrasp(); AddSC_zuldrak(); - //outland AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts AddSC_boss_shirrak_the_dead_watcher(); @@ -851,7 +829,6 @@ void AddScripts() AddSC_boss_nethermancer_sepethrea(); AddSC_boss_pathaleon_the_calculator(); AddSC_instance_mechanar(); - AddSC_blades_edge_mountains(); AddSC_boss_doomlordkazzak(); AddSC_boss_doomwalker(); diff --git a/src/bindings/scripts/system/ScriptLoader.h b/src/bindings/scripts/system/ScriptLoader.h index 57fb7d821f1..ad992e5cf12 100644 --- a/src/bindings/scripts/system/ScriptLoader.h +++ b/src/bindings/scripts/system/ScriptLoader.h @@ -1,10 +1,7 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_SCRIPTLOADER_H #define SC_SCRIPTLOADER_H - void AddScripts(); - #endif diff --git a/src/bindings/scripts/system/system.cpp b/src/bindings/scripts/system/system.cpp index 4ed51825262..1518f5bb29e 100644 --- a/src/bindings/scripts/system/system.cpp +++ b/src/bindings/scripts/system/system.cpp @@ -17,34 +17,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "precompiled.h" #include "system.h" #include "ProgressBar.h" #include "ObjectMgr.h" #include "Database/DatabaseEnv.h" - DatabaseType TScriptDB; - SystemMgr::SystemMgr() { } - SystemMgr& SystemMgr::Instance() { static SystemMgr pSysMgr; return pSysMgr; } - void SystemMgr::LoadVersion() { //Get Version information QueryResult* pResult = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1"); - if (pResult) { Field* pFields = pResult->Fetch(); - outstring_log("TSCR: Database version is: %s", pFields[0].GetString()); outstring_log(""); } @@ -54,61 +47,48 @@ void SystemMgr::LoadVersion() outstring_log(""); } } - void SystemMgr::LoadScriptTexts() { outstring_log("TSCR: Loading Script Texts..."); LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); - QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts"); - outstring_log("TSCR: Loading Script Texts additional data..."); - if (pResult) { barGoLink bar(pResult->GetRowCount()); uint32 uiCount = 0; - do { bar.step(); Field* pFields = pResult->Fetch(); StringTextData pTemp; - int32 iId = pFields[0].GetInt32(); pTemp.uiSoundId = pFields[1].GetUInt32(); pTemp.uiType = pFields[2].GetUInt32(); pTemp.uiLanguage = pFields[3].GetUInt32(); pTemp.uiEmote = pFields[4].GetUInt32(); - if (iId >= 0) { error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.", iId); continue; } - if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) { error_db_log("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); continue; } - if (pTemp.uiSoundId) { if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); } - if (!GetLanguageDescByID(pTemp.uiLanguage)) error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); - if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); - m_mTextDataMap[iId] = pTemp; ++uiCount; } while (pResult->NextRow()); - outstring_log(""); outstring_log(">> Loaded %u additional Script Texts data.", uiCount); } @@ -120,61 +100,48 @@ void SystemMgr::LoadScriptTexts() outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); } } - void SystemMgr::LoadScriptTextsCustom() { outstring_log("TSCR: Loading Custom Texts..."); LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); - QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); - outstring_log("TSCR: Loading Custom Texts additional data..."); - if (pResult) { barGoLink bar(pResult->GetRowCount()); uint32 uiCount = 0; - do { bar.step(); Field* pFields = pResult->Fetch(); StringTextData pTemp; - int32 iId = pFields[0].GetInt32(); pTemp.uiSoundId = pFields[1].GetUInt32(); pTemp.uiType = pFields[2].GetUInt32(); pTemp.uiLanguage = pFields[3].GetUInt32(); pTemp.uiEmote = pFields[4].GetUInt32(); - if (iId >= 0) { error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); continue; } - if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) { error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); continue; } - if (pTemp.uiSoundId) { if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); } - if (!GetLanguageDescByID(pTemp.uiLanguage)) error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); - if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); - m_mTextDataMap[iId] = pTemp; ++uiCount; } while (pResult->NextRow()); - outstring_log(""); outstring_log(">> Loaded %u additional Custom Texts data.", uiCount); } @@ -186,14 +153,11 @@ void SystemMgr::LoadScriptTextsCustom() outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); } } - void SystemMgr::LoadScriptWaypoints() { // Drop Existing Waypoint list m_mPointMoveMap.clear(); - uint64 uiCreatureCount = 0; - // Load Waypoints QueryResult* pResult = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); if (pResult) @@ -201,22 +165,17 @@ void SystemMgr::LoadScriptWaypoints() uiCreatureCount = pResult->GetRowCount(); delete pResult; } - outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); - pResult = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); - if (pResult) { barGoLink bar(pResult->GetRowCount()); uint32 uiNodeCount = 0; - do { bar.step(); Field* pFields = pResult->Fetch(); ScriptPointMove pTemp; - pTemp.uiCreatureEntry = pFields[0].GetUInt32(); uint32 uiEntry = pTemp.uiCreatureEntry; pTemp.uiPointId = pFields[1].GetUInt32(); @@ -224,24 +183,18 @@ void SystemMgr::LoadScriptWaypoints() pTemp.fY = pFields[3].GetFloat(); pTemp.fZ = pFields[4].GetFloat(); pTemp.uiWaitTime = pFields[5].GetUInt32(); - CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.uiCreatureEntry); - if (!pCInfo) { error_db_log("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry); continue; } - if (!pCInfo->ScriptID) error_db_log("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry); - m_mPointMoveMap[uiEntry].push_back(pTemp); ++uiNodeCount; } while (pResult->NextRow()); - delete pResult; - outstring_log(""); outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount); } diff --git a/src/bindings/scripts/system/system.h b/src/bindings/scripts/system/system.h index 479f856514a..83742a3c329 100644 --- a/src/bindings/scripts/system/system.h +++ b/src/bindings/scripts/system/system.h @@ -1,14 +1,10 @@ /* Copyright (C) 2006 - 2009 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ - #ifndef SC_SYSTEM_H #define SC_SYSTEM_H - extern DatabaseType TScriptDB; - #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available - //TODO: find better namings and definitions. //N=Neutral, A=Alliance, H=Horde. //NEUTRAL or FRIEND = Hostility to player surroundings (not a good definition) @@ -18,21 +14,16 @@ enum eEscortFaction FACTION_ESCORT_A_NEUTRAL_PASSIVE = 10, FACTION_ESCORT_H_NEUTRAL_PASSIVE = 33, FACTION_ESCORT_N_NEUTRAL_PASSIVE = 113, - FACTION_ESCORT_A_NEUTRAL_ACTIVE = 231, FACTION_ESCORT_H_NEUTRAL_ACTIVE = 232, FACTION_ESCORT_N_NEUTRAL_ACTIVE = 250, - FACTION_ESCORT_N_FRIEND_PASSIVE = 290, FACTION_ESCORT_N_FRIEND_ACTIVE = 495, - FACTION_ESCORT_A_PASSIVE = 774, FACTION_ESCORT_H_PASSIVE = 775, - FACTION_ESCORT_N_ACTIVE = 1986, FACTION_ESCORT_H_ACTIVE = 2046 }; - struct ScriptPointMove { uint32 uiCreatureEntry; @@ -42,7 +33,6 @@ struct ScriptPointMove float fZ; uint32 uiWaitTime; }; - struct StringTextData { uint32 uiSoundId; @@ -50,53 +40,39 @@ struct StringTextData uint32 uiLanguage; uint32 uiEmote; }; - #define pSystemMgr SystemMgr::Instance() - class SystemMgr { public: SystemMgr(); ~SystemMgr() {} - static SystemMgr& Instance(); - //Maps and lists typedef UNORDERED_MAP TextDataMap; typedef UNORDERED_MAP > PointMoveMap; - //Database void LoadVersion(); void LoadScriptTexts(); void LoadScriptTextsCustom(); void LoadScriptWaypoints(); - //Retrive from storage StringTextData const* GetTextData(int32 uiTextId) const { TextDataMap::const_iterator itr = m_mTextDataMap.find(uiTextId); - if (itr == m_mTextDataMap.end()) return NULL; - return &itr->second; } - std::vector const &GetPointMoveList(uint32 uiCreatureEntry) const { static std::vector vEmpty; - PointMoveMap::const_iterator itr = m_mPointMoveMap.find(uiCreatureEntry); - if (itr == m_mPointMoveMap.end()) return vEmpty; - return itr->second; } - protected: TextDataMap m_mTextDataMap; //additional data for text strings PointMoveMap m_mPointMoveMap; //coordinates for waypoints }; - #endif diff --git a/src/bindings/scripts/trinityscripts.rc b/src/bindings/scripts/trinityscripts.rc index ae93c329eb6..0dfb6f08ec6 100644 --- a/src/bindings/scripts/trinityscripts.rc +++ b/src/bindings/scripts/trinityscripts.rc @@ -15,43 +15,34 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "../../trinitycore/resource.h" #include "../../shared/revision.h" - #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "windows.h" //"afxres.h" - ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS - ///////////////////////////////////////////////////////////////////////////// // // Icon // - // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. //IDI_APPICON ICON "TrinityRealm.ico" - ///////////////////////////////////////////////////////////////////////////// // Neutre (Par défaut système) resources - #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD) #ifdef _WIN32 LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT #pragma code_page(1252) #endif //_WIN32 - ///////////////////////////////////////////////////////////////////////////// // // Version // - VS_VERSION_INFO VERSIONINFO FILEVERSION FILEVER PRODUCTVERSION PRODUCTVER diff --git a/src/framework/Dynamic/FactoryHolder.h b/src/framework/Dynamic/FactoryHolder.h index 858b8c1e1d3..ab3671fc2c3 100644 --- a/src/framework/Dynamic/FactoryHolder.h +++ b/src/framework/Dynamic/FactoryHolder.h @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_FACTORY_HOLDER #define TRINITY_FACTORY_HOLDER - #include "Platform/Define.h" #include "Utilities/TypeList.h" #include "ObjectRegistry.h" #include "Policies/SingletonImp.h" - /** FactoryHolder holds a factory object of a specific type */ template @@ -34,20 +31,16 @@ class TRINITY_DLL_DECL FactoryHolder public: typedef ObjectRegistry, Key > FactoryHolderRegistry; typedef Trinity::Singleton FactoryHolderRepository; - FactoryHolder(Key k) : i_key(k) {} virtual ~FactoryHolder() {} inline Key key() const { return i_key; } - void RegisterSelf(void) { FactoryHolderRepository::Instance().InsertItem(this, i_key); } void DeregisterSelf(void) { FactoryHolderRepository::Instance().RemoveItem(this, false); } - /// Abstract Factory create method virtual T* Create(void *data = NULL) const = 0; private: Key i_key; }; - /** Permissible is a classic way of letting the object decide * whether how good they handle things. This is not retricted * to factory selectors. diff --git a/src/framework/Dynamic/ObjectRegistry.h b/src/framework/Dynamic/ObjectRegistry.h index 8c2659e8f53..d266c280eb5 100644 --- a/src/framework/Dynamic/ObjectRegistry.h +++ b/src/framework/Dynamic/ObjectRegistry.h @@ -17,18 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_OBJECTREGISTRY_H #define TRINITY_OBJECTREGISTRY_H - #include "Platform/Define.h" #include "Utilities/UnorderedMap.h" #include "Policies/Singleton.h" - #include #include #include - /** ObjectRegistry holds all registry item of the same type */ template @@ -36,14 +32,12 @@ class TRINITY_DLL_DECL ObjectRegistry { public: typedef std::map RegistryMapType; - /// Returns a registry item const T* GetRegistryItem(Key key) const { typename RegistryMapType::const_iterator iter = i_registeredObjects.find(key); return( iter == i_registeredObjects.end() ? NULL : iter->second ); } - /// Inserts a registry item bool InsertItem(T *obj, Key key, bool override = false) { @@ -55,11 +49,9 @@ class TRINITY_DLL_DECL ObjectRegistry delete iter->second; i_registeredObjects.erase(iter); } - i_registeredObjects[key] = obj; return true; } - /// Removes a registry item void RemoveItem(Key key, bool delete_object = true) { @@ -71,13 +63,11 @@ class TRINITY_DLL_DECL ObjectRegistry i_registeredObjects.erase(iter); } } - /// Returns true if registry contains an item bool HasItem(Key key) const { return (i_registeredObjects.find(key) != i_registeredObjects.end()); } - /// Inefficiently return a vector of registered items unsigned int GetRegisteredItems(std::vector &l) const { @@ -87,17 +77,14 @@ class TRINITY_DLL_DECL ObjectRegistry l[sz++] = iter->first; return i_registeredObjects.size(); } - /// Return the map of registered items RegistryMapType const &GetRegisteredItems() const { return i_registeredObjects; } - private: RegistryMapType i_registeredObjects; friend class Trinity::OperatorNew >; - // protected for friend use since it should be a singleton ObjectRegistry() {} ~ObjectRegistry() diff --git a/src/framework/GameSystem/Grid.h b/src/framework/GameSystem/Grid.h index cebaebc68c6..04f0735ce87 100644 --- a/src/framework/GameSystem/Grid.h +++ b/src/framework/GameSystem/Grid.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_GRID_H #define TRINITY_GRID_H - /* @class Grid Grid is a logical segment of the game world represented inside TrinIty. @@ -31,15 +29,12 @@ this is implementation specific to the loader class. From the Grid's perspective, the loader meets its API requirement is suffice. */ - #include "Platform/Define.h" #include "Policies/ThreadingModel.h" #include "TypeContainer.h" #include "TypeContainerVisitor.h" - // forward declaration template class GridLoader; - template < class ACTIVE_OBJECT, @@ -52,12 +47,10 @@ class TRINITY_DLL_DECL Grid // allows the GridLoader to access its internals template friend class GridLoader; public: - /** destructor to clean up its resources. This includes unloading the grid if it has not been unload. */ ~Grid() {} - /** an object of interested enters the grid */ template void AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) @@ -65,7 +58,6 @@ class TRINITY_DLL_DECL Grid if(!i_objects.template insert(hdl, obj)) assert(false); } - /** an object of interested exits the grid */ template void RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) @@ -73,47 +65,38 @@ class TRINITY_DLL_DECL Grid if(!i_objects.template remove(obj, hdl)) assert(false); } - /** Accessors: Returns a specific type of object in the WORDL_OBJECT_TYPES */ template const SPECIFIC_OBJECT* GetWorldObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT* fake) const { return i_objects.template find(hdl); } template SPECIFIC_OBJECT* GetWorldObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) { return i_objects.template find(hdl, fake); } - /** Refreshes/update the grid. This required for remote grids. */ void RefreshGrid(void) { /* TBI */} - /** Locks a grid. Any object enters must wait until the grid is unlock. */ void LockGrid(void) { /* TBI */ } - /** Unlocks the grid. */ void UnlockGrid(void) { /* TBI */ } - /** Grid visitor for grid objects */ template void Visit(TypeContainerVisitor > &visitor) { visitor.Visit(i_container); } - /** Grid visitor for world objects */ template void Visit(TypeContainerVisitor > &visitor) { visitor.Visit(i_objects); } - /** Returns the number of object within the grid. */ unsigned int ActiveObjectsInGrid(void) const { return /*m_activeGridObjects.size()+*/i_objects.template Count(); } - /** Accessors: Returns a specific type of object in the GRID_OBJECT_TYPES */ template const SPECIFIC_OBJECT* GetGridObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) const { return i_container.template find(hdl, fake); } template SPECIFIC_OBJECT* GetGridObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) { return i_container.template find(hdl, fake); } - /** Inserts a container type object into the grid. */ template void AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) @@ -121,7 +104,6 @@ class TRINITY_DLL_DECL Grid if(!i_container.template insert(hdl, obj)) assert(false); } - /** Removes a containter type object from the grid */ template void RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) @@ -129,21 +111,17 @@ class TRINITY_DLL_DECL Grid if(!i_container.template remove(obj, hdl)) assert(false); } - /*bool NoWorldObjectInGrid() const { return i_objects.GetElements().isEmpty(); } - bool NoGridObjectInGrid() const { return i_container.GetElements().isEmpty(); }*/ private: - typedef typename ThreadModel::Lock Guard; typedef typename ThreadModel::VolatileType VolatileType; - TypeMapContainer i_container; TypeMapContainer i_objects; //typedef std::set ActiveGridObjects; diff --git a/src/framework/GameSystem/GridLoader.h b/src/framework/GameSystem/GridLoader.h index 8a483044f8f..c5eb1155e48 100644 --- a/src/framework/GameSystem/GridLoader.h +++ b/src/framework/GameSystem/GridLoader.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_GRIDLOADER_H #define TRINITY_GRIDLOADER_H - /** @class GridLoader The GridLoader is working in conjuction with the Grid and responsible @@ -31,11 +29,9 @@ delicate its loading and unloading for the actualy loader and unloader. GridLoader manages the grid (both local and remote). */ - #include "Platform/Define.h" #include "Grid.h" #include "TypeContainerVisitor.h" - template < class ACTIVE_OBJECT, @@ -45,7 +41,6 @@ class GRID_OBJECT_TYPES class TRINITY_DLL_DECL GridLoader { public: - /** Loads the grid */ template @@ -55,7 +50,6 @@ class TRINITY_DLL_DECL GridLoader loader.Load(grid); grid.UnlockGrid(); } - /** Stop the grid */ template diff --git a/src/framework/GameSystem/GridRefManager.h b/src/framework/GameSystem/GridRefManager.h index bd32f836e18..3d97135f867 100644 --- a/src/framework/GameSystem/GridRefManager.h +++ b/src/framework/GameSystem/GridRefManager.h @@ -17,24 +17,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _GRIDREFMANAGER #define _GRIDREFMANAGER - #include "Utilities/LinkedReference/RefManager.h" - template class GridReference; - template class GridRefManager : public RefManager, OBJECT> { public: typedef LinkedListHead::Iterator< GridReference > iterator; - GridReference* getFirst() { return (GridReference*)RefManager, OBJECT>::getFirst(); } GridReference* getLast() { return (GridReference*)RefManager, OBJECT>::getLast(); } - iterator begin() { return iterator(getFirst()); } iterator end() { return iterator(NULL); } iterator rbegin() { return iterator(getLast()); } diff --git a/src/framework/GameSystem/GridReference.h b/src/framework/GameSystem/GridReference.h index d4bd6752515..e6bd5da1237 100644 --- a/src/framework/GameSystem/GridReference.h +++ b/src/framework/GameSystem/GridReference.h @@ -17,15 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _GRIDREFERENCE_H #define _GRIDREFERENCE_H - #include "Utilities/LinkedReference/Reference.h" - template class GridRefManager; - template class TRINITY_DLL_SPEC GridReference : public Reference, OBJECT> { diff --git a/src/framework/GameSystem/NGrid.h b/src/framework/GameSystem/NGrid.h index 6ba5d10ffc1..f6dac7db955 100644 --- a/src/framework/GameSystem/NGrid.h +++ b/src/framework/GameSystem/NGrid.h @@ -17,17 +17,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_NGRID_H #define TRINITY_NGRID_H - /** NGrid is nothing more than a wrapper of the Grid with an NxN cells */ - #include "GameSystem/Grid.h" #include "GameSystem/GridReference.h" #include "Timer.h" - class GridInfo { public: @@ -41,18 +37,15 @@ public: void setUnloadReferenceLock( bool on ) { i_unloadReferenceLock = on; } void incUnloadActiveLock() { ++i_unloadActiveLockCount; } void decUnloadActiveLock() { if(i_unloadActiveLockCount) --i_unloadActiveLockCount; } - void setTimer(const TimeTracker& pTimer) { i_timer = pTimer; } void ResetTimeTracker(time_t interval) { i_timer.Reset(interval); } void UpdateTimeTracker(time_t diff) { i_timer.Update(diff); } - private: TimeTracker i_timer; uint16 i_unloadActiveLockCount : 16; // lock from active object spawn points (prevent clone loading) bool i_unloadExplicitLock : 1; // explicit manual lock or config setting bool i_unloadReferenceLock : 1; // lock from instance map copy }; - typedef enum { GRID_STATE_INVALID = 0, @@ -61,7 +54,6 @@ typedef enum GRID_STATE_REMOVAL= 3, MAX_GRID_STATE = 4 } grid_state_t; - template < unsigned int N, @@ -73,42 +65,36 @@ class ThreadModel = Trinity::SingleThreaded class TRINITY_DLL_DECL NGrid { public: - typedef Grid GridType; NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false) { i_GridInfo = GridInfo(expiry, unload); } - const GridType& operator()(unsigned short x, unsigned short y) const { ASSERT(x < N); ASSERT(y < N); return i_cells[x][y]; } - GridType& operator()(unsigned short x, unsigned short y) { ASSERT(x < N); ASSERT(y < N); return i_cells[x][y]; } - const uint32& GetGridId(void) const { return i_gridId; } void SetGridId(const uint32 id) const { i_gridId = id; } grid_state_t GetGridState(void) const { return i_cellstate; } void SetGridState(grid_state_t s) { i_cellstate = s; } int32 getX() const { return i_x; } int32 getY() const { return i_y; } - void link(GridRefManager >* pTo) { i_Reference.link(pTo, this); } bool isGridObjectDataLoaded() const { return i_GridObjectDataLoaded; } void setGridObjectDataLoaded(bool pLoaded) { i_GridObjectDataLoaded = pLoaded; } - GridInfo* getGridInfoRef() { return &i_GridInfo; } const TimeTracker& getTimeTracker() const { return i_GridInfo.getTimeTracker(); } bool getUnloadLock() const { return i_GridInfo.getUnloadLock(); } @@ -118,29 +104,24 @@ class TRINITY_DLL_DECL NGrid void decUnloadActiveLock() { i_GridInfo.decUnloadActiveLock(); } void ResetTimeTracker(time_t interval) { i_GridInfo.ResetTimeTracker(interval); } void UpdateTimeTracker(time_t diff) { i_GridInfo.UpdateTimeTracker(diff); } - template void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { getGridType(x, y).AddWorldObject(obj, hdl); } - template void RemoveWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { getGridType(x, y).RemoveWorldObject(obj, hdl); } - template void Visit(TypeContainerVisitor > &visitor) { for(unsigned int x=0; x < N; ++x) for(unsigned int y=0; y < N; ++y) getGridType(x, y).Visit(visitor); } - template void Visit(const uint32 &x, const uint32 &y, TypeContainerVisitor > &visitor) { getGridType(x, y).Visit(visitor); } - unsigned int ActiveObjectsInGrid(void) const { unsigned int count=0; @@ -149,36 +130,29 @@ class TRINITY_DLL_DECL NGrid count += i_cells[x][y].ActiveObjectsInGrid(); return count; } - template const SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl) const { return getGridType(x, y).template GetGridObject(hdl); } - template SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl) { return getGridType(x, y).template GetGridObject(hdl); } - template bool AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { return getGridType(x, y).AddGridObject(hdl, obj); } - template bool RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { return getGridType(x, y).RemoveGridObject(obj, hdl); } - private: - GridType& getGridType(const uint32& x, const uint32& y) { ASSERT(x < N); ASSERT(y < N); return i_cells[x][y]; } - uint32 i_gridId; GridInfo i_GridInfo; GridReference > i_Reference; diff --git a/src/framework/GameSystem/TypeContainer.h b/src/framework/GameSystem/TypeContainer.h index 9e4c6da65e2..9d32d398527 100644 --- a/src/framework/GameSystem/TypeContainer.h +++ b/src/framework/GameSystem/TypeContainer.h @@ -17,21 +17,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_TYPECONTAINER_H #define TRINITY_TYPECONTAINER_H - /* * Here, you'll find a series of containers that allow you to hold multiple * types of object at the same time. */ - #include #include #include "Platform/Define.h" #include "Utilities/TypeList.h" #include "GameSystem/GridRefManager.h" - /* * @class ContainerMapList is a mulit-type container for map elements * By itself its meaningless but collaborate along with TypeContainers, @@ -42,7 +38,6 @@ template struct ContainerMapList //std::map _element; GridRefManager _element; }; - template<> struct ContainerMapList /* nothing is in type null */ { }; @@ -51,7 +46,6 @@ template struct ContainerMapList > ContainerMapList _elements; ContainerMapList _TailElements; }; - /* * @class ContaierArrayList is a multi-type container for * array of elements. @@ -60,7 +54,6 @@ template struct ContainerArrayList { std::vector _element; }; - // termination condition template<> struct ContainerArrayList {}; // recursion @@ -69,7 +62,6 @@ template struct ContainerArrayList > ContainerArrayList _elements; ContainerArrayList _TailElements; }; - /* * @class ContainerList is a simple list of different types of elements * @@ -78,7 +70,6 @@ template struct ContainerList { OBJECT _element; }; - /* TypeNull is underfined */ template<> struct ContainerList {}; template struct ContainerList > @@ -86,44 +77,35 @@ template struct ContainerList > ContainerList _elements; ContainerMapList _TailElements; }; - #include "TypeContainerFunctions.h" - /* * @class TypeMapContainer contains a fixed number of types and is * determined at compile time. This is probably the most complicated * class and do its simplest thing, that is, holds objects * of different types. */ - template class TRINITY_DLL_DECL TypeMapContainer { public: template size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); } - template SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) { return Trinity::Find(i_elements, hdl,fake); } - /// find a specific type of object in the container template const SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) const { return Trinity::Find(i_elements, hdl,fake); } - /// inserts a specific object into the container template bool insert(OBJECT_HANDLE hdl, SPECIFIC_TYPE *obj) { SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj, hdl); return (t != NULL); } - /// Removes the object from the container, and returns the removed object template bool remove(SPECIFIC_TYPE* obj, OBJECT_HANDLE hdl) { SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj, hdl); return (t != NULL); } - ContainerMapList & GetElements(void) { return i_elements; } const ContainerMapList & GetElements(void) const { return i_elements;} - private: ContainerMapList i_elements; }; diff --git a/src/framework/GameSystem/TypeContainerFunctions.h b/src/framework/GameSystem/TypeContainerFunctions.h index f9945f84ac7..618c2584961 100644 --- a/src/framework/GameSystem/TypeContainerFunctions.h +++ b/src/framework/GameSystem/TypeContainerFunctions.h @@ -17,20 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TYPECONTAINER_FUNCTIONS_H #define TYPECONTAINER_FUNCTIONS_H - /* * Here you'll find a list of helper functions to make * the TypeContainer usefull. Without it, its hard * to access or mutate the container. */ - #include "Platform/Define.h" #include "Utilities/TypeList.h" #include - namespace Trinity { /* ContainerMapList Helpers */ @@ -39,27 +35,22 @@ namespace Trinity { return elements._element.getSize(); }; - template size_t Count(const ContainerMapList &/*elements*/, SPECIFIC_TYPE* /*fake*/) { return 0; } - template size_t Count(const ContainerMapList &/*elements*/, SPECIFIC_TYPE* /*fake*/) { return 0; } - template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) { return Count(elements._elements,fake); } - template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) { return Count(elements._TailElements, fake); } - // non-const find functions template SPECIFIC_TYPE* Find(ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { @@ -67,24 +58,20 @@ namespace Trinity //return (iter == elements._element.end() ? NULL : iter->second); return NULL; }; - template SPECIFIC_TYPE* Find(ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { return NULL; // terminate recursion } - template SPECIFIC_TYPE* Find(ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { return NULL; // this is a missed } - template SPECIFIC_TYPE* Find(ContainerMapList >&/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { //SPECIFIC_TYPE* t = Find(elements._elements, hdl,fake); //return (t != NULL ? t :Find(elements._TailElements, hdl,fake)); return NULL; } - // const find functions template const SPECIFIC_TYPE* Find(const ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { @@ -92,26 +79,21 @@ namespace Trinity //return (iter == elements._element.end() ? NULL : iter->second); return NULL; }; - template const SPECIFIC_TYPE* Find(const ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { return NULL; } - template const SPECIFIC_TYPE* Find(const ContainerMapList &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/) { return NULL; } - template SPECIFIC_TYPE* Find(const ContainerMapList >&elements, OBJECT_HANDLE hdl, SPECIFIC_TYPE* fake) { SPECIFIC_TYPE* t = Find(elements._elements, hdl,fake); if( t) return t; - return Find(elements._TailElement, hdl,fake); } - // non-const insert functions template SPECIFIC_TYPE* Insert(ContainerMapList &elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE /*hdl*/) { @@ -119,25 +101,21 @@ namespace Trinity obj->GetGridRef().link(&elements._element, obj); return obj; }; - template SPECIFIC_TYPE* Insert(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/) { return NULL; } - // this is a missed template SPECIFIC_TYPE* Insert(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/) { return NULL; // a missed } - // Recursion template SPECIFIC_TYPE* Insert(ContainerMapList >&elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE hdl) { SPECIFIC_TYPE* t= Insert(elements._elements, obj, hdl); return (t != NULL ? t : Insert(elements._TailElements, obj, hdl)); } - // non-const remove method template SPECIFIC_TYPE* Remove(ContainerMapList & /*elements*/, SPECIFIC_TYPE *obj, OBJECT_HANDLE /*hdl*/) { @@ -151,25 +129,21 @@ namespace Trinity obj->GetGridRef().unlink(); return obj; } - template SPECIFIC_TYPE* Remove(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/) { return NULL; } - // this is a missed template SPECIFIC_TYPE* Remove(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/) { return NULL; // a missed } - template SPECIFIC_TYPE* Remove(ContainerMapList > &elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE hdl) { // The head element is bad SPECIFIC_TYPE* t = Remove(elements._elements, obj, hdl); return ( t != NULL ? t : Remove(elements._TailElements, obj, hdl) ); } - } #endif diff --git a/src/framework/GameSystem/TypeContainerVisitor.h b/src/framework/GameSystem/TypeContainerVisitor.h index 97570b370c2..fc861cfe3da 100644 --- a/src/framework/GameSystem/TypeContainerVisitor.h +++ b/src/framework/GameSystem/TypeContainerVisitor.h @@ -17,101 +17,82 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_TYPECONTAINERVISITOR_H #define TRINITY_TYPECONTAINERVISITOR_H - /* * @class TypeContainerVisitor is implemented as a visitor pattern. It is * a visitor to the TypeContainerList or TypeContainerMapList. The visitor has * to overload its types as a visit method is called. */ - #include "Platform/Define.h" #include "TypeContainer.h" - // forward declaration template class TypeContainerVisitor; - // visitor helper template void VisitorHelper(VISITOR &v, TYPE_CONTAINER &c) { v.Visit(c); }; - // terminate condition for container list template void VisitorHelper(VISITOR &v, ContainerList &c) { } - template void VisitorHelper(VISITOR &v, ContainerList &c) { v.Visit(c._element); } - // recursion for container list template void VisitorHelper(VISITOR &v, ContainerList > &c) { VisitorHelper(v, c._elements); VisitorHelper(v, c._TailElements); } - // terminate condition container map list template void VisitorHelper(VISITOR &/*v*/, ContainerMapList &/*c*/) { } - template void VisitorHelper(VISITOR &v, ContainerMapList &c) { v.Visit(c._element); } - // recursion container map list template void VisitorHelper(VISITOR &v, ContainerMapList > &c) { VisitorHelper(v, c._elements); VisitorHelper(v, c._TailElements); } - // array list template void VisitorHelper(VISITOR &v, ContainerArrayList &c) { v.Visit(c._element); } - template void VisitorHelper(VISITOR &/*v*/, ContainerArrayList &/*c*/) { } - // recursion template void VisitorHelper(VISITOR &v, ContainerArrayList > &c) { VisitorHelper(v, c._elements); VisitorHelper(v, c._TailElements); } - // for TypeMapContainer template void VisitorHelper(VISITOR &v, TypeMapContainer &c) { VisitorHelper(v, c.GetElements()); } - template class TRINITY_DLL_DECL TypeContainerVisitor { public: TypeContainerVisitor(VISITOR &v) : i_visitor(v) {} - void Visit(TYPE_CONTAINER &c) { VisitorHelper(i_visitor, c); } - void Visit(const TYPE_CONTAINER &c) const { VisitorHelper(i_visitor, c); } - private: VISITOR &i_visitor; }; diff --git a/src/framework/Network/SocketDefines.h b/src/framework/Network/SocketDefines.h index e69f2fb41e0..713562f0376 100644 --- a/src/framework/Network/SocketDefines.h +++ b/src/framework/Network/SocketDefines.h @@ -17,23 +17,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_SOCKETDEFINES_H #define TRINITY_SOCKETDEFINES_H - #ifdef WIN32 - /* Windows socket definitions */ #define FD_SETSIZE 1024 #include #include - typedef SOCKET SocketHandle; typedef fd_set SelectSet; - #else - /* The unix socket definitions */ #include @@ -41,7 +35,6 @@ typedef fd_set SelectSet; #ifdef __APPLE_CC__ #include #endif - typedef int SocketHandle; typedef fd_set SelectSet; #endif diff --git a/src/framework/Platform/CompilerDefs.h b/src/framework/Platform/CompilerDefs.h index 691acb2e6d7..863d8bdc2ce 100644 --- a/src/framework/Platform/CompilerDefs.h +++ b/src/framework/Platform/CompilerDefs.h @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_COMPILERDEFS_H #define TRINITY_COMPILERDEFS_H - #define PLATFORM_WINDOWS 0 #define PLATFORM_UNIX 1 #define PLATFORM_APPLE 2 #define PLATFORM_INTEL 3 - // must be first (win 64 also define WIN32) #if defined( _WIN64 ) # define PLATFORM PLATFORM_WINDOWS @@ -38,12 +35,10 @@ #else # define PLATFORM PLATFORM_UNIX #endif - #define COMPILER_MICROSOFT 0 #define COMPILER_GNU 1 #define COMPILER_BORLAND 2 #define COMPILER_INTEL 3 - #ifdef _MSC_VER # define COMPILER COMPILER_MICROSOFT #elif defined( __BORLANDC__ ) @@ -55,7 +50,6 @@ #else # pragma error "FATAL ERROR: Unknown compiler." #endif - #if COMPILER == COMPILER_MICROSOFT # pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data # pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h index d29a53dbf31..df4d7deaf7d 100644 --- a/src/framework/Platform/Define.h +++ b/src/framework/Platform/Define.h @@ -17,20 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_DEFINE_H #define TRINITY_DEFINE_H - #include - #include #include - #include "Platform/CompilerDefs.h" - #define TRINITY_LITTLEENDIAN 0 #define TRINITY_BIGENDIAN 1 - #if !defined(TRINITY_ENDIAN) # if defined (ACE_BIG_ENDIAN) # define TRINITY_ENDIAN TRINITY_BIGENDIAN @@ -38,7 +32,6 @@ # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # endif //ACE_BYTE_ORDER #endif //TRINITY_ENDIAN - #if PLATFORM == PLATFORM_WINDOWS # define TRINITY_EXPORT __declspec(dllexport) # define TRINITY_LIBRARY_HANDLE HMODULE @@ -79,7 +72,6 @@ # endif //__APPLE_CC__ # define TRINITY_PATH_MAX PATH_MAX #endif //PLATFORM - #if PLATFORM == PLATFORM_WINDOWS # ifdef TRINITY_WIN32_DLL_IMPORT # define TRINITY_DLL_DECL __declspec(dllimport) @@ -93,7 +85,6 @@ #else //PLATFORM != PLATFORM_WINDOWS # define TRINITY_DLL_DECL #endif //PLATFORM - #if PLATFORM == PLATFORM_WINDOWS # define TRINITY_DLL_SPEC __declspec(dllexport) # ifndef DECLSPEC_NORETURN @@ -103,7 +94,6 @@ # define TRINITY_DLL_SPEC # define DECLSPEC_NORETURN #endif //PLATFORM - #if !defined(DEBUG) # define TRINITY_INLINE inline #else //DEBUG @@ -112,7 +102,6 @@ # endif //TRINITY_DEBUG # define TRINITY_INLINE #endif //!DEBUG - #if COMPILER == COMPILER_GNU # define ATTR_NORETURN __attribute__((noreturn)) # define ATTR_PRINTF(F,V) __attribute__ ((format (printf, F, V))) @@ -120,7 +109,6 @@ # define ATTR_NORETURN # define ATTR_PRINTF(F,V) #endif //COMPILER == COMPILER_GNU - typedef ACE_INT64 int64; typedef ACE_INT32 int32; typedef ACE_INT16 int16; @@ -129,19 +117,15 @@ typedef ACE_UINT64 uint64; typedef ACE_UINT32 uint32; typedef ACE_UINT16 uint16; typedef ACE_UINT8 uint8; - #if COMPILER != COMPILER_MICROSOFT typedef uint16 WORD; typedef uint32 DWORD; #endif //COMPILER - typedef uint64 OBJECT_HANDLE; - #define MaNGOS Trinity #define MANGOS_DLL_DECL TRINITY_DLL_DECL #define MANGOS_DLL_SPEC TRINITY_DLL_SPEC #define GetMangosString GetTrinityString - #if defined(MANGOS_DEBUG) || defined(TRINITY_DEBUG) # ifndef TRINITY_DEBUG # define TRINITY_DEBUG @@ -150,19 +134,15 @@ typedef uint64 OBJECT_HANDLE; # define MANGOS_DEBUG # endif #endif - #if !defined(DEBUG) && !defined(MANGOS_DEBUG) && !defined(TRINITY_DEBUG) #define MULTI_THREAD_MAP #endif - #ifdef MULTI_THREAD_MAP #define MAP_BASED_RAND_GEN #endif - #ifndef CLIENT_VER #define CLIENT_VER 313 #endif - #endif //TRINITY_DEFINE_H diff --git a/src/framework/Policies/CreationPolicy.h b/src/framework/Policies/CreationPolicy.h index 91bec9eab37..9bca121b632 100644 --- a/src/framework/Policies/CreationPolicy.h +++ b/src/framework/Policies/CreationPolicy.h @@ -17,13 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CREATIONPOLICY_H #define TRINITY_CREATIONPOLICY_H - #include #include "Platform/Define.h" - namespace Trinity { /** @@ -36,7 +33,6 @@ namespace Trinity static T* Create(void) { return (new T); } static void Destroy(T *obj) { delete obj; } }; - /** * LocalStaticCreation policy creates an object on the stack * the first time call Create. @@ -63,10 +59,8 @@ namespace Trinity static MaxAlign si_localStatic; return new(&si_localStatic) T; } - static void Destroy(T *obj) { obj->~T(); } }; - /** * CreateUsingMalloc by pass the memory manger. */ @@ -80,14 +74,12 @@ namespace Trinity if (!p) return 0; return new(p) T; } - static void Destroy(T* p) { p->~T(); ::free(p); } }; - /** * CreateOnCallBack creates the object base on the call back. */ @@ -99,7 +91,6 @@ namespace Trinity { return CALL_BACK::createCallBack(); } - static void Destroy(T *p) { CALL_BACK::destroyCallBack(p); diff --git a/src/framework/Policies/ObjectLifeTime.cpp b/src/framework/Policies/ObjectLifeTime.cpp index 852e382a0e9..d86e96a8e87 100644 --- a/src/framework/Policies/ObjectLifeTime.cpp +++ b/src/framework/Policies/ObjectLifeTime.cpp @@ -17,17 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include #include "ObjectLifeTime.h" - namespace Trinity { extern "C" void external_wrapper(void *p) { std::atexit( (void (*)())p ); } - void TRINITY_DLL_SPEC at_exit( void (*func)() ) { external_wrapper((void*)func); diff --git a/src/framework/Policies/ObjectLifeTime.h b/src/framework/Policies/ObjectLifeTime.h index 86303f889fb..51765d4d4b4 100644 --- a/src/framework/Policies/ObjectLifeTime.h +++ b/src/framework/Policies/ObjectLifeTime.h @@ -17,19 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_OBJECTLIFETIME_H #define TRINITY_OBJECTLIFETIME_H - #include #include "Platform/Define.h" - typedef void (* Destroyer)(void); - namespace Trinity { void TRINITY_DLL_SPEC at_exit( void (*func)() ); - template class TRINITY_DLL_DECL ObjectLifeTime { @@ -38,11 +33,8 @@ namespace Trinity { at_exit( destroyer ); } - DECLSPEC_NORETURN static void OnDeadReference(void) ATTR_NORETURN; - }; - template void ObjectLifeTime::OnDeadReference(void) // We don't handle Dead Reference for now { diff --git a/src/framework/Policies/Singleton.h b/src/framework/Policies/Singleton.h index 66daaba5a9a..d8d4fd4df20 100644 --- a/src/framework/Policies/Singleton.h +++ b/src/framework/Policies/Singleton.h @@ -17,18 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_SINGLETON_H #define TRINITY_SINGLETON_H - /** * @brief class Singleton */ - #include "CreationPolicy.h" #include "ThreadingModel.h" #include "ObjectLifeTime.h" - namespace Trinity { template @@ -42,19 +38,14 @@ namespace Trinity { public: static T& Instance(); - protected: Singleton() {}; - private: - // Prohibited actions...this does not prevent hijacking. Singleton(const Singleton &); Singleton& operator=(const Singleton &); - // Singleton Helpers static void DestroySingleton(); - // data structure typedef typename ThreadingModel::Lock Guard; static T *si_instance; diff --git a/src/framework/Policies/SingletonImp.h b/src/framework/Policies/SingletonImp.h index 89a4738ae22..44f2d184410 100644 --- a/src/framework/Policies/SingletonImp.h +++ b/src/framework/Policies/SingletonImp.h @@ -17,15 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_SINGLETONIMPL_H #define TRINITY_SINGLETONIMPL_H - #include "Singleton.h" - // avoid the using namespace here cuz // its a .h file afterall - template < typename T, @@ -51,10 +47,8 @@ Trinity::Singleton::Instance() LifeTimePolicy::ScheduleCall(&DestroySingleton); } } - return *si_instance; } - template < typename T, @@ -69,22 +63,18 @@ Trinity::Singleton::DestroySing si_instance = NULL; si_destroyed = true; } - #define INSTANTIATE_SINGLETON_1(TYPE) \ template class TRINITY_DLL_DECL Trinity::Singleton, Trinity::OperatorNew, Trinity::ObjectLifeTime >; \ template<> TYPE* Trinity::Singleton, Trinity::OperatorNew, Trinity::ObjectLifeTime >::si_instance = 0; \ template<> bool Trinity::Singleton, Trinity::OperatorNew, Trinity::ObjectLifeTime >::si_destroyed = false - #define INSTANTIATE_SINGLETON_2(TYPE, THREADINGMODEL) \ template class TRINITY_DLL_DECL Trinity::Singleton, Trinity::ObjectLifeTime >; \ template<> TYPE* Trinity::Singleton, Trinity::ObjectLifeTime >::si_instance = 0; \ template<> bool Trinity::Singleton, Trinity::ObjectLifeTime >::si_destroyed = false - #define INSTANTIATE_SINGLETON_3(TYPE, THREADINGMODEL, CREATIONPOLICY ) \ template class TRINITY_DLL_DECL Trinity::Singleton >; \ template<> TYPE* Trinity::Singleton >::si_instance = 0; \ template<> bool Trinity::Singleton >::si_destroyed = false - #define INSTANTIATE_SINGLETON_4(TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME) \ template class TRINITY_DLL_DECL Trinity::Singleton; \ template<> TYPE* Trinity::Singleton::si_instance = 0; \ diff --git a/src/framework/Policies/ThreadingModel.h b/src/framework/Policies/ThreadingModel.h index a380fe78323..3e0593789b5 100644 --- a/src/framework/Policies/ThreadingModel.h +++ b/src/framework/Policies/ThreadingModel.h @@ -17,21 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_THREADINGMODEL_H #define TRINITY_THREADINGMODEL_H - /** * @class ThreadingModel * */ - #include "Platform/Define.h" - namespace Trinity { inline void Guard(void *) {} - template class TRINITY_DLL_DECL GeneralLock { public: @@ -39,7 +34,6 @@ namespace Trinity { i_mutex.acquire(); } - ~GeneralLock() { i_mutex.release(); @@ -49,12 +43,10 @@ namespace Trinity GeneralLock& operator=(const GeneralLock &); MUTEX &i_mutex; }; - template class TRINITY_DLL_DECL SingleThreaded { public: - struct Lock // empty object { Lock() {} @@ -63,40 +55,31 @@ namespace Trinity { } }; - typedef T VolatileType; }; - // object level lockable template class TRINITY_DLL_DECL ObjectLevelLockable { public: ObjectLevelLockable() : i_mtx() {} - friend class Lock; - class Lock { public: Lock(ObjectLevelLockable &host) : i_lock(host.i_mtx) { } - private: GeneralLock i_lock; }; - typedef volatile T VolatileType; - private: // prevent the compiler creating a copy construct ObjectLevelLockable(const ObjectLevelLockable &); ObjectLevelLockable& operator=(const ObjectLevelLockable &); - MUTEX i_mtx; }; - template class TRINITY_DLL_DECL ClassLevelLockable { @@ -104,9 +87,7 @@ namespace Trinity class Lock; friend class Lock; typedef volatile T VolatileType; - ClassLevelLockable() {} - class Lock { public: @@ -115,15 +96,11 @@ namespace Trinity Lock() { ClassLevelLockable::si_mtx.acquire(); } ~Lock() { ClassLevelLockable::si_mtx.release(); } }; - private: static MUTEX si_mtx; }; - } - template MUTEX Trinity::ClassLevelLockable::si_mtx; - #define INSTANTIATE_CLASS_MUTEX(CTYPE,MUTEX) \ template class TRINITY_DLL_DECL Trinity::ClassLevelLockable #endif diff --git a/src/framework/Utilities/ByteConverter.h b/src/framework/Utilities/ByteConverter.h index d9282c1787d..38910abfe4d 100644 --- a/src/framework/Utilities/ByteConverter.h +++ b/src/framework/Utilities/ByteConverter.h @@ -17,17 +17,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_BYTECONVERTER_H #define TRINITY_BYTECONVERTER_H - /** ByteConverter reverse your byte order. This is use for cross platform where they have different endians. */ - #include #include - namespace ByteConverter { template @@ -36,16 +32,13 @@ namespace ByteConverter std::swap(*val, *(val + T - 1)); convert(val + 1); } - template<> inline void convert<0>(char *) {} template<> inline void convert<1>(char *) {} // ignore central byte - template inline void apply(T *val) { convert((char *)(val)); } } - #if TRINITY_ENDIAN == TRINITY_BIGENDIAN template inline void EndianConvert(T& val) { ByteConverter::apply(&val); } template inline void EndianConvertReverse(T&) { } @@ -53,14 +46,11 @@ template inline void EndianConvertReverse(T&) { } template inline void EndianConvert(T&) { } template inline void EndianConvertReverse(T& val) { ByteConverter::apply(&val); } #endif - template void EndianConvert(T*); // will generate link error template void EndianConvertReverse(T*); // will generate link error - inline void EndianConvert(uint8&) { } inline void EndianConvert( int8&) { } inline void EndianConvertReverse(uint8&) { } inline void EndianConvertReverse( int8&) { } - #endif diff --git a/src/framework/Utilities/Callback.h b/src/framework/Utilities/Callback.h index 28c0931e6e7..959a493944f 100644 --- a/src/framework/Utilities/Callback.h +++ b/src/framework/Utilities/Callback.h @@ -17,12 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CALLBACK_H #define TRINITY_CALLBACK_H - /// ------------ BASE CLASSES ------------ - namespace Trinity { template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void > @@ -43,7 +40,6 @@ namespace Trinity _Callback(_Callback < Class, ParamType1, ParamType2, ParamType3, ParamType4> const& cb) : m_object(cb.object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4) {} }; - template < class Class, typename ParamType1, typename ParamType2, typename ParamType3 > class _Callback < Class, ParamType1, ParamType2, ParamType3 > { @@ -61,7 +57,6 @@ namespace Trinity _Callback(_Callback < Class, ParamType1, ParamType2, ParamType3 > const& cb) : m_object(cb.object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {} }; - template < class Class, typename ParamType1, typename ParamType2 > class _Callback < Class, ParamType1, ParamType2 > { @@ -78,7 +73,6 @@ namespace Trinity _Callback(_Callback < Class, ParamType1, ParamType2 > const& cb) : m_object(cb.m_object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2) {} }; - template < class Class, typename ParamType1 > class _Callback < Class, ParamType1 > { @@ -94,7 +88,6 @@ namespace Trinity _Callback(_Callback < Class, ParamType1 > const& cb) : m_object(cb.m_object), m_method(cb.m_method), m_param1(cb.m_param1) {} }; - template < class Class > class _Callback < Class > { @@ -109,9 +102,7 @@ namespace Trinity _Callback(_Callback < Class > const& cb) : m_object(cb.m_object), m_method(cb.m_method) {} }; - /// ---- Statics ---- - template < typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void > class _SCallback { @@ -129,7 +120,6 @@ namespace Trinity _SCallback(_SCallback < ParamType1, ParamType2, ParamType3, ParamType4> const& cb) : m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4) {} }; - template < typename ParamType1, typename ParamType2, typename ParamType3 > class _SCallback < ParamType1, ParamType2, ParamType3 > { @@ -146,7 +136,6 @@ namespace Trinity _SCallback(_SCallback < ParamType1, ParamType2, ParamType3 > const& cb) : m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {} }; - template < typename ParamType1, typename ParamType2 > class _SCallback < ParamType1, ParamType2 > { @@ -162,7 +151,6 @@ namespace Trinity _SCallback(_SCallback < ParamType1, ParamType2 > const& cb) : m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2) {} }; - template < typename ParamType1 > class _SCallback < ParamType1 > { @@ -177,7 +165,6 @@ namespace Trinity _SCallback(_SCallback < ParamType1 > const& cb) : m_method(cb.m_method), m_param1(cb.m_param1) {} }; - template < > class _SCallback < > { @@ -192,9 +179,7 @@ namespace Trinity : m_method(cb.m_method) {} }; } - /// --------- GENERIC CALLBACKS ---------- - namespace Trinity { class ICallback @@ -203,7 +188,6 @@ namespace Trinity virtual void Execute() = 0; virtual ~ICallback() {} }; - template < class CB > class _ICallback : public CB, public ICallback { @@ -211,7 +195,6 @@ namespace Trinity _ICallback(CB const& cb) : CB(cb) {} void Execute() { CB::_Execute(); } }; - template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void > class Callback : public _ICallback< _Callback < Class, ParamType1, ParamType2, ParamType3, ParamType4 > > @@ -222,7 +205,6 @@ namespace Trinity Callback(Class *object, typename C4::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4) : _ICallback< C4 >(C4(object, method, param1, param2, param3, param4)) {} }; - template < class Class, typename ParamType1, typename ParamType2, typename ParamType3 > class Callback < Class, ParamType1, ParamType2, ParamType3 > : public _ICallback< _Callback < Class, ParamType1, ParamType2, ParamType3 > > @@ -233,7 +215,6 @@ namespace Trinity Callback(Class *object, typename C3::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3) : _ICallback< C3 >(C3(object, method, param1, param2, param3)) {} }; - template < class Class, typename ParamType1, typename ParamType2 > class Callback < Class, ParamType1, ParamType2 > : public _ICallback< _Callback < Class, ParamType1, ParamType2 > > @@ -244,7 +225,6 @@ namespace Trinity Callback(Class *object, typename C2::Method method, ParamType1 param1, ParamType2 param2) : _ICallback< C2 >(C2(object, method, param1, param2)) {} }; - template < class Class, typename ParamType1 > class Callback < Class, ParamType1 > : public _ICallback< _Callback < Class, ParamType1 > > @@ -255,7 +235,6 @@ namespace Trinity Callback(Class *object, typename C1::Method method, ParamType1 param1) : _ICallback< C1 >(C1(object, method, param1)) {} }; - template < class Class > class Callback < Class > : public _ICallback< _Callback < Class > > { @@ -266,11 +245,8 @@ namespace Trinity : _ICallback< C0 >(C0(object, method)) {} }; } - /// ---------- QUERY CALLBACKS ----------- - class QueryResult; - namespace Trinity { class IQueryCallback @@ -281,7 +257,6 @@ namespace Trinity virtual void SetResult(QueryResult* result) = 0; virtual QueryResult* GetResult() = 0; }; - template < class CB > class _IQueryCallback : public CB, public IQueryCallback { @@ -291,7 +266,6 @@ namespace Trinity void SetResult(QueryResult* result) { CB::m_param1 = result; } QueryResult* GetResult() { return CB::m_param1; } }; - template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void > class QueryCallback : public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1, ParamType2, ParamType3 > > @@ -302,7 +276,6 @@ namespace Trinity QueryCallback(Class *object, typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3) : _IQueryCallback< QC3 >(QC3(object, method, result, param1, param2, param3)) {} }; - template < class Class, typename ParamType1, typename ParamType2 > class QueryCallback < Class, ParamType1, ParamType2 > : public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1, ParamType2 > > @@ -313,7 +286,6 @@ namespace Trinity QueryCallback(Class *object, typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2) : _IQueryCallback< QC2 >(QC2(object, method, result, param1, param2)) {} }; - template < class Class, typename ParamType1 > class QueryCallback < Class, ParamType1 > : public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1 > > @@ -324,7 +296,6 @@ namespace Trinity QueryCallback(Class *object, typename QC1::Method method, QueryResult* result, ParamType1 param1) : _IQueryCallback< QC1 >(QC1(object, method, result, param1)) {} }; - template < class Class > class QueryCallback < Class > : public _IQueryCallback< _Callback < Class, QueryResult* > > { @@ -334,9 +305,7 @@ namespace Trinity QueryCallback(Class *object, typename QC0::Method method, QueryResult* result) : _IQueryCallback< QC0 >(QC0(object, method, result)) {} }; - /// ---- Statics ---- - template < typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void > class SQueryCallback : public _IQueryCallback< _SCallback < QueryResult*, ParamType1, ParamType2, ParamType3 > > @@ -347,7 +316,6 @@ namespace Trinity SQueryCallback(typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3) : _IQueryCallback< QC3 >(QC3(method, result, param1, param2, param3)) {} }; - template < typename ParamType1, typename ParamType2 > class SQueryCallback < ParamType1, ParamType2 > : public _IQueryCallback< _SCallback < QueryResult*, ParamType1, ParamType2 > > @@ -358,7 +326,6 @@ namespace Trinity SQueryCallback(typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2) : _IQueryCallback< QC2 >(QC2(method, result, param1, param2)) {} }; - template < typename ParamType1 > class SQueryCallback < ParamType1 > : public _IQueryCallback< _SCallback < QueryResult*, ParamType1 > > @@ -369,7 +336,6 @@ namespace Trinity SQueryCallback(typename QC1::Method method, QueryResult* result, ParamType1 param1) : _IQueryCallback< QC1 >(QC1(method, result, param1)) {} }; - template < > class SQueryCallback < > : public _IQueryCallback< _SCallback < QueryResult* > > { @@ -380,6 +346,5 @@ namespace Trinity : _IQueryCallback< QC0 >(QC0(method, result)) {} }; } - #endif diff --git a/src/framework/Utilities/CountedReference/Reference.h b/src/framework/Utilities/CountedReference/Reference.h index 1e1083e1a66..49156178258 100644 --- a/src/framework/Utilities/CountedReference/Reference.h +++ b/src/framework/Utilities/CountedReference/Reference.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_REFERENCE_H #define TRINITY_REFERENCE_H - /** * Referencer * Referencer is an object that holds a reference holder that hold a reference @@ -31,12 +29,10 @@ * reference around. Objects can be reference counted in both single threaded * model and multi-threaded model */ - #include #include "Platform/Define.h" #include "Policies/ThreadingModel.h" #include "ReferenceHolder.h" - template < typename T, @@ -47,52 +43,39 @@ class TRINITY_DLL_DECL Referencer typedef typename THREADING_MODEL::Lock Lock; typedef ReferenceHolder ReferenceeHolder; public: - /// Constructs a referencer. Referencer(T *ref = NULL); - /// Copy constructor Referencer(const Referencer &obj) : i_holder(NULL) { *this = obj; } - /// Destructor ~Referencer(); - /// Referencee accessor T* referencee(void) { return (i_holder == NULL ? NULL : i_holder->i_referencee); } const T* referencee(void) const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - //T& referencee(void){ return _referencee(); } //const T& referencee(void) const { return const_cast(this)->_referencee(); } operator T&(void) { return _referencee(); } operator const T&(void) const { return *const_cast(this)->_referencee(); } - /// cast operators T* operator*() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } T const * operator*() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - /// overload operators T* operator->() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } const T * operator->() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - /// operator = Referencer& operator=(const Referencer &obj); Referencer& operator=(T *); - /// returns true if i_referencee is null bool isNull(void) const { return i_holder == NULL; } - private: - T& _referencee(void) { if( i_holder == NULL ) throw std::runtime_error("Invalid access to null pointer"); return *i_holder->i_referencee; } - void deReference(ReferenceeHolder *); void addReference(ReferenceeHolder *); - // private data ReferenceeHolder *i_holder; }; diff --git a/src/framework/Utilities/CountedReference/ReferenceHolder.h b/src/framework/Utilities/CountedReference/ReferenceHolder.h index 4cfb7d16ded..80576a8700d 100644 --- a/src/framework/Utilities/CountedReference/ReferenceHolder.h +++ b/src/framework/Utilities/CountedReference/ReferenceHolder.h @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_REFERENCEHOLDER_H #define TRINITY_REFERENCEHOLDER_H - /** ReferenceHolder holds the actualy referenced obejct as well the refence count. The ReferenecHolder implements as a policy base object and will decided by the Reference class to be consnsitent. */ - template < typename T, diff --git a/src/framework/Utilities/CountedReference/ReferenceImpl.h b/src/framework/Utilities/CountedReference/ReferenceImpl.h index c3116a21cf4..22c31021bd8 100644 --- a/src/framework/Utilities/CountedReference/ReferenceImpl.h +++ b/src/framework/Utilities/CountedReference/ReferenceImpl.h @@ -17,12 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_REFERENCEIMPL_H #define TRINITY_REFERENCEIMPL_H - #include "Reference.h" - template < typename T, @@ -37,7 +34,6 @@ Referencer::Referencer(T *ref) ++i_holder->i_referenceCount; } } - template < typename T, @@ -49,7 +45,6 @@ Referencer::~Referencer() deReference(i_holder); i_holder = NULL; } - template < typename T, @@ -65,7 +60,6 @@ Referencer::operator=(const Referencer & i_holder = obj.i_holder; return *this; } - template < typename T, @@ -82,10 +76,8 @@ Referencer::operator=(T *ref) i_holder = new ReferenceeHolder(ref); ++i_holder->i_referenceCount; } - return *this; } - template < typename T, @@ -96,25 +88,21 @@ Referencer::deReference(ReferenceHolder { assert( holder != NULL && holder->i_referenceCount > 0); bool delete_object = false; - { // The guard is within the scope due to the guard // must release earlier than expected. Lock guard(*holder); Guard(&guard); - --holder->i_referenceCount; if( holder->i_referenceCount == 0 ) delete_object = true; } - if( delete_object ) { delete holder->i_referencee; delete holder; } } - template < typename T, @@ -126,7 +114,6 @@ Referencer::addReference(ReferenceHolder assert( i_holder != NULL ); Lock guard(*holder); Guard(&guard); - ++holder->i_referenceCount; } #endif diff --git a/src/framework/Utilities/EventProcessor.cpp b/src/framework/Utilities/EventProcessor.cpp index 852f84bc4e2..75cc5776602 100644 --- a/src/framework/Utilities/EventProcessor.cpp +++ b/src/framework/Utilities/EventProcessor.cpp @@ -17,25 +17,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "EventProcessor.h" - EventProcessor::EventProcessor() { m_time = 0; m_aborting = false; } - EventProcessor::~EventProcessor() { KillAllEvents(true); } - void EventProcessor::Update(uint32 p_time) { // update time m_time += p_time; - // main event loop EventList::iterator i; while (((i = m_events.begin()) != m_events.end()) && i->first <= m_time) @@ -43,7 +38,6 @@ void EventProcessor::Update(uint32 p_time) // get and remove event from queue BasicEvent* Event = i->second; m_events.erase(i); - if (!Event->to_Abort) { if (Event->Execute(m_time, p_time)) @@ -59,41 +53,34 @@ void EventProcessor::Update(uint32 p_time) } } } - void EventProcessor::KillAllEvents(bool force) { // prevent event insertions m_aborting = true; - // first, abort all existing events for (EventList::iterator i = m_events.begin(); i != m_events.end();) { EventList::iterator i_old = i; ++i; - i_old->second->to_Abort = true; i_old->second->Abort(m_time); if(force || i_old->second->IsDeletable()) { delete i_old->second; - if(!force) // need per-element cleanup m_events.erase (i_old); } } - // fast clear event list (in force case) if(force) m_events.clear(); } - void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime) { if (set_addtime) Event->m_addTime = m_time; Event->m_execTime = e_time; m_events.insert(std::pair(e_time, Event)); } - uint64 EventProcessor::CalculateTime(uint64 t_offset) { return(m_time + t_offset); diff --git a/src/framework/Utilities/EventProcessor.h b/src/framework/Utilities/EventProcessor.h index d0a98c80e30..ef33fb1ce9a 100644 --- a/src/framework/Utilities/EventProcessor.h +++ b/src/framework/Utilities/EventProcessor.h @@ -17,16 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __EVENTPROCESSOR_H #define __EVENTPROCESSOR_H - #include "Platform/Define.h" - #include - // Note. All times are in milliseconds here. - class BasicEvent { public: @@ -34,32 +29,24 @@ class BasicEvent virtual ~BasicEvent() // override destructor to perform some actions on event removal { }; - // this method executes when the event is triggered // return false if event does not want to be deleted // e_time is execution time, p_time is update interval virtual bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) { return true; } - virtual bool IsDeletable() const { return true; } // this event can be safely deleted - virtual void Abort(uint64 /*e_time*/) {} // this method executes when the event is aborted - bool to_Abort; // set by externals when the event is aborted, aborted events don't execute // and get Abort call when deleted - // these can be used for time offset control uint64 m_addTime; // time when the event was added to queue, filled by event handler uint64 m_execTime; // planned time of next execution, filled by event handler }; - typedef std::multimap EventList; - class EventProcessor { public: EventProcessor(); ~EventProcessor(); - void Update(uint32 p_time); void KillAllEvents(bool force); void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true); diff --git a/src/framework/Utilities/LinkedList.h b/src/framework/Utilities/LinkedList.h index 171ff3601e3..0d10d6a0121 100644 --- a/src/framework/Utilities/LinkedList.h +++ b/src/framework/Utilities/LinkedList.h @@ -17,40 +17,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _LINKEDLIST #define _LINKEDLIST - #include "Common.h" - //============================================ class LinkedListHead; - class LinkedListElement { private: friend class LinkedListHead; - LinkedListElement* iNext; LinkedListElement* iPrev; public: LinkedListElement() { iNext = NULL; iPrev = NULL; } ~LinkedListElement() { delink(); } - bool hasNext() const { return(iNext->iNext != NULL); } bool hasPrev() const { return(iPrev->iPrev != NULL); } bool isInList() const { return(iNext != NULL && iPrev != NULL); } - LinkedListElement * next() { return hasNext() ? iNext : NULL; } LinkedListElement const* next() const { return hasNext() ? iNext : NULL; } LinkedListElement * prev() { return hasPrev() ? iPrev : NULL; } LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; } - LinkedListElement * nocheck_next() { return iNext; } LinkedListElement const* nocheck_next() const { return iNext; } LinkedListElement * nocheck_prev() { return iPrev; } LinkedListElement const* nocheck_prev() const { return iPrev; } - void delink() { if(isInList()) @@ -58,7 +49,6 @@ class LinkedListElement iNext->iPrev = iPrev; iPrev->iNext = iNext; iNext = NULL; iPrev = NULL; } } - void insertBefore(LinkedListElement* pElem) { pElem->iNext = this; @@ -66,7 +56,6 @@ class LinkedListElement iPrev->iNext = pElem; iPrev = pElem; } - void insertAfter(LinkedListElement* pElem) { pElem->iPrev = this; @@ -75,9 +64,7 @@ class LinkedListElement iNext = pElem; } }; - //============================================ - class LinkedListHead { private: @@ -88,30 +75,23 @@ class LinkedListHead LinkedListHead() { // create empty list - iFirst.iNext = &iLast; iLast.iPrev = &iFirst; iSize = 0; } - bool isEmpty() const { return(!iFirst.iNext->isInList()); } - LinkedListElement * getFirst() { return(isEmpty() ? NULL : iFirst.iNext); } LinkedListElement const* getFirst() const { return(isEmpty() ? NULL : iFirst.iNext); } - LinkedListElement * getLast() { return(isEmpty() ? NULL : iLast.iPrev); } LinkedListElement const* getLast() const { return(isEmpty() ? NULL : iLast.iPrev); } - void insertFirst(LinkedListElement* pElem) { iFirst.insertAfter(pElem); } - void insertLast(LinkedListElement* pElem) { iLast.insertBefore(pElem); } - uint32 getSize() const { if(!iSize) @@ -128,10 +108,8 @@ class LinkedListHead else return iSize; } - void incSize() { ++iSize; } void decSize() { --iSize; } - template class Iterator { @@ -145,105 +123,85 @@ class LinkedListHead typedef _Ty& reference; typedef _Ty const & const_reference; - Iterator() : _Ptr(0) { // construct with null node pointer } - Iterator(pointer _Pnode) : _Ptr(_Pnode) { // construct with node pointer _Pnode } - Iterator& operator=(Iterator const &_Right) { return (*this) = _Right._Ptr; } - Iterator& operator=(const_pointer const &_Right) { _Ptr = (pointer)_Right; return (*this); } - reference operator*() { // return designated value return *_Ptr; } - pointer operator->() { // return pointer to class object return _Ptr; } - Iterator& operator++() { // preincrement _Ptr = _Ptr->next(); return (*this); } - Iterator operator++(int) { // postincrement iterator _Tmp = *this; ++*this; return (_Tmp); } - Iterator& operator--() { // predecrement _Ptr = _Ptr->prev(); return (*this); } - Iterator operator--(int) { // postdecrement iterator _Tmp = *this; --*this; return (_Tmp); } - bool operator==(Iterator const &_Right) const { // test for iterator equality return (_Ptr == _Right._Ptr); } - bool operator!=(Iterator const &_Right) const { // test for iterator inequality return (!(*this == _Right)); } - bool operator==(pointer const &_Right) const { // test for pointer equality return (_Ptr != _Right); } - bool operator!=(pointer const &_Right) const { // test for pointer equality return (!(*this == _Right)); } - bool operator==(const_reference _Right) const { // test for reference equality return (_Ptr == &_Right); } - bool operator!=(const_reference _Right) const { // test for reference equality return (_Ptr != &_Right); } - pointer _Mynode() { // return node pointer return (_Ptr); } - protected: pointer _Ptr; // pointer to node }; - typedef Iterator iterator; }; - //============================================ #endif diff --git a/src/framework/Utilities/LinkedReference/RefManager.h b/src/framework/Utilities/LinkedReference/RefManager.h index ed580f49ec2..819e7775bf6 100644 --- a/src/framework/Utilities/LinkedReference/RefManager.h +++ b/src/framework/Utilities/LinkedReference/RefManager.h @@ -17,31 +17,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _REFMANAGER_H #define _REFMANAGER_H //===================================================== - #include "Utilities/LinkedList.h" #include "Utilities/LinkedReference/Reference.h" - template class RefManager : public LinkedListHead { public: typedef LinkedListHead::Iterator< Reference > iterator; RefManager() { } virtual ~RefManager() { clearReferences(); } - Reference* getFirst() { return ((Reference*) LinkedListHead::getFirst()); } Reference const* getFirst() const { return ((Reference const*) LinkedListHead::getFirst()); } Reference* getLast() { return ((Reference*) LinkedListHead::getLast()); } Reference const* getLast() const { return ((Reference const*) LinkedListHead::getLast()); } - iterator begin() { return iterator(getFirst()); } iterator end() { return iterator(NULL); } iterator rbegin() { return iterator(getLast()); } iterator rend() { return iterator(NULL); } - void clearReferences() { LinkedListElement* ref; @@ -52,7 +46,6 @@ template class RefManager : public LinkedListHead } } }; - //===================================================== #endif diff --git a/src/framework/Utilities/LinkedReference/Reference.h b/src/framework/Utilities/LinkedReference/Reference.h index c77d3a2cbdb..7ac5bd4ef3d 100644 --- a/src/framework/Utilities/LinkedReference/Reference.h +++ b/src/framework/Utilities/LinkedReference/Reference.h @@ -17,14 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _REFERENCE_H #define _REFERENCE_H - #include "Utilities/LinkedList.h" - //===================================================== - template class Reference : public LinkedListElement { private: @@ -33,16 +29,13 @@ template class Reference : public LinkedListElement protected: // Tell our refTo (target) object that we have a link virtual void targetObjectBuildLink() = 0; - // Tell our refTo (taget) object, that the link is cut virtual void targetObjectDestroyLink() = 0; - // Tell our refFrom (source) object, that the link is cut (Target destroyed) virtual void sourceObjectDestroyLink() = 0; public: Reference() { iRefTo = NULL; iRefFrom = NULL; } virtual ~Reference() {} - // Create new link void link(TO* toObj, FROM* fromObj) { @@ -56,39 +49,31 @@ template class Reference : public LinkedListElement targetObjectBuildLink(); } } - // We don't need the reference anymore. Call comes from the refFrom object // Tell our refTo object, that the link is cut void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; } - // Link is invalid due to destruction of referenced target object. Call comes from the refTo object // Tell our refFrom object, that the link is cut void invalidate() // the iRefFrom MUST remain!! { sourceObjectDestroyLink(); delink(); iRefTo = NULL; } - bool isValid() const // Only check the iRefTo { return iRefTo != NULL; } - Reference * next() { return((Reference *) LinkedListElement::next()); } Reference const * next() const { return((Reference const *) LinkedListElement::next()); } Reference * prev() { return((Reference *) LinkedListElement::prev()); } Reference const * prev() const { return((Reference const *) LinkedListElement::prev()); } - Reference * nocheck_next() { return((Reference *) LinkedListElement::nocheck_next()); } Reference const * nocheck_next() const { return((Reference const *) LinkedListElement::nocheck_next()); } Reference * nocheck_prev() { return((Reference *) LinkedListElement::nocheck_prev()); } Reference const * nocheck_prev() const { return((Reference const *) LinkedListElement::nocheck_prev()); } - TO* operator ->() const { return iRefTo; } TO* getTarget() const { return iRefTo; } - FROM* getSource() const { return iRefFrom; } }; - //===================================================== #endif diff --git a/src/framework/Utilities/TypeList.h b/src/framework/Utilities/TypeList.h index 07b1ebad3e6..e1f888e1afe 100644 --- a/src/framework/Utilities/TypeList.h +++ b/src/framework/Utilities/TypeList.h @@ -17,25 +17,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_TYPELIST_H #define TRINITY_TYPELIST_H - /* @struct TypeList TypeList is the most simple but yet the most powerfull class of all. It holds at compile time the different type of objects in a linked list. */ - class TypeNull; - template struct TypeList { typedef HEAD Head; typedef TAIL Tail; }; - // enough for now.. can be expand at any point in time as needed #define TYPELIST_1(T1) TypeList #define TYPELIST_2(T1, T2) TypeList diff --git a/src/framework/Utilities/UnorderedMap.h b/src/framework/Utilities/UnorderedMap.h index dd539cc0bda..a93300b197e 100644 --- a/src/framework/Utilities/UnorderedMap.h +++ b/src/framework/Utilities/UnorderedMap.h @@ -17,13 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_UNORDERED_MAP_H #define TRINITY_UNORDERED_MAP_H - #include "Platform/CompilerDefs.h" #include "Platform/Define.h" - #if COMPILER == COMPILER_INTEL #include #elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3) @@ -35,7 +32,6 @@ #else #include #endif - #ifdef _STLPORT_VERSION #define UNORDERED_MAP std::hash_map using std::hash_map; @@ -51,7 +47,6 @@ using std::hash_map; #define UNORDERED_MAP std::tr1::unordered_map #elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 #define UNORDERED_MAP __gnu_cxx::hash_map - namespace __gnu_cxx { template<> struct hash @@ -62,9 +57,7 @@ namespace __gnu_cxx { size_t operator()(T * const &__x) const { return (size_t)__x; } }; - }; - #else #define UNORDERED_MAP std::hash_map using std::hash_map; diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index b3c9a76e720..d4c4c4aecce 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -17,53 +17,40 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Database/DatabaseEnv.h" #include "Policies/SingletonImp.h" - #include "AccountMgr.h" #include "ObjectAccessor.h" #include "Player.h" #include "Util.h" #include "Auth/Sha1.h" - extern DatabaseType loginDatabase; - INSTANTIATE_SINGLETON_1(AccountMgr); - AccountMgr::AccountMgr() {} - AccountMgr::~AccountMgr() {} - AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password) { if(utf8length(username) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; // username's too long - normalizeString(username); normalizeString(password); - if(GetId(username)) { return AOR_NAME_ALREDY_EXIST; // username does already exist } - if(!loginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str())) return AOR_DB_INTERNAL_ERROR; // unexpected error loginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL"); - return AOR_OK; // everything's fine } - AccountOpResult AccountMgr::DeleteAccount(uint32 accid) { QueryResult *result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid); if(!result) return AOR_NAME_NOT_EXIST; // account doesn't exist delete result; - result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid); if (result) { @@ -72,7 +59,6 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) Field *fields = result->Fetch(); uint32 guidlo = fields[0].GetUInt32(); uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); - // kick if player currently if(Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL)) { @@ -80,76 +66,54 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) s->KickPlayer(); // mark session to remove at next session list update s->LogoutPlayer(false); // logout player without waiting next session list update } - Player::DeleteFromDB(guid, accid, false); // no need to update realm characters } while (result->NextRow()); - delete result; } - // table realm specific but common for all characters of account for realm CharacterDatabase.PExecute("DELETE FROM character_tutorial WHERE account = '%u'",accid); - loginDatabase.BeginTransaction(); - bool res = loginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid) && loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid); - loginDatabase.CommitTransaction(); - if(!res) return AOR_DB_INTERNAL_ERROR; // unexpected error; - return AOR_OK; } - AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd) { QueryResult *result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid); if(!result) return AOR_NAME_NOT_EXIST; // account doesn't exist delete result; - if(utf8length(new_uname) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; - if(utf8length(new_passwd) > MAX_ACCOUNT_STR) return AOR_PASS_TOO_LONG; - normalizeString(new_uname); normalizeString(new_passwd); - std::string safe_new_uname = new_uname; loginDatabase.escape_string(safe_new_uname); - if(!loginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(), CalculateShaPassHash(new_uname, new_passwd).c_str(), accid)) return AOR_DB_INTERNAL_ERROR; // unexpected error - return AOR_OK; } - AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd) { std::string username; - if(!GetName(accid, username)) return AOR_NAME_NOT_EXIST; // account doesn't exist - if (utf8length(new_passwd) > MAX_ACCOUNT_STR) return AOR_PASS_TOO_LONG; - normalizeString(new_passwd); - // also reset s and v to force update at next realmd login if(!loginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'", CalculateShaPassHash(username, new_passwd).c_str(), accid)) return AOR_DB_INTERNAL_ERROR; // unexpected error - return AOR_OK; } - uint32 AccountMgr::GetId(std::string username) { loginDatabase.escape_string(username); @@ -163,7 +127,6 @@ uint32 AccountMgr::GetId(std::string username) return id; } } - uint32 AccountMgr::GetSecurity(uint32 acc_id) { QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id); @@ -173,10 +136,8 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id) delete result; return sec; } - return 0; } - bool AccountMgr::GetName(uint32 acc_id, std::string &name) { QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id); @@ -186,41 +147,31 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name) delete result; return true; } - return false; } - bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) { std::string username; if(!GetName(accid, username)) return false; - normalizeString(passwd); - QueryResult *result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str()); if (result) { delete result; return true; } - return false; } - bool AccountMgr::normalizeString(std::string& utf8str) { wchar_t wstr_buf[MAX_ACCOUNT_STR+1]; - size_t wstr_len = MAX_ACCOUNT_STR; if(!Utf8toWStr(utf8str,wstr_buf,wstr_len)) return false; - std::transform( &wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin ); - return WStrToUtf8(wstr_buf,wstr_len,utf8str); } - std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& password) { Sha1Hash sha; @@ -229,10 +180,8 @@ std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& pas sha.UpdateData(":"); sha.UpdateData(password); sha.Finalize(); - std::string encoded; hexEncodeByteArray(sha.GetDigest(), sha.GetLength(), encoded); - return encoded; } diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index c14110036a0..c35b9a37575 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -17,15 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _ACCMGR_H #define _ACCMGR_H - #include - #include "Common.h" #include "Policies/Singleton.h" - enum AccountOpResult { AOR_OK, @@ -35,29 +31,23 @@ enum AccountOpResult AOR_NAME_NOT_EXIST, AOR_DB_INTERNAL_ERROR }; - #define MAX_ACCOUNT_STR 16 - class AccountMgr { public: AccountMgr(); ~AccountMgr(); - AccountOpResult CreateAccount(std::string username, std::string password); AccountOpResult DeleteAccount(uint32 accid); AccountOpResult ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd); AccountOpResult ChangePassword(uint32 accid, std::string new_passwd); bool CheckPassword(uint32 accid, std::string passwd); - uint32 GetId(std::string username); uint32 GetSecurity(uint32 acc_id); bool GetName(uint32 acc_id, std::string &name); std::string CalculateShaPassHash(std::string& name, std::string& password); - static bool normalizeString(std::string& utf8str); }; - #define accmgr Trinity::Singleton::Instance() #endif diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index c9b98c3ddef..50daa5c565f 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "DBCEnums.h" #include "ObjectMgr.h" @@ -23,7 +22,6 @@ #include "WorldPacket.h" #include "Database/DatabaseEnv.h" #include "Policies/SingletonImp.h" - #include "AchievementMgr.h" #include "ArenaTeam.h" #include "CellImpl.h" @@ -34,14 +32,11 @@ #include "Player.h" #include "ProgressBar.h" #include "SpellMgr.h" - #include "MapManager.h" #include "BattleGround.h" #include "BattleGroundAB.h" - INSTANTIATE_SINGLETON_1(AchievementGlobalMgr); - namespace MaNGOS { class AchievementChatBuilder @@ -52,7 +47,6 @@ namespace MaNGOS void operator()(WorldPacket& data, int32 loc_idx) { char const* text = objmgr.GetMangosString(i_textId,loc_idx); - data << uint8(i_msgtype); data << uint32(LANG_UNIVERSAL); data << uint64(i_player.GetGUID()); @@ -63,7 +57,6 @@ namespace MaNGOS data << uint8(0); data << uint32(i_achievementId); } - private: Player const& i_player; ChatMsg i_msgtype; @@ -72,7 +65,6 @@ namespace MaNGOS }; } // namespace MaNGOS - bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) { if(dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE) @@ -80,7 +72,6 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) sLog.outErrorDb( "Table `achievement_criteria_data` for criteria (Entry: %u) have wrong data type (%u), ignore.", criteria->ID,dataType); return false; } - switch(criteria->requiredType) { case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: @@ -98,7 +89,6 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType); return false; } - switch(dataType) { case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE: @@ -245,7 +235,6 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) } return false; } - bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, uint32 miscvalue1 /*= 0*/) const { switch(dataType) @@ -317,25 +306,20 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui } return false; } - bool AchievementCriteriaDataSet::Meets(Player const* source, Unit const* target, uint32 miscvalue /*= 0*/) const { for(Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr) if(!itr->Meets(source,target,miscvalue)) return false; - return true; } - AchievementMgr::AchievementMgr(Player *player) { m_player = player; } - AchievementMgr::~AchievementMgr() { } - void AchievementMgr::Reset() { for(CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter!=m_completedAchievements.end(); ++iter) @@ -344,43 +328,34 @@ void AchievementMgr::Reset() data << uint32(iter->first); m_player->SendDirectMessage(&data); } - for(CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter) { WorldPacket data(SMSG_CRITERIA_DELETED,4); data << uint32(iter->first); m_player->SendDirectMessage(&data); } - m_completedAchievements.clear(); m_criteriaProgress.clear(); DeleteFromDB(m_player->GetGUIDLow()); - // re-fill data CheckAllAchievementCriteria(); } - void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2) { if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0) sLog.outDetail("AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2); - if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) return; - AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) { AchievementCriteriaEntry const *achievementCriteria = (*i); - AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); if (!achievement) continue; - // don't update already completed criteria if (IsCompletedCriteria(achievementCriteria,achievement)) continue; - switch (type) { case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE: // have total statistic also not expected to be reset @@ -399,7 +374,6 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin } } } - void AchievementMgr::DeleteFromDB(uint32 lowguid) { CharacterDatabase.BeginTransaction (); @@ -407,7 +381,6 @@ void AchievementMgr::DeleteFromDB(uint32 lowguid) CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE guid = %u",lowguid); CharacterDatabase.CommitTransaction (); } - void AchievementMgr::SaveToDB() { if(!m_completedAchievements.empty()) @@ -419,7 +392,6 @@ void AchievementMgr::SaveToDB() { if(!iter->second.changed) continue; - /// first new/changed record prefix if(!need_execute) { @@ -433,25 +405,20 @@ void AchievementMgr::SaveToDB() ssdel << ", "; ssins << ", "; } - // new/changed record data ssdel << iter->first; ssins << "("<GetGUIDLow() << ", " << iter->first << ", " << uint64(iter->second.date) << ")"; - /// mark as saved in db iter->second.changed = false; } - if(need_execute) ssdel << ")"; - if(need_execute) { CharacterDatabase.Execute( ssdel.str().c_str() ); CharacterDatabase.Execute( ssins.str().c_str() ); } } - if(!m_criteriaProgress.empty()) { /// prepare deleting and insert @@ -463,7 +430,6 @@ void AchievementMgr::SaveToDB() { if(!iter->second.changed) continue; - // deleted data (including 0 progress state) { /// first new/changed record prefix (for any counter value) @@ -475,11 +441,9 @@ void AchievementMgr::SaveToDB() /// next new/changed record prefix else ssdel << ", "; - // new/changed record data ssdel << iter->first; } - // store data only for real progress if(iter->second.counter != 0) { @@ -492,18 +456,14 @@ void AchievementMgr::SaveToDB() /// next new/changed record prefix else ssins << ", "; - // new/changed record data ssins << "(" << GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << iter->second.counter << ", " << iter->second.date << ")"; } - /// mark as updated in db iter->second.changed = false; } - if(need_execute_del) // DELETE ... IN (.... _)_ ssdel << ")"; - if(need_execute_del || need_execute_ins) { if(need_execute_del) @@ -513,7 +473,6 @@ void AchievementMgr::SaveToDB() } } } - void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult) { if(achievementResult) @@ -521,30 +480,24 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri do { Field *fields = achievementResult->Fetch(); - uint32 achievement_id = fields[0].GetUInt32(); - // don't must happen: cleanup at server startup in achievementmgr.LoadCompletedAchievements() if(!sAchievementStore.LookupEntry(achievement_id)) continue; - CompletedAchievementData& ca = m_completedAchievements[achievement_id]; ca.date = time_t(fields[1].GetUInt64()); ca.changed = false; } while(achievementResult->NextRow()); delete achievementResult; } - if(criteriaResult) { do { Field *fields = criteriaResult->Fetch(); - uint32 id = fields[0].GetUInt32(); uint32 counter = fields[1].GetUInt32(); time_t date = time_t(fields[2].GetUInt64()); - AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id); if (!criteria) { @@ -553,10 +506,8 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE criteria = %u",id); continue; } - if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL)) continue; - CriteriaProgress& progress = m_criteriaProgress[id]; progress.counter = counter; progress.date = date; @@ -564,26 +515,21 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri } while(criteriaResult->NextRow()); delete criteriaResult; } - } - void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) { if(GetPlayer()->GetSession()->PlayerLoading()) return; - #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0) sLog.outDebug("AchievementMgr::SendAchievementEarned(%u)", achievement->ID); #endif - if(Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId())) { MaNGOS::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); MaNGOS::LocalizedPacketDo say_do(say_builder); guild->BroadcastWorker(say_do,GetPlayer()); } - if(achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH)) { // broadcast realm first reached @@ -597,11 +543,9 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) else { CellPair p = MaNGOS::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); - Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); MaNGOS::LocalizedPacketDo say_do(say_builder); MaNGOS::PlayerDistWorker > say_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); @@ -609,7 +553,6 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); } - WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8); data.append(GetPlayer()->GetPackGUID()); data << uint32(achievement->ID); @@ -617,15 +560,12 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) data << uint32(0); GetPlayer()->SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true); } - void AchievementMgr::SendCriteriaUpdate(uint32 id, CriteriaProgress const* progress) { WorldPacket data(SMSG_CRITERIA_UPDATE, 8+4+8); data << uint32(id); - // the counter is packed like a packed Guid data.appendPackGUID(progress->counter); - data.append(GetPlayer()->GetPackGUID()); data << uint32(0); data << uint32(secsToTimeBitFields(progress->date)); @@ -633,7 +573,6 @@ void AchievementMgr::SendCriteriaUpdate(uint32 id, CriteriaProgress const* progr data << uint32(0); // timer 2 GetPlayer()->SendDirectMessage(&data); } - /** * called at player login. The player might have fulfilled some achievements when the achievement system wasn't working yet */ @@ -643,7 +582,6 @@ void AchievementMgr::CheckAllAchievementCriteria() for(uint32 i=0; iGetSession()->GetSecurity() > SEC_PLAYER) return; - AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) { AchievementCriteriaEntry const *achievementCriteria = (*i); - if (achievementCriteria->groupFlag & ACHIEVEMENT_CRITERIA_GROUP_NOT_IN_GROUP && GetPlayer()->GetGroup()) continue; - AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); if (!achievement) continue; - if ((achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_HORDE && GetPlayer()->GetTeam() != HORDE) || (achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_ALLIANCE && GetPlayer()->GetTeam() != ALLIANCE)) continue; - // don't update already completed criteria if (IsCompletedCriteria(achievementCriteria,achievement)) continue; - switch (type) { // std. case: increment at 1 @@ -729,9 +659,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_HIGHEST); break; - // specialized cases - case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: { // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case @@ -739,7 +667,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if (achievementCriteria->win_bg.bgMapID != GetPlayer()->GetMapId()) continue; - if (achievementCriteria->win_bg.additionalRequirement1_type) { // those requirements couldn't be found in the dbc @@ -753,7 +680,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui BattleGround* bg = GetPlayer()->GetBattleGround(); if (!bg) continue; - switch(achievementCriteria->referredAchievement) { case 161: // AB, Overcome a 500 resource disadvantage @@ -776,7 +702,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // not implemented } } - SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); break; } @@ -787,12 +712,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if(achievementCriteria->kill_creature.creatureID != miscvalue1) continue; - // those requirements couldn't be found in the dbc AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; - SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); break; } @@ -831,7 +754,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // speedup for non-login case if(miscvalue1 && miscvalue1 != achievementCriteria->complete_quests_in_zone.zoneID) continue; - uint32 counter =0; for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) { @@ -872,13 +794,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui BattleGround* bg = GetPlayer()->GetBattleGround(); if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j) notfit = true; - break; } } if(notfit) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; } @@ -887,11 +807,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case if(!miscvalue1) continue; - Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); if(!map || !map->IsDungeon()) continue; - // search case bool found = false; for(int j = 0; achievIdForDangeon[j][0]; ++j) @@ -916,20 +834,17 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!achievIdForDangeon[j][3]) break; // for } - found = true; break; // for } } if(!found) continue; - //FIXME: work only for instances where max==min for players if(((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit) continue; SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; - } case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case @@ -943,11 +858,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case if(!miscvalue1) continue; - // if team check required: must kill by opposition faction if(achievement->ID==318 && miscvalue2==GetPlayer()->GetTeam()) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING: @@ -955,12 +868,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case if(!miscvalue1) continue; - // those requirements couldn't be found in the dbc AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; - // miscvalue1 is the ingame fallheight*100 as stored in dbc SetCriteriaProgress(achievementCriteria, miscvalue1); break; @@ -987,7 +898,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!GetPlayer()->GetQuestRewardStatus(achievementCriteria->complete_quest.questID)) continue; } - // exist many achievements with this criteria, use at this moment hardcoded check to skil simple case switch(achievement->ID) { @@ -1008,7 +918,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; } - SetCriteriaProgress(achievementCriteria, 1); break; } @@ -1023,22 +932,18 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID) continue; - // those requirements couldn't be found in the dbc AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); if(!data) continue; - if(!data->Meets(GetPlayer(),unit)) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; } case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: if(miscvalue1 && miscvalue1!=achievementCriteria->learn_spell.spellID) continue; - if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID)) SetCriteriaProgress(achievementCriteria, 1); break; @@ -1050,7 +955,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if (miscvalue1 != achievementCriteria->loot_type.lootType) continue; - // zone specific if(achievementCriteria->loot_type.lootTypeCount==1) { @@ -1059,7 +963,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!data || !data->Meets(GetPlayer(),unit)) continue; } - SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); break; } @@ -1073,7 +976,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // miscvalue1 contains the personal rating if (!miscvalue1) // no update at login continue; - // additional requirements if(achievementCriteria->win_rated_arena.flag==ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE) { @@ -1086,7 +988,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; } } - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: @@ -1110,28 +1011,23 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(achievementCriteria->explore_area.areaReference); if(!worldOverlayEntry) break; - bool matchFound = false; for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j) { uint32 area_id = worldOverlayEntry->areatableID[j]; if(!area_id) // array have 0 only in empty tail break; - int32 exploreFlag = GetAreaFlagByAreaID(area_id); if(exploreFlag < 0) continue; - uint32 playerIndexOffset = uint32(exploreFlag) / 32; uint32 mask = 1<< (uint32(exploreFlag) % 32); - if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask) { matchFound = true; break; } } - if(matchFound) SetCriteriaProgress(achievementCriteria, 1); break; @@ -1144,7 +1040,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // skip faction check only at loading if (miscvalue1 && miscvalue1 != achievementCriteria->gain_reputation.factionID) continue; - int32 reputation = GetPlayer()->GetReputationMgr().GetReputation(achievementCriteria->gain_reputation.factionID); if (reputation > 0) SetCriteriaProgress(achievementCriteria, reputation); @@ -1173,11 +1068,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(miscvalue2 != achievementCriteria->roll_greed_on_loot.rollValue) continue; ItemPrototype const *pProto = objmgr.GetItemPrototype( miscvalue1 ); - uint32 requiredItemLevel = 0; if (achievementCriteria->ID == 2412 || achievementCriteria->ID == 2358) requiredItemLevel = 185; - if(!pProto || pProto->ItemLevel Meets(GetPlayer(),unit)) continue; } - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; } @@ -1206,17 +1098,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { if (!miscvalue1) continue; - if (achievementCriteria->healing_done.flag == ACHIEVEMENT_CRITERIA_CONDITION_MAP) { if(GetPlayer()->GetMapId() != achievementCriteria->healing_done.mapid) continue; - // map specific case (BG in fact) expected player targeted damage/heal if(!unit || unit->GetTypeId()!=TYPEID_PLAYER) continue; } - SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); break; } @@ -1226,7 +1115,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if (miscvalue1 != achievementCriteria->equip_item.itemID) continue; - SetCriteriaProgress(achievementCriteria, 1); break; case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: @@ -1235,7 +1123,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if (miscvalue1 != achievementCriteria->use_gameobject.goEntry) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: @@ -1243,14 +1130,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if (miscvalue1 != achievementCriteria->fish_in_gameobject.goEntry) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: { if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skillline_spell.skillLine) continue; - uint32 spellCount = 0; for (PlayerSpellMap::const_iterator spellIter = GetPlayer()->GetSpellMap().begin(); spellIter != GetPlayer()->GetSpellMap().end(); @@ -1270,18 +1155,15 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case if (!miscvalue1) continue; - if (achievementCriteria->win_duel.duelCount) { // those requirements couldn't be found in the dbc AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); if (!data) continue; - if (!data->Meets(GetPlayer(),unit)) continue; } - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: @@ -1297,7 +1179,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_line.skillLine) continue; - uint32 spellCount = 0; for (PlayerSpellMap::const_iterator spellIter = GetPlayer()->GetSpellMap().begin(); spellIter != GetPlayer()->GetSpellMap().end(); @@ -1317,13 +1198,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: if (!miscvalue1 || miscvalue1 != achievementCriteria->hk_class.classID) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: if (!miscvalue1 || miscvalue1 != achievementCriteria->hk_race.raceID) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED: @@ -1364,7 +1243,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui } if(IsCompletedCriteria(achievementCriteria,achievement)) CompletedCriteriaFor(achievement); - // check again the completeness for SUMM and REQ COUNT achievements, // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria if (achievement->flags & ACHIEVEMENT_FLAG_SUMM) @@ -1372,7 +1250,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (IsCompletedAchievement(achievement)) CompletedAchievement(achievement); } - if(AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID)) { for(AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) @@ -1381,29 +1258,23 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui } } } - static const uint32 achievIdByClass[MAX_CLASSES] = { 0, 459, 465 , 462, 458, 464, 461, 467, 460, 463, 0, 466 }; static const uint32 achievIdByRace[MAX_RACES] = { 0, 1408, 1410, 1407, 1409, 1413, 1411, 1404, 1412, 0, 1405, 1406 }; - bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement) { // counter can never complete if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER) return false; - if(achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) { // someone on this realm has already completed that achievement if(achievementmgr.IsRealmCompleted(achievement)) return false; } - CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID); if(itr == m_criteriaProgress.end()) return false; - CriteriaProgress const* progress = &itr->second; - switch(achievementCriteria->requiredType) { case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: @@ -1416,12 +1287,10 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve for(int i = 1; i < MAX_CLASSES; ++i) if(achievIdByClass[i] == achievement->ID && i != GetPlayer()->getClass()) return false; - // skip wrong race achievements for(int i = 1; i < MAX_RACES; ++i) if(achievIdByRace[i] == achievement->ID && i != GetPlayer()->getRace()) return false; - // appropriate class/race or not class/race specific return progress->counter >= achievementCriteria->reach_level.level; } @@ -1530,36 +1399,29 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve } return false; } - void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement) { // counter can never complete if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER) return; - // already completed and stored if (m_completedAchievements.find(achievement->ID)!=m_completedAchievements.end()) return; - if (IsCompletedAchievement(achievement)) CompletedAchievement(achievement); } - bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry) { // counter can never complete if(entry->flags & ACHIEVEMENT_FLAG_COUNTER) return false; - // for achievement with referenced achievement criterias get from referenced and counter from self uint32 achievmentForTestId = entry->refAchievement ? entry->refAchievement : entry->ID; uint32 achievmentForTestCount = entry->count; - AchievementCriteriaEntryList const* cList = achievementmgr.GetAchievementCriteriaByAchievement(achievmentForTestId); if(!cList) return false; uint32 count = 0; - // For SUMM achievements, we have to count the progress of each criteria of the achievement. // Oddly, the target count is NOT countained in the achievement, but in each individual criteria if (entry->flags & ACHIEVEMENT_FLAG_SUMM) @@ -1567,62 +1429,48 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry) for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) { AchievementCriteriaEntry const* criteria = *itr; - CriteriaProgressMap::const_iterator itrProgress = m_criteriaProgress.find(criteria->ID); if(itrProgress == m_criteriaProgress.end()) continue; - CriteriaProgress const* progress = &itrProgress->second; count += progress->counter; - // for counters, field4 contains the main count requirement if (count >= criteria->raw.count) return true; } return false; } - // Default case - need complete all or bool completed_all = true; for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) { AchievementCriteriaEntry const* criteria = *itr; - bool completed = IsCompletedCriteria(criteria,entry); - // found an uncompleted criteria, but DONT return false yet - there might be a completed criteria with ACHIEVEMENT_CRITERIA_COMPLETE_FLAG_ALL if(completed) ++count; else completed_all = false; - // completed as have req. count of completed criterias if(achievmentForTestCount > 0 && achievmentForTestCount <= count) return true; } - // all criterias completed requirement if(completed_all && achievmentForTestCount==0) return true; - return false; } - void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype) { if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0) sLog.outDetail("AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow()); - CriteriaProgress *progress = NULL; - CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID); - if(iter == m_criteriaProgress.end()) { // not create record for 0 counter if(changeValue == 0) return; - progress = &m_criteriaProgress[entry->ID]; progress->counter = changeValue; progress->date = time(NULL); @@ -1630,7 +1478,6 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, else { progress = &iter->second; - uint32 newValue = 0; switch(ptype) { @@ -1648,81 +1495,62 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, newValue = progress->counter < changeValue ? changeValue : progress->counter; break; } - // not update (not mark as changed) if counter will have same value if(progress->counter == newValue) return; - progress->counter = newValue; } - progress->changed = true; - if(entry->timeLimit) { time_t now = time(NULL); if(time_t(progress->date + entry->timeLimit) < now) progress->counter = 1; - // also it seems illogical, the timeframe will be extended at every criteria update progress->date = now; } SendCriteriaUpdate(entry->ID,progress); } - void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) { sLog.outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID); - if(!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) return; - if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID)!=m_completedAchievements.end()) return; - SendAchievementEarned(achievement); CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; ca.date = time(NULL); ca.changed = true; - // don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement // TODO: where do set this instead? if(!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) achievementmgr.SetRealmCompleted(achievement); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT); - // reward items and titles if any AchievementReward const* reward = achievementmgr.GetAchievementReward(achievement); - // no rewards if(!reward) return; - // titles if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1]) { if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) GetPlayer()->SetTitle(titleEntry); } - // mail if(reward->sender) { Item* item = reward->itemId ? Item::CreateItem(reward->itemId,1,GetPlayer ()) : NULL; - MailItemsInfo mi; if(item) { // save new item before send item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted - // item mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item); } - int loc_idx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex(); - // subject and text std::string subject = reward->subject; std::string text = reward->text; @@ -1736,36 +1564,28 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) text = loc->text[loc_idx]; } } - uint32 itemTextId = objmgr.CreateItemText( text ); - WorldSession::SendMailTo(GetPlayer(), MAIL_CREATURE, MAIL_STATIONERY_NORMAL, reward->sender, GetPlayer()->GetGUIDLow(), subject, itemTextId , &mi, 0, 0, MAIL_CHECK_MASK_NONE); } } - void AchievementMgr::SendAllAchievementData() { uint32 size = 18 + m_completedAchievements.size()*8 + m_criteriaProgress.size() * 36; - bool send = false; - WorldPacket data(SMSG_ALL_ACHIEVEMENT_DATA); if( size < 0x8000 ) data.resize( size ); else data.resize( 0x7fff ); // More than this causes client trouble - CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); CriteriaProgressMap::const_iterator iter2 = m_criteriaProgress.begin(); - bool cAchievements = false; bool cProgress = false; while( !cAchievements || !cProgress ) { data.clear(); send = false; - if( !cAchievements ) { for(; iter != m_completedAchievements.end() && !send; ++iter) @@ -1774,11 +1594,9 @@ void AchievementMgr::SendAllAchievementData() data << uint32(secsToTimeBitFields(iter->second.date)); send = data.size() > 0x7f00; } - if( iter == m_completedAchievements.end() ) cAchievements = true; } - data << int32(-1); for(; iter2 != m_criteriaProgress.end() && !send; ++iter2) { @@ -1791,15 +1609,12 @@ void AchievementMgr::SendAllAchievementData() data << uint32(0); send = data.size() > 0x7f00; } - if( iter2 == m_criteriaProgress.end() ) cProgress = true; - data << int32(-1); GetPlayer()->GetSession()->SendPacket(&data); } } - void AchievementMgr::SendRespondInspectAchievements(Player* player) { // since we don't know the exact size of the packed GUIDs this is just an approximation @@ -1808,7 +1623,6 @@ void AchievementMgr::SendRespondInspectAchievements(Player* player) BuildAllDataPacket(&data); player->GetSession()->SendPacket(&data); } - /** * used by SMSG_RESPOND_INSPECT_ACHIEVEMENT */ @@ -1820,7 +1634,6 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket *data) *data << uint32(secsToTimeBitFields(iter->second.date)); } *data << int32(-1); - for(CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter) { *data << uint32(iter->first); @@ -1831,91 +1644,72 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket *data) *data << uint32(0); *data << uint32(0); } - *data << int32(-1); } - //========================================================== AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteriaByType(AchievementCriteriaTypes type) { return m_AchievementCriteriasByType[type]; } - void AchievementGlobalMgr::LoadAchievementCriteriaList() { if(sAchievementCriteriaStore.GetNumRows()==0) { barGoLink bar(1); bar.step(); - sLog.outString(); sLog.outErrorDb(">> Loaded 0 achievement criteria."); return; } - barGoLink bar( sAchievementCriteriaStore.GetNumRows() ); for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) { bar.step(); - AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); if(!criteria) continue; - m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria); m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria); } - sLog.outString(); sLog.outString(">> Loaded %lu achievement criteria.",(unsigned long)m_AchievementCriteriasByType->size()); } - void AchievementGlobalMgr::LoadAchievementReferenceList() { if(sAchievementStore.GetNumRows()==0) { barGoLink bar(1); bar.step(); - sLog.outString(); sLog.outErrorDb(">> Loaded 0 achievement references."); return; } - uint32 count = 0; barGoLink bar( sAchievementStore.GetNumRows() ); for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId) { bar.step(); - AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId); if(!achievement || !achievement->refAchievement) continue; - m_AchievementListByReferencedId[achievement->refAchievement].push_back(achievement); ++count; } - sLog.outString(); sLog.outString(">> Loaded %u achievement references.",count); } - void AchievementGlobalMgr::LoadAchievementCriteriaData() { m_criteriaDataMap.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data"); - if(!result) { barGoLink bar(1); bar.step(); - sLog.outString(); sLog.outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); return; } - uint32 count = 0; uint32 disabled_count = 0; barGoLink bar(result->GetRowCount()); @@ -1924,45 +1718,34 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() bar.step(); Field *fields = result->Fetch(); uint32 criteria_id = fields[0].GetUInt32(); - AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id); - if (!criteria) { sLog.outErrorDb( "Table `achievement_criteria_data` have data for not existed criteria (Entry: %u), ignore.", criteria_id); continue; } - AchievementCriteriaData data(fields[1].GetUInt32(),fields[2].GetUInt32(),fields[3].GetUInt32()); - if (!data.IsValid(criteria)) { continue; } - // this will allocate empty data set storage AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id]; - if (data.dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED) ++disabled_count; - // add real data only for not NONE data types if (data.dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE) dataSet.Add(data); - // counting data by and data types ++count; } while(result->NextRow()); - delete result; - // post loading checks for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) { AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); if(!criteria) continue; - switch(criteria->requiredType) { case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: @@ -1976,7 +1759,6 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement); if(!achievement) continue; - // exist many achievements with this criteria, use at this moment hardcoded check to skil simple case switch(achievement->ID) { @@ -2016,35 +1798,28 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() default: // type not use DB data, ignore continue; } - if(!GetCriteriaDataSet(criteria)) sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } - sLog.outString(); sLog.outString(">> Loaded %u additional achievement criteria data (%u disabled).",count,disabled_count); } - void AchievementGlobalMgr::LoadCompletedAchievements() { QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement"); - if(!result) { barGoLink bar(1); bar.step(); - sLog.outString(); sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty."); return; } - barGoLink bar(result->GetRowCount()); do { bar.step(); Field *fields = result->Fetch(); - uint32 achievement_id = fields[0].GetUInt32(); if(!sAchievementStore.LookupEntry(achievement_id)) { @@ -2053,41 +1828,30 @@ void AchievementGlobalMgr::LoadCompletedAchievements() CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE achievement = %u",achievement_id); continue; } - m_allCompletedAchievements.insert(achievement_id); } while(result->NextRow()); - delete result; - sLog.outString(); sLog.outString(">> Loaded %lu realm completed achievements.",(unsigned long)m_allCompletedAchievements.size()); } - void AchievementGlobalMgr::LoadRewards() { m_achievementRewards.clear(); // need for reload case - // 0 1 2 3 4 5 6 QueryResult *result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward"); - if(!result) { barGoLink bar(1); - bar.step(); - sLog.outString(); sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); return; } - uint32 count = 0; barGoLink bar(result->GetRowCount()); - do { bar.step(); - Field *fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); if (!sAchievementStore.LookupEntry(entry)) @@ -2095,7 +1859,6 @@ void AchievementGlobalMgr::LoadRewards() sLog.outErrorDb( "Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); continue; } - AchievementReward reward; reward.titleId[0] = fields[1].GetUInt32(); reward.titleId[1] = fields[2].GetUInt32(); @@ -2103,17 +1866,14 @@ void AchievementGlobalMgr::LoadRewards() reward.sender = fields[4].GetUInt32(); reward.subject = fields[5].GetCppString(); reward.text = fields[6].GetCppString(); - if ((reward.titleId[0]==0)!=(reward.titleId[1]==0)) sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) only for one from teams.", entry, reward.titleId[0], reward.titleId[1]); - // must be title or mail at least if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender) { sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); continue; } - if (reward.titleId[0]) { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]); @@ -2123,7 +1883,6 @@ void AchievementGlobalMgr::LoadRewards() reward.titleId[0] = 0; } } - if (reward.titleId[1]) { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]); @@ -2133,7 +1892,6 @@ void AchievementGlobalMgr::LoadRewards() reward.titleId[1] = 0; } } - //check mail data before item for report including wrong item case if (reward.sender) { @@ -2147,14 +1905,11 @@ void AchievementGlobalMgr::LoadRewards() { if (reward.itemId) sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have item reward, item will not rewarded", entry); - if (!reward.subject.empty()) sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have mail subject.", entry); - if (!reward.text.empty()) sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have mail text.", entry); } - if (reward.itemId) { if (!objmgr.GetItemPrototype(reward.itemId)) @@ -2163,52 +1918,37 @@ void AchievementGlobalMgr::LoadRewards() reward.itemId = 0; } } - m_achievementRewards[entry] = reward; ++count; - } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString( ">> Loaded %u achievement rewards", count ); } - void AchievementGlobalMgr::LoadRewardLocales() { m_achievementRewardLocales.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward"); - if(!result) { barGoLink bar(1); - bar.step(); - sLog.outString(); sLog.outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty."); return; } - barGoLink bar(result->GetRowCount()); - do { Field *fields = result->Fetch(); bar.step(); - uint32 entry = fields[0].GetUInt32(); - if(m_achievementRewards.find(entry)==m_achievementRewards.end()) { sLog.outErrorDb( "Table `locales_achievement_reward` (Entry: %u) has locale strings for not existed achievement reward .", entry); continue; } - AchievementRewardLocale& data = m_achievementRewardLocales[entry]; - for(int i = 1; i < MAX_LOCALE; ++i) { std::string str = fields[1+2*(i-1)].GetCppString(); @@ -2219,7 +1959,6 @@ void AchievementGlobalMgr::LoadRewardLocales() { if(data.subject.size() <= size_t(idx)) data.subject.resize(idx+1); - data.subject[idx] = str; } } @@ -2231,16 +1970,13 @@ void AchievementGlobalMgr::LoadRewardLocales() { if(data.text.size() <= size_t(idx)) data.text.resize(idx+1); - data.text[idx] = str; } } } } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString( ">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size() ); } diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h index 5020539bb5c..2a2f02e243f 100644 --- a/src/game/AchievementMgr.h +++ b/src/game/AchievementMgr.h @@ -17,29 +17,23 @@ */ #ifndef __MANGOS_ACHIEVEMENTMGR_H #define __MANGOS_ACHIEVEMENTMGR_H - #include #include - #include "Common.h" #include "Policies/Singleton.h" #include "Database/DatabaseEnv.h" #include "DBCEnums.h" #include "DBCStores.h" - typedef std::list AchievementCriteriaEntryList; typedef std::list AchievementEntryList; - typedef std::map AchievementCriteriaListByAchievement; typedef std::map AchievementListByReferencedId; - struct CriteriaProgress { uint32 counter; time_t date; bool changed; }; - enum AchievementCriteriaDataType { // value1 value2 comment ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0 @@ -61,12 +55,9 @@ enum AchievementCriteriaDataType ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY = 16,// holiday_id 0 event in holiday time ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE = 17,// min_score max_score player's team win bg and opposition team have team score in range }; - #define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 18 // maximum value in AchievementCriteriaDataType enum - class Player; class Unit; - struct AchievementCriteriaData { AchievementCriteriaDataType dataType; @@ -160,23 +151,19 @@ struct AchievementCriteriaData uint32 value2; } raw; }; - AchievementCriteriaData() : dataType(ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE) { raw.value1 = 0; raw.value2 = 0; } - AchievementCriteriaData(uint32 _dataType, uint32 _value1, uint32 _value2) : dataType(AchievementCriteriaDataType(_dataType)) { raw.value1 = _value1; raw.value2 = _value2; } - bool IsValid(AchievementCriteriaEntry const* criteria); bool Meets(Player const* source, Unit const* target, uint32 miscvalue1 = 0) const; }; - struct AchievementCriteriaDataSet { typedef std::vector Storage; @@ -186,9 +173,7 @@ struct AchievementCriteriaDataSet Storage storage; }; - typedef std::map AchievementCriteriaDataMap; - struct AchievementReward { uint32 titleId[2]; @@ -197,37 +182,29 @@ struct AchievementReward std::string subject; std::string text; }; - typedef std::map AchievementRewards; - struct AchievementRewardLocale { std::vector subject; std::vector text; }; - typedef std::map AchievementRewardLocales; - struct CompletedAchievementData { time_t date; bool changed; }; - typedef UNORDERED_MAP CriteriaProgressMap; typedef UNORDERED_MAP CompletedAchievementMap; - class Unit; class Player; class WorldPacket; - class AchievementMgr { public: AchievementMgr(Player* pl); ~AchievementMgr(); - void Reset(); static void DeleteFromDB(uint32 lowguid); void LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult); @@ -239,7 +216,6 @@ class AchievementMgr void SendAllAchievementData(); void SendRespondInspectAchievements(Player* player); Player* GetPlayer() { return m_player;} - private: enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST }; void SendAchievementEarned(AchievementEntry const* achievement); @@ -250,12 +226,10 @@ class AchievementMgr bool IsCompletedAchievement(AchievementEntry const* entry); void CompleteAchievementsWithRefs(AchievementEntry const* entry); void BuildAllDataPacket(WorldPacket *data); - Player* m_player; CriteriaProgressMap m_criteriaProgress; CompletedAchievementMap m_completedAchievements; }; - class AchievementGlobalMgr { public: @@ -265,41 +239,34 @@ class AchievementGlobalMgr AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id); return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : NULL; } - AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const { AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id); return itr != m_AchievementListByReferencedId.end() ? &itr->second : NULL; } - AchievementReward const* GetAchievementReward(AchievementEntry const* achievement) const { AchievementRewards::const_iterator iter = m_achievementRewards.find(achievement->ID); return iter!=m_achievementRewards.end() ? &iter->second : NULL; } - AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const { AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID); return iter!=m_achievementRewardLocales.end() ? &iter->second : NULL; } - AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria) { AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID); return iter!=m_criteriaDataMap.end() ? &iter->second : NULL; } - bool IsRealmCompleted(AchievementEntry const* achievement) const { return m_allCompletedAchievements.find(achievement->ID) != m_allCompletedAchievements.end(); } - void SetRealmCompleted(AchievementEntry const* achievement) { m_allCompletedAchievements.insert(achievement->ID); } - void LoadAchievementCriteriaList(); void LoadAchievementCriteriaData(); void LoadAchievementReferenceList(); @@ -308,21 +275,16 @@ class AchievementGlobalMgr void LoadRewardLocales(); private: AchievementCriteriaDataMap m_criteriaDataMap; - // store achievement criterias by type to speed up lookup AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]; // store achievement criterias by achievement to speed up lookup AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement; // store achievements by referenced achievement id to speed up lookup AchievementListByReferencedId m_AchievementListByReferencedId; - typedef std::set AllCompletedAchievements; AllCompletedAchievements m_allCompletedAchievements; - AchievementRewards m_achievementRewards; AchievementRewardLocales m_achievementRewardLocales; }; - #define achievementmgr Trinity::Singleton::Instance() - #endif diff --git a/src/game/AnimalRandomMovementGenerator.h b/src/game/AnimalRandomMovementGenerator.h index 9c64edcaa44..4767eff91ad 100644 --- a/src/game/AnimalRandomMovementGenerator.h +++ b/src/game/AnimalRandomMovementGenerator.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_ANIMAL_RANDOMMOVEMENTGENERATOR_H #define TRINITY_ANIMAL_RANDOMMOVEMENTGENERATOR_H - /** AnimalRandomMovementGenerator follows the research on * quantifying scale-dependant effects of animal movement * with simple per-location models (R.H. Gardner, R.V. O'Neil, diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 22d121c38c1..c00c22b7b48 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -15,13 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "ObjectMgr.h" #include "WorldPacket.h" - #include "ArenaTeam.h" #include "World.h" - void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) { int32 memberRating = int32(personal_rating) + mod; @@ -30,7 +27,6 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot*6) + 5, personal_rating); //sLog.outArena("Modify personal rating for player %s: personal rating %u, mod %d, rating %d", plr->GetName(), personal_rating, mod, rating); } - ArenaTeam::ArenaTeam() { m_TeamId = 0; @@ -52,29 +48,22 @@ ArenaTeam::ArenaTeam() m_stats.wins_week = 0; m_stats.wins_season = 0; } - ArenaTeam::~ArenaTeam() { } - bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName) { if(!objmgr.GetPlayer(captainGuid)) // player not exist return false; if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist return false; - sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid)); - m_CaptainGuid = captainGuid; m_Name = ArenaTeamName; m_Type = type; - m_TeamId = objmgr.GenerateArenaTeamId(); - // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB CharacterDatabase.escape_string(ArenaTeamName); - CharacterDatabase.BeginTransaction(); // CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", m_TeamId); - MAX(arenateam)+1 not exist CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", m_TeamId); @@ -83,23 +72,18 @@ bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam m_TeamId, ArenaTeamName.c_str(), GUID_LOPART(m_CaptainGuid), m_Type, m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor); CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES " "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", m_TeamId, m_stats.rating, m_stats.games_week, m_stats.wins_week, m_stats.games_season, m_stats.wins_season, m_stats.rank); - CharacterDatabase.CommitTransaction(); - AddMember(m_CaptainGuid); sLog.outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain GUID: %u]", GetId(), GetType(), GetCaptain()); return true; } - bool ArenaTeam::AddMember(const uint64& PlayerGuid) { std::string plName; uint8 plClass; - // arena team is full (can't have more than type * 2 players!) if(GetMembersSize() >= GetType() * 2) return false; - Player *pl = objmgr.GetPlayer(PlayerGuid); if(pl) { @@ -108,7 +92,6 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) sLog.outError("Arena::AddMember() : player already in this sized team"); return false; } - plClass = (uint8)pl->getClass(); plName = pl->GetName(); } @@ -118,11 +101,9 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) QueryResult *result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid)); if(!result) return false; - plName = (*result)[0].GetCppString(); plClass = (*result)[1].GetUInt8(); delete result; - // check if player already in arenateam of that size if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0) { @@ -130,11 +111,9 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) return false; } } - // remove all player signs from another petitions // this will be prevent attempt joining player to many arenateams and corrupt arena team data integrity Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); - ArenaTeamMember newmember; newmember.name = plName; newmember.guid = PlayerGuid; @@ -155,15 +134,12 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) newmember.personal_rating = 1500; } m_members.push_back(newmember); - CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating ); - if(pl) { pl->SetInArenaTeam(m_TeamId, GetSlot()); pl->SetArenaTeamIdInvited(0); pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot()*6) + 5, newmember.personal_rating ); - // hide promote/remove buttons if(m_CaptainGuid != PlayerGuid) pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 1, 1); @@ -171,16 +147,12 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) } return true; } - bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId) { QueryResult *result = CharacterDatabase.PQuery("SELECT arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId); - if(!result) return false; - Field *fields = result->Fetch(); - m_TeamId = fields[0].GetUInt32(); m_Name = fields[1].GetCppString(); m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -190,13 +162,10 @@ bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId) m_EmblemColor = fields[6].GetUInt32(); m_BorderStyle = fields[7].GetUInt32(); m_BorderColor = fields[8].GetUInt32(); - delete result; - // only load here, so additional checks can be made LoadStatsFromDB(ArenaTeamId); LoadMembersFromDB(ArenaTeamId); - if(Empty()) { // arena team is empty, delete from db @@ -207,30 +176,23 @@ bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId) CharacterDatabase.CommitTransaction(); return false; } - return true; } - void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId) { // 0 1 2 3 4 5 QueryResult *result = CharacterDatabase.PQuery("SELECT rating,games,wins,played,wins2,rank FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId); - if(!result) return; - Field *fields = result->Fetch(); - m_stats.rating = fields[0].GetUInt32(); m_stats.games_week = fields[1].GetUInt32(); m_stats.wins_week = fields[2].GetUInt32(); m_stats.games_season = fields[3].GetUInt32(); m_stats.wins_season = fields[4].GetUInt32(); m_stats.rank = fields[5].GetUInt32(); - delete result; } - void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) { // 0 1 2 3 4 5 6 7 @@ -240,7 +202,6 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) "WHERE member.arenateamid = '%u'", ArenaTeamId); if(!result) return; - do { Field *fields = result->Fetch(); @@ -257,20 +218,16 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) }while( result->NextRow() ); delete result; } - void ArenaTeam::SetCaptain(const uint64& guid) { // disable remove/promote buttons Player *oldcaptain = objmgr.GetPlayer(GetCaptain()); if(oldcaptain) oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1); - // set new captain m_CaptainGuid = guid; - // update database CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), m_TeamId); - // enable remove/promote buttons Player *newcaptain = objmgr.GetPlayer(guid); if(newcaptain) @@ -279,7 +236,6 @@ void ArenaTeam::SetCaptain(const uint64& guid) sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUID(), GetId(), GetType()); } } - void ArenaTeam::DelMember(uint64 guid) { for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) @@ -290,9 +246,7 @@ void ArenaTeam::DelMember(uint64 guid) break; } } - Player *player = objmgr.GetPlayer(guid); - if(player) { player->SetInArenaTeam(0, GetSlot()); @@ -306,23 +260,19 @@ void ArenaTeam::DelMember(uint64 guid) } CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); } - void ArenaTeam::Disband(WorldSession *session) { // event WorldPacket data; session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), ""); BroadcastPacket(&data); - while (!m_members.empty()) { // Removing from members is done in DelMember. DelMember(m_members.front().guid); } - if(Player *player = session->GetPlayer()) sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); - CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId); CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member @@ -330,23 +280,18 @@ void ArenaTeam::Disband(WorldSession *session) CharacterDatabase.CommitTransaction(); objmgr.RemoveArenaTeam(m_TeamId); } - void ArenaTeam::Roster(WorldSession *session) { Player *pl = NULL; - uint8 unk308 = 0; - WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); data << uint32(GetId()); // team id data << uint8(unk308); // 308 unknown value but affect packet structure data << uint32(GetMembersSize()); // members count data << uint32(GetType()); // arena team type? - for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { pl = objmgr.GetPlayer(itr->guid); - data << uint64(itr->guid); // guid data << uint8((pl ? 1 : 0)); // online flag data << itr->name; // member name @@ -364,11 +309,9 @@ void ArenaTeam::Roster(WorldSession *session) data << float(0.0); // 308 unk } } - session->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); } - void ArenaTeam::Query(WorldSession *session) { WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1); @@ -383,7 +326,6 @@ void ArenaTeam::Query(WorldSession *session) session->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); } - void ArenaTeam::Stats(WorldSession *session) { WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); @@ -396,7 +338,6 @@ void ArenaTeam::Stats(WorldSession *session) data << uint32(m_stats.rank); // rank session->SendPacket(&data); } - void ArenaTeam::NotifyStatsChanged() { // this is called after a rated match ended @@ -408,13 +349,11 @@ void ArenaTeam::NotifyStatsChanged() Stats(plr->GetSession()); } } - void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) { ArenaTeamMember* member = GetMember(guid); if(!member) return; - WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << uint64(guid); // player guid data << uint8(GetSlot()); // slot (0...2) @@ -426,7 +365,6 @@ void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) data << uint32(member->personal_rating); // personal rating session->SendPacket(&data); } - void ArenaTeam::SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor) { m_BackgroundColor = backgroundColor; @@ -434,10 +372,8 @@ void ArenaTeam::SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emb m_EmblemColor = emblemColor; m_BorderStyle = borderStyle; m_BorderColor = borderColor; - CharacterDatabase.PExecute("UPDATE arena_team SET BackgroundColor='%u', EmblemStyle='%u', EmblemColor='%u', BorderStyle='%u', BorderColor='%u' WHERE arenateamid='%u'", m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_TeamId); } - void ArenaTeam::SetStats(uint32 stat_type, uint32 value) { switch(stat_type) @@ -471,7 +407,6 @@ void ArenaTeam::SetStats(uint32 stat_type, uint32 value) break; } } - void ArenaTeam::BroadcastPacket(WorldPacket *packet) { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) @@ -481,7 +416,6 @@ void ArenaTeam::BroadcastPacket(WorldPacket *packet) player->GetSession()->SendPacket(packet); } } - uint8 ArenaTeam::GetSlotByType( uint32 type ) { switch(type) @@ -495,56 +429,45 @@ uint8 ArenaTeam::GetSlotByType( uint32 type ) sLog.outError("FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } - bool ArenaTeam::HaveMember( const uint64& guid ) const { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if(itr->guid == guid) return true; - return false; } - uint32 ArenaTeam::GetPoints(uint32 MemberRating) { // returns how many points would be awarded with this team type with this rating float points; - uint32 rating = MemberRating + 150 < m_stats.rating ? MemberRating : m_stats.rating; - if(rating<=1500) // points = (float)1500 * 0.22f + 14.0f; points = 344.0f; // 3.1 change - teams with rating below 1500 get arena points for 1500 rating else points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating)); - // type penalties for <5v5 teams if(m_Type == ARENA_TEAM_2v2) points *= 0.76f; else if(m_Type == ARENA_TEAM_3v3) points *= 0.88f; - return (uint32) points; } - float ArenaTeam::GetChanceAgainst(uint32 own_rating, uint32 enemy_rating) { // returns the chance to win against a team with the given rating, used in the rating adjustment calculation // ELO system - if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) >= 6) if (enemy_rating < 1300) enemy_rating = 1300; return 1.0f/(1.0f+exp(log(10.0f)*(float)((float)enemy_rating - (float)own_rating)/400.0f)); } - void ArenaTeam::FinishGame(int32 mod) { if (int32(m_stats.rating) + mod < 0) m_stats.rating = 0; else m_stats.rating += mod; - m_stats.games_week += 1; m_stats.games_season += 1; // update team's rank @@ -556,7 +479,6 @@ void ArenaTeam::FinishGame(int32 mod) ++m_stats.rank; } } - int32 ArenaTeam::WonAgainst(uint32 againstRating) { // called when the team has won @@ -568,11 +490,9 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating) FinishGame(mod); m_stats.wins_week += 1; m_stats.wins_season += 1; - // return the rating change, used to display it on the results screen return mod; } - int32 ArenaTeam::LostAgainst(uint32 againstRating) { // called when the team has lost @@ -582,11 +502,9 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating) int32 mod = (int32)ceil(32.0f * (0.0f - chance)); // modify the team stats accordingly FinishGame(mod); - // return the rating change, used to display it on the results screen return mod; } - void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) { // called for each participant of a match after losing @@ -608,7 +526,6 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) } } } - void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating) { // called for offline player after ending rated arena match! @@ -630,7 +547,6 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating) } } } - void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) { // called for each participant after winning a match @@ -654,7 +570,6 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) } } } - void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) { // called after a match has ended and the stats are already modified @@ -671,7 +586,6 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) if (itr->games_week >= min_plays) points_to_add = GetPoints(itr->personal_rating); // OBSOLETE : CharacterDatabase.PExecute("UPDATE arena_team_member SET points_to_add = '%u' WHERE arenateamid = '%u' AND guid = '%u'", points_to_add, m_TeamId, itr->guid); - std::map::iterator plr_itr = PlayerPoints.find(GUID_LOPART(itr->guid)); if (plr_itr != PlayerPoints.end()) { @@ -683,7 +597,6 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) PlayerPoints[GUID_LOPART(itr->guid)] = points_to_add; } } - void ArenaTeam::SaveToDB() { // save team and member stats to db @@ -696,7 +609,6 @@ void ArenaTeam::SaveToDB() } CharacterDatabase.CommitTransaction(); } - void ArenaTeam::FinishWeek() { m_stats.games_week = 0; // played this week @@ -707,7 +619,6 @@ void ArenaTeam::FinishWeek() itr->wins_week = 0; } } - bool ArenaTeam::IsFighting() const { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) @@ -720,7 +631,6 @@ bool ArenaTeam::IsFighting() const } return false; } - /* arenateam fields (id from 2.3.3 client): 1414 - arena team id 2v2 diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index dbeac2f09f0..fe7a4d04ea5 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITYCORE_ARENATEAM_H #define TRINITYCORE_ARENATEAM_H - enum ArenaTeamCommandTypes { ERR_ARENA_TEAM_CREATE_S = 0x00, @@ -29,7 +27,6 @@ enum ArenaTeamCommandTypes ERR_ARENA_TEAM_QUIT_S = 0x03, ERR_ARENA_TEAM_FOUNDER_S = 0x0C // need check, probably wrong... }; - enum ArenaTeamCommandErrors { //ARENA_TEAM_PLAYER_NO_MORE_IN_ARENA_TEAM = 0x00, @@ -49,7 +46,6 @@ enum ArenaTeamCommandErrors ERR_ARENA_TEAM_PLAYER_TO_LOW = 0x15, ERR_ARENA_TEAM_FULL = 0x16 }; - enum ArenaTeamEvents { ERR_ARENA_TEAM_JOIN_SS = 3, // player name + arena team name @@ -59,7 +55,6 @@ enum ArenaTeamEvents ERR_ARENA_TEAM_LEADER_CHANGED_SSS = 7, // old captain + new captain + arena team name ERR_ARENA_TEAM_DISBANDED_S = 8 // captain name + arena team name }; - /* need info how to send these ones: ERR_ARENA_TEAM_YOU_JOIN_S - client show it automatically when accept invite @@ -67,7 +62,6 @@ ERR_ARENA_TEAM_TARGET_TOO_LOW_S ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S ERR_ARENA_TEAM_LEVEL_TOO_LOW_I */ - enum ArenaTeamStatTypes { STAT_TYPE_RATING = 0, @@ -77,14 +71,12 @@ enum ArenaTeamStatTypes STAT_TYPE_WINS_SEASON = 4, STAT_TYPE_RANK = 5 }; - enum ArenaTeamTypes { ARENA_TEAM_2v2 = 2, ARENA_TEAM_3v3 = 3, ARENA_TEAM_5v5 = 5 }; - struct ArenaTeamMember { uint64 guid; @@ -95,10 +87,8 @@ struct ArenaTeamMember uint32 games_season; uint32 wins_season; uint32 personal_rating; - void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot); }; - struct ArenaTeamStats { uint32 rating; @@ -108,20 +98,15 @@ struct ArenaTeamStats uint32 wins_season; uint32 rank; }; - #define MAX_ARENA_SLOT 3 // 0..2 slots - class ArenaTeam { public: ArenaTeam(); ~ArenaTeam(); - bool Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName); void Disband(WorldSession *session); - typedef std::list MemberList; - uint32 GetId() const { return m_TeamId; } uint32 GetType() const { return m_Type; } uint8 GetSlot() const { return GetSlotByType(GetType()); } @@ -131,61 +116,46 @@ class ArenaTeam const ArenaTeamStats& GetStats() const { return m_stats; } void SetStats(uint32 stat_type, uint32 value); uint32 GetRating() const { return m_stats.rating; } - uint32 GetEmblemStyle() const { return m_EmblemStyle; } uint32 GetEmblemColor() const { return m_EmblemColor; } uint32 GetBorderStyle() const { return m_BorderStyle; } uint32 GetBorderColor() const { return m_BorderColor; } uint32 GetBackgroundColor() const { return m_BackgroundColor; } - void SetCaptain(const uint64& guid); bool AddMember(const uint64& PlayerGuid); - // Shouldn't be const uint64& ed, because than can reference guid from members on Disband // and this method removes given record from list. So invalid reference can happen. void DelMember(uint64 guid); - void SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor); - size_t GetMembersSize() const { return m_members.size(); } bool Empty() const { return m_members.empty(); } MemberList::iterator m_membersBegin() { return m_members.begin(); } MemberList::iterator m_membersEnd() { return m_members.end(); } bool HaveMember(const uint64& guid) const; - ArenaTeamMember* GetMember(const uint64& guid) { for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if(itr->guid == guid) return &(*itr); - return NULL; } - ArenaTeamMember* GetMember(const std::string& name) { for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if(itr->name == name) return &(*itr); - return NULL; } - bool IsFighting() const; - bool LoadArenaTeamFromDB(uint32 ArenaTeamId); void LoadMembersFromDB(uint32 ArenaTeamId); void LoadStatsFromDB(uint32 ArenaTeamId); - void SaveToDB(); - void BroadcastPacket(WorldPacket *packet); - void Roster(WorldSession *session); void Query(WorldSession *session); void Stats(WorldSession *session); void InspectStats(WorldSession *session, uint64 guid); - uint32 GetPoints(uint32 MemberRating); float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating); int32 WonAgainst(uint32 againstRating); @@ -193,27 +163,20 @@ class ArenaTeam int32 LostAgainst(uint32 againstRating); void MemberLost(Player * plr, uint32 againstRating); void OfflineMemberLost(uint64 guid, uint32 againstRating); - void UpdateArenaPointsHelper(std::map & PlayerPoints); - void NotifyStatsChanged(); - void FinishWeek(); void FinishGame(int32 mod); - protected: - uint32 m_TeamId; uint32 m_Type; std::string m_Name; uint64 m_CaptainGuid; - uint32 m_BackgroundColor; // ARGB format uint32 m_EmblemStyle; // icon id uint32 m_EmblemColor; // ARGB format uint32 m_BorderStyle; // border image id uint32 m_BorderColor; // ARGB format - MemberList m_members; ArenaTeamStats m_stats; }; diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index c7ecf5b1d80..b5ecab3d424 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -17,26 +17,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Player.h" #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Database/DatabaseEnv.h" - #include "ArenaTeam.h" #include "Log.h" #include "ObjectMgr.h" #include "SocialMgr.h" - void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) { sLog.outDebug("MSG_INSPECT_ARENA_TEAMS"); - uint64 guid; recv_data >> guid; sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); - if(Player *plr = objmgr.GetPlayer(guid)) { for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i) @@ -49,160 +44,123 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) } } } - void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data) { sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_QUERY" ); - uint32 ArenaTeamId; recv_data >> ArenaTeamId; - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); if(!arenateam) // arena team not found return; - arenateam->Query(this); arenateam->Stats(this); } - void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) { sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_ROSTER" ); - uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); if(!arenateam) return; - arenateam->Roster(this); } - void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_ARENA_TEAM_INVITE"); - uint32 ArenaTeamId; // arena team id std::string Invitedname; - Player * player = NULL; - recv_data >> ArenaTeamId >> Invitedname; - if(!Invitedname.empty()) { if(!normalizePlayerName(Invitedname)) return; - player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str()); } - if(!player) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", Invitedname, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } - if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW); return; } - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); if(!arenateam) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM); return; } - // OK result but not send invite if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow())) return; - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); return; } - if(player->GetArenaTeamId(arenateam->GetSlot())) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S); return; } - if(player->GetArenaTeamIdInvited()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; } - if(arenateam->GetMembersSize() >= arenateam->GetType() * 2) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,arenateam->GetName(),"",ERR_ARENA_TEAM_FULL); return; } - sLog.outDebug("Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName(), Invitedname.c_str()); - player->SetArenaTeamIdInvited(arenateam->GetId()); - WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8+10)); data << GetPlayer()->GetName(); data << arenateam->GetName(); player->GetSession()->SendPacket(&data); - sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_INVITE"); } - void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode - ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited()); if(!at) return; - if(_player->GetArenaTeamId(at->GetSlot())) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size return; } - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != objmgr.GetPlayerTeamByGUID(at->GetCaptain())) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_NOT_ALLIED);// not let enemies sign petition return; } - if(!at->AddMember(_player->GetGUID())) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found return; } - // event WorldPacket data; BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), ""); at->BroadcastPacket(&data); } - void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_ARENA_TEAM_DECLINE"); // empty opcode - _player->SetArenaTeamIdInvited(0); // no more invited } - void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_ARENA_TEAM_LEAVE"); - uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); if(!at) return; @@ -219,124 +177,94 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) delete at; return; } - at->DelMember(_player->GetGUID()); - // event WorldPacket data; BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEAVE_SS, 2, _player->GetName(), at->GetName(), ""); at->BroadcastPacket(&data); - //send you are no longer member of team SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0); } - void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_ARENA_TEAM_DISBAND"); - uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); if(!at) return; - if(at->GetCaptain() != _player->GetGUID()) return; - if (at->IsFighting()) return; - at->Disband(this); delete at; } - void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_ARENA_TEAM_REMOVE"); - uint32 ArenaTeamId; std::string name; - recv_data >> ArenaTeamId; recv_data >> name; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); if(!at) // arena team not found return; - if(at->GetCaptain() != _player->GetGUID()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS); return; } - if(!normalizePlayerName(name)) return; - ArenaTeamMember* member = at->GetMember(name); if(!member) // member not found { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } - if(at->GetCaptain() == member->guid) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S); return; } - at->DelMember(member->guid); - // event WorldPacket data; BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName()); at->BroadcastPacket(&data); } - void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_ARENA_TEAM_LEADER"); - uint32 ArenaTeamId; std::string name; - recv_data >> ArenaTeamId; recv_data >> name; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); if(!at) // arena team not found return; - if(at->GetCaptain() != _player->GetGUID()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS); return; } - if(!normalizePlayerName(name)) return; - ArenaTeamMember* member = at->GetMember(name); if(!member) // member not found { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } - if(at->GetCaptain() == member->guid) // target player already captain return; - at->SetCaptain(member->guid); - // event WorldPacket data; BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 3, _player->GetName(), name, at->GetName()); at->BroadcastPacket(&data); } - void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id) { WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+team.length()+1+player.length()+1+4); @@ -346,7 +274,6 @@ void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::str data << error_id; SendPacket(&data); } - void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3) { data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1); @@ -371,7 +298,6 @@ void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, u return; } } - void WorldSession::SendNotInArenaTeamPacket(uint8 type) { WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team @@ -381,15 +307,12 @@ void WorldSession::SendNotInArenaTeamPacket(uint8 type) data << uint8(type); // team type (2=2v2,3=3v3,5=5v5), can be used for custom types... SendPacket(&data); } - /* +ERR_ARENA_NO_TEAM_II "You are not in a %dv%d arena team" - +ERR_ARENA_TEAM_CREATE_S "%s created. To disband, use /teamdisband [2v2, 3v3, 5v5]." +ERR_ARENA_TEAM_INVITE_SS "You have invited %s to join %s" +ERR_ARENA_TEAM_QUIT_S "You are no longer a member of %s" ERR_ARENA_TEAM_FOUNDER_S "Congratulations, you are a founding member of %s! To leave, use /teamquit [2v2, 3v3, 5v5]." - +ERR_ARENA_TEAM_INTERNAL "Internal arena team error" +ERR_ALREADY_IN_ARENA_TEAM "You are already in an arena team of that size" +ERR_ALREADY_IN_ARENA_TEAM_S "%s is already in an arena team of that size" @@ -403,23 +326,15 @@ ERR_ARENA_TEAM_FOUNDER_S "Congratulations, you are a founding member of %s! To +ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS "%s is not in %s" +ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S "\"%s\" not found" +ERR_ARENA_TEAM_NOT_ALLIED "You cannot invite players from the opposing alliance" - +ERR_ARENA_TEAM_JOIN_SS "%s has joined %s" +ERR_ARENA_TEAM_YOU_JOIN_S "You have joined %s. To leave, use /teamquit [2v2, 3v3, 5v5]." - +ERR_ARENA_TEAM_LEAVE_SS "%s has left %s" - +ERR_ARENA_TEAM_LEADER_IS_SS "%s is the captain of %s" +ERR_ARENA_TEAM_LEADER_CHANGED_SSS "%s has made %s the new captain of %s" - +ERR_ARENA_TEAM_REMOVE_SSS "%s has been kicked out of %s by %s" - +ERR_ARENA_TEAM_DISBANDED_S "%s has disbanded %s" - ERR_ARENA_TEAM_TARGET_TOO_LOW_S "%s is not high enough level to join your team" - ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S "%s is full" - ERR_ARENA_TEAM_LEVEL_TOO_LOW_I "You must be level %d to form an arena team" */ diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp index cef09af8252..4722aace318 100644 --- a/src/game/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot.cpp @@ -2,10 +2,8 @@ #include "AuctionHouseMgr.h" #include "AuctionHouseBot.h" #include - #include "Policies/SingletonImp.h" INSTANTIATE_SINGLETON_1(AuctionHouseBot); - using namespace std; vector npcItems; vector lootItems; @@ -29,22 +27,18 @@ AuctionHouseBot::AuctionHouseBot() debug_Out_Filters = false; AHBSeller = false; AHBBuyer = false; - //Begin Filters - Vendor_Items = false; Loot_Items = false; Other_Items = false; Vendor_TGs = false; Loot_TGs = false; Other_TGs = false; - No_Bind = false; Bind_When_Picked_Up = false; Bind_When_Equipped = false; Bind_When_Use = false; Bind_Quest_Item = false; - DisableBeta_PTR_Unused = false; DisablePermEnchant = false; #if CLIENT_VER > 300 @@ -57,7 +51,6 @@ AuctionHouseBot::AuctionHouseBot() DisableKeys = false; DisableDuration = false; DisableBOP_Or_Quest_NoReqLevel = false; - DisableWarriorItems = false; DisablePaladinItems = false; DisableHunterItems = false; @@ -69,7 +62,6 @@ AuctionHouseBot::AuctionHouseBot() DisableWarlockItems = false; DisableUnusedClassItems = false; DisableDruidItems = false; - DisableItemsBelowLevel = 0; DisableItemsAboveLevel = 0; DisableTGsBelowLevel = 0; @@ -86,22 +78,17 @@ AuctionHouseBot::AuctionHouseBot() DisableItemsAboveReqSkillRank = 0; DisableTGsBelowReqSkillRank = 0; DisableTGsAboveReqSkillRank = 0; - //End Filters - _lastrun_a = time(NULL); _lastrun_h = time(NULL); _lastrun_n = time(NULL); - AllianceConfig = AHBConfig(2); HordeConfig = AHBConfig(6); NeutralConfig = AHBConfig(7); } - AuctionHouseBot::~AuctionHouseBot() { } - void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) { if (!AHBSeller) @@ -109,16 +96,13 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) if (debug_Out) sLog.outError("AHSeller: Disabled"); return; } - uint32 minItems = config->GetMinItems(); uint32 maxItems = config->GetMaxItems(); - if (maxItems == 0) { //if (debug_Out) sLog.outString("AHSeller: Auctions disabled"); return; } - AuctionHouseEntry const* ahEntry = auctionmgr.GetAuctionHouseEntry(config->GetAHFID()); if (!ahEntry) { @@ -129,31 +113,24 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) { return; } - uint32 auctions = auctionHouse->Getcount(); - if (auctions >= minItems) { //if (debug_Out) sLog.outString("AHSeller: Auctions above minimum"); return; } - if (auctions >= maxItems) { //if (debug_Out) sLog.outString("AHSeller: Auctions at or above maximum"); return; } - uint32 items = 0; if ((maxItems - auctions) >= ItemsPerCycle) items = ItemsPerCycle; else items = (maxItems - auctions); - if (debug_Out) sLog.outString("AHSeller: Adding %u Auctions", items); - uint32 AuctioneerGUID = 0; - switch (config->GetAHID()) { case 2: @@ -170,9 +147,7 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) AuctioneerGUID = 23442; //default to neutral 7 break; } - if (debug_Out) sLog.outString("AHSeller: Current Auctineer GUID is %u", AuctioneerGUID); - uint32 greyTGcount = config->GetPercents(AHB_GREY_TG); uint32 whiteTGcount = config->GetPercents(AHB_WHITE_TG); uint32 greenTGcount = config->GetPercents(AHB_GREEN_TG); @@ -191,7 +166,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) + purpleTGcount + orangeTGcount + yellowTGcount + whiteIcount + greenIcount + blueIcount + purpleIcount + orangeIcount + yellowIcount; - uint32 greyTGoods = config->GetItemCounts(AHB_GREY_TG); uint32 whiteTGoods = config->GetItemCounts(AHB_WHITE_TG); uint32 greenTGoods = config->GetItemCounts(AHB_GREEN_TG); @@ -199,7 +173,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) uint32 purpleTGoods = config->GetItemCounts(AHB_PURPLE_TG); uint32 orangeTGoods = config->GetItemCounts(AHB_ORANGE_TG); uint32 yellowTGoods = config->GetItemCounts(AHB_YELLOW_TG); - uint32 greyItems = config->GetItemCounts(AHB_GREY_I); uint32 whiteItems = config->GetItemCounts(AHB_WHITE_I); uint32 greenItems = config->GetItemCounts(AHB_GREEN_I); @@ -208,7 +181,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) uint32 orangeItems = config->GetItemCounts(AHB_ORANGE_I); uint32 yellowItems = config->GetItemCounts(AHB_YELLOW_I); if (debug_Out) sLog.outString("AHSeller: %u items", items); - // only insert a few at a time, so as not to peg the processor for (uint32 cnt = 1;cnt <= items;cnt++) { @@ -327,20 +299,17 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) break; } } - if (itemID == 0) { if (debug_Out) sLog.outError("AHSeller: Item::CreateItem() - ItemID is 0"); continue; } - ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); if (prototype == NULL) { if (debug_Out) sLog.outError("AHSeller: Huh?!?! prototype == NULL"); continue; } - Item* item = Item::CreateItem(itemID, 1, AHBplayer); if (item == NULL) { @@ -348,15 +317,12 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) break; } item->AddToUpdateQueueOf(AHBplayer); - uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID); if (randomPropertyId != 0) item->SetItemRandomProperties(randomPropertyId); - uint64 buyoutPrice = 0; uint64 bidPrice = 0; uint32 stackCount = 1; - switch (SellMethod) { case 0: @@ -366,7 +332,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) buyoutPrice = prototype->BuyPrice; break; } - if ((prototype->Quality >= 0) && (prototype->Quality <= AHB_MAX_QUALITY)) { if (config->GetMaxStack(prototype->Quality) > 1 && item->GetMaxStackCount() > 1) @@ -387,7 +352,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) item->RemoveFromUpdateQueueOf(AHBplayer); continue; } - uint32 etime = urand(1,3); switch(etime) { @@ -405,9 +369,7 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) break; } item->SetCount(stackCount); - uint32 dep = auctionmgr.GetAuctionDeposit(ahEntry, etime, item); - AuctionEntry* auctionEntry = new AuctionEntry; auctionEntry->Id = objmgr.GenerateAuctionID(); auctionEntry->auctioneer = AuctioneerGUID; @@ -426,7 +388,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) auctionmgr.AddAItem(item); auctionHouse->AddAuction(auctionEntry); auctionEntry->SaveToDB(); - switch(itemColor) { case 0: @@ -484,32 +445,26 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con if (debug_Out) sLog.outError("AHBuyer: Disabled"); return; } - QueryResult* result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE itemowner<>%u AND buyguid<>%u", AHBplayerGUID, AHBplayerGUID); - if (!result) { delete result; return; } - if (result->GetRowCount() == 0) { delete result; return; } - // Fetches content of selected AH AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); vector possibleBids; - do { uint32 tmpdata = result->Fetch()->GetUInt32(); possibleBids.push_back(tmpdata); }while (result->NextRow()); delete result; - for (uint32 count = 1;count <= config->GetBidsPerInterval();++count) { // Do we have anything to bid? If not, stop here. @@ -519,23 +474,18 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con count = config->GetBidsPerInterval(); continue; } - // Choose random auction from possible auctions uint32 vectorPos = urand(0, possibleBids.size() - 1); vector::iterator iter = possibleBids.begin(); advance(iter, vectorPos); - // from auctionhousehandler.cpp, creates auction pointer & player pointer AuctionEntry* auction = auctionHouse->GetAuction(*iter); - // Erase the auction from the vector to prevent bidding on item in next iteration. possibleBids.erase(iter); - if (!auction) { continue; } - // get exact item information Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); if (!pItem) @@ -543,21 +493,17 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con if (debug_Out) sLog.outError("AHBuyer: Item %u doesn't exist, perhaps bought already?", auction->item_guidlow); continue; } - // get item prototype ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template); - // check which price we have to use, startbid or if it is bidded already uint32 currentprice; if (auction->bid) currentprice = auction->bid; else currentprice = auction->startbid; - // Prepare portion from maximum bid double bidrate = static_cast(urand(1, 100)) / 100; long double bidMax = 0; - // check that bid has acceptable value and take bid based on vendorprice, stacksize and quality switch (BuyMethod) { @@ -592,7 +538,6 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con break; } } - // check some special items, and do recalculating to their prices switch (prototype->Class) { @@ -603,22 +548,18 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con default: break; } - if (bidMax == 0) { // quality check failed to get bidmax, let's get out of here continue; } - // Calculate our bid long double bidvalue = currentprice + ((bidMax - currentprice) * bidrate); // Convert to uint32 uint32 bidprice = static_cast(bidvalue); - // Check our bid is high enough to be valid. If not, correct it to minimum. if ((currentprice + auction->GetAuctionOutBid()) > bidprice) bidprice = currentprice + auction->GetAuctionOutBid(); - if (debug_Out) { sLog.outString("-------------------------------------------------"); @@ -648,11 +589,9 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con sLog.outString("AHBuyer: Ammo Type: %u", prototype->AmmoType); sLog.outString("-------------------------------------------------"); } - // Check whether we do normal bid, or buyout if ((bidprice < auction->buyout) || (auction->buyout == 0)) { - if (auction->bidder > 0) { if (auction->bidder == AHBplayer->GetGUIDLow()) @@ -666,10 +605,8 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con //pl->ModifyMoney(-int32(price)); } } - auction->bidder = AHBplayer->GetGUIDLow(); auction->bid = bidprice; - // Saving auction into database CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); } @@ -682,7 +619,6 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con } auction->bidder = AHBplayer->GetGUIDLow(); auction->bid = auction->buyout; - // Send mails to buyer & seller auctionmgr.SendAuctionSalePendingMail(auction); auctionmgr.SendAuctionSuccessfulMail(auction); @@ -694,18 +630,15 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con } } } - void AuctionHouseBot::Update() { time_t _newrun = time(NULL); if ((!AHBSeller) && (!AHBBuyer)) return; - WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS); Player _AHBplayer(&_session); _AHBplayer.MinimalLoadFromDB(NULL, AHBplayerGUID); ObjectAccessor::Instance().AddObject(&_AHBplayer); - // Only for testing, this can likely be removed, once I know it's working as expected. /* AuctionHouseObject* auctionHouse1 = auctionmgr.GetAuctionsMap(55); @@ -719,7 +652,6 @@ void AuctionHouseBot::Update() return; } */ - // Add New Bids if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) { @@ -731,7 +663,6 @@ void AuctionHouseBot::Update() addNewAuctionBuyerBotBid(&_AHBplayer, &AllianceConfig, &_session); _lastrun_a = _newrun; } - addNewAuctions(&_AHBplayer, &HordeConfig); if (((_newrun - _lastrun_h) >= (HordeConfig.GetBiddingInterval() * MINUTE)) && (HordeConfig.GetBidsPerInterval() > 0)) { @@ -741,7 +672,6 @@ void AuctionHouseBot::Update() _lastrun_h = _newrun; } } - addNewAuctions(&_AHBplayer, &NeutralConfig); if (((_newrun - _lastrun_n) >= (NeutralConfig.GetBiddingInterval() * MINUTE)) && (NeutralConfig.GetBidsPerInterval() > 0)) { @@ -752,37 +682,30 @@ void AuctionHouseBot::Update() } ObjectAccessor::Instance().RemoveObject(&_AHBplayer); } - void AuctionHouseBot::Initialize() { debug_Out = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG", false); debug_Out_Filters = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG_FILTERS", false); - AHBSeller = sConfig.GetBoolDefault("AuctionHouseBot.EnableSeller", false); AHBBuyer = sConfig.GetBoolDefault("AuctionHouseBot.EnableBuyer", false); SellMethod = sConfig.GetBoolDefault("AuctionHouseBot.UseBuyPriceForSeller", false); BuyMethod = sConfig.GetBoolDefault("AuctionHouseBot.UseBuyPriceForBuyer", false); - AHBplayerAccount = sConfig.GetIntDefault("AuctionHouseBot.Account", 0); AHBplayerGUID = sConfig.GetIntDefault("AuctionHouseBot.GUID", 0); ItemsPerCycle = sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200); - //Begin Filters - Vendor_Items = sConfig.GetBoolDefault("AuctionHouseBot.VendorItems", false); Loot_Items = sConfig.GetBoolDefault("AuctionHouseBot.LootItems", true); Other_Items = sConfig.GetBoolDefault("AuctionHouseBot.OtherItems", false); Vendor_TGs = sConfig.GetBoolDefault("AuctionHouseBot.VendorTradeGoods", false); Loot_TGs = sConfig.GetBoolDefault("AuctionHouseBot.LootTradeGoods", true); Other_TGs = sConfig.GetBoolDefault("AuctionHouseBot.OtherTradeGoods", false); - No_Bind = sConfig.GetBoolDefault("AuctionHouseBot.No_Bind", true); Bind_When_Picked_Up = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Picked_Up", false); Bind_When_Equipped = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Equipped", true); Bind_When_Use = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Use", true); Bind_Quest_Item = sConfig.GetBoolDefault("AuctionHouseBot.Bind_Quest_Item", false); - DisableBeta_PTR_Unused = sConfig.GetBoolDefault("AuctionHouseBot.DisableBeta_PTR_Unused", false); DisablePermEnchant = sConfig.GetBoolDefault("AuctionHouseBot.DisablePermEnchant", false); #if CLIENT_VER > 300 @@ -795,7 +718,6 @@ void AuctionHouseBot::Initialize() DisableKeys = sConfig.GetBoolDefault("AuctionHouseBot.DisableKeys", false); DisableDuration = sConfig.GetBoolDefault("AuctionHouseBot.DisableDuration", false); DisableBOP_Or_Quest_NoReqLevel = sConfig.GetBoolDefault("AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel", false); - DisableWarriorItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableWarriorItems", false); DisablePaladinItems = sConfig.GetBoolDefault("AuctionHouseBot.DisablePaladinItems", false); DisableHunterItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableHunterItems", false); @@ -807,7 +729,6 @@ void AuctionHouseBot::Initialize() DisableWarlockItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableWarlockItems", false); DisableUnusedClassItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableUnusedClassItems", false); DisableDruidItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableDruidItems", false); - DisableItemsBelowLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsBelowLevel", 0); DisableItemsAboveLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveLevel", 0); DisableTGsBelowLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowLevel", 0); @@ -824,7 +745,6 @@ void AuctionHouseBot::Initialize() DisableItemsAboveReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveReqSkillRank", 0); DisableTGsBelowReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowReqSkillRank", 0); DisableTGsAboveReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsAboveReqSkillRank", 0); - //End Filters if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) { @@ -832,7 +752,6 @@ void AuctionHouseBot::Initialize() LoadValues(&HordeConfig); } LoadValues(&NeutralConfig); - if (AHBSeller) { QueryResult* results = (QueryResult*) NULL; @@ -844,16 +763,13 @@ void AuctionHouseBot::Initialize() { Field* fields = results->Fetch(); npcItems.push_back(fields[0].GetUInt32()); - } while (results->NextRow()); - delete results; } else { if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", npcQuery); } - char lootQuery[] = "SELECT item FROM creature_loot_template UNION " "SELECT item FROM disenchant_loot_template UNION " "SELECT item FROM fishing_loot_template UNION " @@ -865,7 +781,6 @@ void AuctionHouseBot::Initialize() "SELECT item FROM pickpocketing_loot_template UNION " "SELECT item FROM prospecting_loot_template UNION " "SELECT item FROM skinning_loot_template"; - results = WorldDatabase.PQuery(lootQuery); if (results != NULL) { @@ -873,23 +788,18 @@ void AuctionHouseBot::Initialize() { Field* fields = results->Fetch(); lootItems.push_back(fields[0].GetUInt32()); - } while (results->NextRow()); - delete results; } else { if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", lootQuery); } - for (uint32 itemID = 0; itemID < sItemStorage.MaxEntry; itemID++) { ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); - if (prototype == NULL) continue; - switch (prototype->Bonding) { case NO_BIND: @@ -916,7 +826,6 @@ void AuctionHouseBot::Initialize() continue; break; } - switch (SellMethod) { case 0: @@ -928,71 +837,56 @@ void AuctionHouseBot::Initialize() continue; break; } - if ((prototype->Quality < 0) || (prototype->Quality > 6)) continue; - if ((Vendor_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isVendorItem = false; - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) { if (itemID == npcItems[i]) isVendorItem = true; } - if (isVendorItem) continue; } - if ((Vendor_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isVendorTG = false; - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) { if (itemID == npcItems[i]) isVendorTG = true; } - if (isVendorTG) continue; } - if ((Loot_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isLootItem = false; - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) { if (itemID == lootItems[i]) isLootItem = true; } - if (isLootItem) continue; } - if ((Loot_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isLootTG = false; - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootTG); i++) { if (itemID == lootItems[i]) isLootTG = true; } - if (isLootTG) continue; } - if ((Other_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isVendorItem = false; bool isLootItem = false; - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) { if (itemID == npcItems[i]) @@ -1006,12 +900,10 @@ void AuctionHouseBot::Initialize() if ((!isLootItem) && (!isVendorItem)) continue; } - if ((Other_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) { bool isVendorTG = false; bool isLootTG = false; - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) { if (itemID == npcItems[i]) @@ -1025,7 +917,6 @@ void AuctionHouseBot::Initialize() if ((!isLootTG) && (!isVendorTG)) continue; } - //TODO:Make list of items and create a vector // Disable PTR/Beta/Unused items if ((DisableBeta_PTR_Unused) && ((prototype->ItemId == 21878) || (prototype->ItemId == 27774) || (prototype->ItemId == 27811) || (prototype->ItemId == 28117) || (prototype->ItemId == 28112))) @@ -1033,14 +924,12 @@ void AuctionHouseBot::Initialize() if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (PTR/Beta/Unused Item)", prototype->ItemId); continue; } - // Disable permanent enchants items if ((DisablePermEnchant) && (prototype->Class == ITEM_CLASS_PERMANENT)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Permanent Enchant Item)", prototype->ItemId); continue; } - #if CLIENT_VER > 300 // Disable conjured items if ((DisableConjured) && (prototype->IsConjuredConsumable())) @@ -1049,245 +938,210 @@ void AuctionHouseBot::Initialize() continue; } #endif - // Disable gems if ((DisableGems) && (prototype->Class == ITEM_CLASS_GEM)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Gem)", prototype->ItemId); continue; } - // Disable money if ((DisableMoney) && (prototype->Class == ITEM_CLASS_MONEY)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Money)", prototype->ItemId); continue; } - // Disable moneyloot if ((DisableMoneyLoot) && (prototype->MinMoneyLoot > 0)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (MoneyLoot)", prototype->ItemId); continue; } - // Disable lootable items if ((DisableLootable) && (prototype->Flags & 4)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Lootable Item)", prototype->ItemId); continue; } - // Disable Keys if ((DisableKeys) && (prototype->Class == ITEM_CLASS_KEY)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Quest Item)", prototype->ItemId); continue; } - // Disable items with duration if ((DisableDuration) && (prototype->Duration > 0)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Has a Duration)", prototype->ItemId); continue; } - // Disable items which are BOP or Quest Items and have a required level lower than the item level if ((DisableBOP_Or_Quest_NoReqLevel) && ((prototype->Bonding == BIND_WHEN_PICKED_UP || prototype->Bonding == BIND_QUEST_ITEM) && (prototype->RequiredLevel < prototype->ItemLevel))) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (BOP or BQI and Required Level is less than Item Level)", prototype->ItemId); continue; } - // Disable items specifically for Warrior if ((DisableWarriorItems) && (prototype->AllowableClass == 1)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Warrior Item)", prototype->ItemId); continue; } - // Disable items specifically for Paladin if ((DisablePaladinItems) && (prototype->AllowableClass == 2)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Paladin Item)", prototype->ItemId); continue; } - // Disable items specifically for Hunter if ((DisableHunterItems) && (prototype->AllowableClass == 4)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Hunter Item)", prototype->ItemId); continue; } - // Disable items specifically for Rogue if ((DisableRogueItems) && (prototype->AllowableClass == 8)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Rogue Item)", prototype->ItemId); continue; } - // Disable items specifically for Priest if ((DisablePriestItems) && (prototype->AllowableClass == 16)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Priest Item)", prototype->ItemId); continue; } - // Disable items specifically for DK if ((DisableDKItems) && (prototype->AllowableClass == 32)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (DK Item)", prototype->ItemId); continue; } - // Disable items specifically for Shaman if ((DisableShamanItems) && (prototype->AllowableClass == 64)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Shaman Item)", prototype->ItemId); continue; } - // Disable items specifically for Mage if ((DisableMageItems) && (prototype->AllowableClass == 128)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Mage Item)", prototype->ItemId); continue; } - // Disable items specifically for Warlock if ((DisableWarlockItems) && (prototype->AllowableClass == 256)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Warlock Item)", prototype->ItemId); continue; } - // Disable items specifically for Unused Class if ((DisableUnusedClassItems) && (prototype->AllowableClass == 512)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Unused Item)", prototype->ItemId); continue; } - // Disable items specifically for Druid if ((DisableDruidItems) && (prototype->AllowableClass == 1024)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Druid Item)", prototype->ItemId); continue; } - // Disable Items below level X if ((DisableItemsBelowLevel) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel < DisableItemsBelowLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Items above level X if ((DisableItemsAboveLevel) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel > DisableItemsAboveLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Trade Goods below level X if ((DisableTGsBelowLevel) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel < DisableTGsBelowLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Trade Goods above level X if ((DisableTGsAboveLevel) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel > DisableTGsAboveLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Items below GUID X if ((DisableItemsBelowGUID) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId < DisableItemsBelowGUID)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Items above GUID X if ((DisableItemsAboveGUID) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId > DisableItemsAboveGUID)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Trade Goods below GUID X if ((DisableTGsBelowGUID) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId < DisableTGsBelowGUID)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Trade Goods above GUID X if ((DisableTGsAboveGUID) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId > DisableTGsAboveGUID)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); continue; } - // Disable Items for level lower than X if ((DisableItemsBelowReqLevel) && (prototype->RequiredLevel < DisableItemsBelowReqLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); continue; } - // Disable Items for level higher than X if ((DisableItemsAboveReqLevel) && (prototype->RequiredLevel > DisableItemsAboveReqLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); continue; } - // Disable Trade Goods for level lower than X if ((DisableTGsBelowReqLevel) && (prototype->RequiredLevel < DisableTGsBelowReqLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); continue; } - // Disable Trade Goods for level higher than X if ((DisableTGsAboveReqLevel) && (prototype->RequiredLevel > DisableTGsAboveReqLevel)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); continue; } - // Disable Items that require skill lower than X if ((DisableItemsBelowReqSkillRank) && (prototype->RequiredSkillRank < DisableItemsBelowReqSkillRank)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); continue; } - // Disable Items that require skill higher than X if ((DisableItemsAboveReqSkillRank) && (prototype->RequiredSkillRank > DisableItemsAboveReqSkillRank)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); continue; } - // Disable Trade Goods that require skill lower than X if ((DisableTGsBelowReqSkillRank) && (prototype->RequiredSkillRank < DisableTGsBelowReqSkillRank)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); continue; } - // Disable Trade Goods that require skill higher than X if ((DisableTGsAboveReqSkillRank) && (prototype->RequiredSkillRank > DisableTGsAboveReqSkillRank)) { if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); continue; } - switch (prototype->Quality) { case AHB_GREY: @@ -1296,42 +1150,36 @@ void AuctionHouseBot::Initialize() else greyItemsBin.push_back(itemID); break; - case AHB_WHITE: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) whiteTradeGoodsBin.push_back(itemID); else whiteItemsBin.push_back(itemID); break; - case AHB_GREEN: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) greenTradeGoodsBin.push_back(itemID); else greenItemsBin.push_back(itemID); break; - case AHB_BLUE: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) blueTradeGoodsBin.push_back(itemID); else blueItemsBin.push_back(itemID); break; - case AHB_PURPLE: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) purpleTradeGoodsBin.push_back(itemID); else purpleItemsBin.push_back(itemID); break; - case AHB_ORANGE: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) orangeTradeGoodsBin.push_back(itemID); else orangeItemsBin.push_back(itemID); break; - case AHB_YELLOW: if (prototype->Class == ITEM_CLASS_TRADE_GOODS) yellowTradeGoodsBin.push_back(itemID); @@ -1340,7 +1188,6 @@ void AuctionHouseBot::Initialize() break; } } - if ((greyTradeGoodsBin.size() == 0) && (whiteTradeGoodsBin.size() == 0) && (greenTradeGoodsBin.size() == 0) && @@ -1359,7 +1206,6 @@ void AuctionHouseBot::Initialize() sLog.outError("AuctionHouseBot: No items"); AHBSeller = 0; } - sLog.outString("AuctionHouseBot:"); sLog.outString("loaded %u grey trade goods", greyTradeGoodsBin.size()); sLog.outString("loaded %u white trade goods", whiteTradeGoodsBin.size()); @@ -1379,11 +1225,9 @@ void AuctionHouseBot::Initialize() sLog.outString("AuctionHouseBot by Paradox (original by ChrisK) has been loaded."); sLog.outString("AuctionHouseBot now includes AHBuyer by Kerbe and Paradox"); } - void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) { // from auctionhousehandler.cpp, creates auction pointer & player pointer - // get exact item information Item *pItem = auctionmgr.GetAItem(ah->item_guidlow); if (!pItem) @@ -1391,12 +1235,9 @@ void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) if (debug_Out) sLog.outError("AHBot: Item %u doesn't exist, perhaps bought already?", ah->item_guidlow); return; } - // get item prototype ItemPrototype const* prototype = objmgr.GetItemPrototype(ah->item_template); - AHBConfig *config; - FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(ah->GetHouseFaction()); if (!u_entry) { @@ -1418,17 +1259,13 @@ void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); config = &NeutralConfig; } - config->IncItemCounts(prototype->Class, prototype->Quality); } - void AuctionHouseBot::DecrementItemCounts(AuctionEntry* ah, uint32 item_template) { // get item prototype ItemPrototype const* prototype = objmgr.GetItemPrototype(item_template); - AHBConfig *config; - FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(ah->GetHouseFaction()); if (!u_entry) { @@ -1450,10 +1287,8 @@ void AuctionHouseBot::DecrementItemCounts(AuctionEntry* ah, uint32 item_template if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); config = &NeutralConfig; } - config->DecItemCounts(prototype->Class, prototype->Quality); } - void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* args) { AHBConfig *config; @@ -1501,15 +1336,12 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* case 0: //ahexpire { AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); - AuctionHouseObject::AuctionEntryMap::iterator itr; itr = auctionHouse->GetAuctionsBegin(); - while (itr != auctionHouse->GetAuctionsEnd()) { if (itr->second->owner == AHBplayerGUID) itr->second->expire_time = sWorld.GetGameTime(); - ++itr; } } @@ -1564,7 +1396,6 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* uint32 purplei = (uint32) strtoul(param12, NULL, 0); uint32 orangei = (uint32) strtoul(param13, NULL, 0); uint32 yellowi = (uint32) strtoul(param14, NULL, 0); - CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreytradegoods = '%u' WHERE auctionhouse = '%u'", greytg, ahMapID); CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhitetradegoods = '%u' WHERE auctionhouse = '%u'", whitetg, ahMapID); @@ -1652,7 +1483,6 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* break; } } - void AuctionHouseBot::LoadValues(AHBConfig *config) { if (debug_Out) sLog.outString("Start Settings for %s Auctionhouses:", CharacterDatabase.PQuery("SELECT name FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetString()); @@ -1771,10 +1601,8 @@ void AuctionHouseBot::LoadValues(AHBConfig *config) } AuctionHouseEntry const* ahEntry = auctionmgr.GetAuctionHouseEntry(config->GetAHFID()); AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); - config->ResetItemCounts(); uint32 auctions = auctionHouse->Getcount(); - if (auctions) { for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr) diff --git a/src/game/AuctionHouseBot.h b/src/game/AuctionHouseBot.h index d135af5c479..9e04dde87cf 100644 --- a/src/game/AuctionHouseBot.h +++ b/src/game/AuctionHouseBot.h @@ -1,10 +1,8 @@ #ifndef AUCTION_HOUSE_BOT_H #define AUCTION_HOUSE_BOT_H - #include "World.h" #include "Config/ConfigEnv.h" #include "ItemPrototype.h" - #define AHB_GREY 0 #define AHB_WHITE 1 #define AHB_GREEN 2 @@ -27,7 +25,6 @@ #define AHB_PURPLE_I 11 #define AHB_ORANGE_I 12 #define AHB_YELLOW_I 13 - class AHBConfig { private: @@ -84,7 +81,6 @@ private: uint32 minBidPriceYellow; uint32 maxBidPriceYellow; uint32 maxStackYellow; - uint32 buyerPriceGrey; uint32 buyerPriceWhite; uint32 buyerPriceGreen; @@ -94,7 +90,6 @@ private: uint32 buyerPriceYellow; uint32 buyerBiddingInterval; uint32 buyerBidsPerInterval; - uint32 greytgp; uint32 whitetgp; uint32 greentgp; @@ -109,7 +104,6 @@ private: uint32 purpleip; uint32 orangeip; uint32 yellowip; - uint32 greyTGoods; uint32 whiteTGoods; uint32 greenTGoods; @@ -117,7 +111,6 @@ private: uint32 purpleTGoods; uint32 orangeTGoods; uint32 yellowTGoods; - uint32 greyItems; uint32 whiteItems; uint32 greenItems; @@ -125,7 +118,6 @@ private: uint32 purpleItems; uint32 orangeItems; uint32 yellowItems; - public: AHBConfig(uint32 ahid) { @@ -182,7 +174,6 @@ public: void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi) { uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi; - if (totalPercent == 0) { maxItems = 0; @@ -892,7 +883,6 @@ public: break; } } - void DecItemCounts(uint32 Class, uint32 Quality) { switch(Class) @@ -905,7 +895,6 @@ public: break; } } - void DecItemCounts(uint32 color) { switch(color) @@ -956,7 +945,6 @@ public: break; } } - void IncItemCounts(uint32 Class, uint32 Quality) { switch(Class) @@ -969,7 +957,6 @@ public: break; } } - void IncItemCounts(uint32 color) { switch(color) @@ -1020,7 +1007,6 @@ public: break; } } - void ResetItemCounts() { greyTGoods = 0; @@ -1030,7 +1016,6 @@ public: purpleTGoods = 0; orangeTGoods = 0; yellowTGoods = 0; - greyItems = 0; whiteItems = 0; greenItems = 0; @@ -1039,7 +1024,6 @@ public: orangeItems = 0; yellowItems = 0; } - uint32 TotalItemCounts() { return( @@ -1050,7 +1034,6 @@ public: purpleTGoods + orangeTGoods + yellowTGoods + - greyItems + whiteItems + greenItems + @@ -1059,7 +1042,6 @@ public: orangeItems + yellowItems); } - uint32 GetItemCounts(uint32 color) { switch(color) @@ -1126,34 +1108,27 @@ public: class AuctionHouseBot { private: - bool debug_Out; bool debug_Out_Filters; - bool AHBSeller; bool AHBBuyer; bool BuyMethod; bool SellMethod; - uint32 AHBplayerAccount; uint32 AHBplayerGUID; uint32 ItemsPerCycle; - //Begin Filters - bool Vendor_Items; bool Loot_Items; bool Other_Items; bool Vendor_TGs; bool Loot_TGs; bool Other_TGs; - bool No_Bind; bool Bind_When_Picked_Up; bool Bind_When_Equipped; bool Bind_When_Use; bool Bind_Quest_Item; - bool DisableBeta_PTR_Unused; bool DisablePermEnchant; #if CLIENT_VER > 300 @@ -1166,7 +1141,6 @@ private: bool DisableKeys; bool DisableDuration; bool DisableBOP_Or_Quest_NoReqLevel; - bool DisableWarriorItems; bool DisablePaladinItems; bool DisableHunterItems; @@ -1178,7 +1152,6 @@ private: bool DisableWarlockItems; bool DisableUnusedClassItems; bool DisableDruidItems; - uint32 DisableItemsBelowLevel; uint32 DisableItemsAboveLevel; uint32 DisableTGsBelowLevel; @@ -1195,21 +1168,16 @@ private: uint32 DisableItemsAboveReqSkillRank; uint32 DisableTGsBelowReqSkillRank; uint32 DisableTGsAboveReqSkillRank; - //End Filters - AHBConfig AllianceConfig; AHBConfig HordeConfig; AHBConfig NeutralConfig; - time_t _lastrun_a; time_t _lastrun_h; time_t _lastrun_n; - inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; }; void addNewAuctions(Player *AHBplayer, AHBConfig *config); void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session); - public: AuctionHouseBot(); ~AuctionHouseBot(); @@ -1221,7 +1189,5 @@ public: void Commands(uint32, uint32, uint32, char*); uint32 GetAHBplayerGUID() { return AHBplayerGUID; }; }; - #define auctionbot Trinity::Singleton::Instance() - #endif diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 52790526dd7..13df6c3a6a4 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -17,13 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "ObjectMgr.h" #include "Player.h" #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" - #include "AuctionHouseBot.h" #include "AuctionHouseMgr.h" #include "Log.h" @@ -31,43 +29,35 @@ #include "UpdateMask.h" #include "Util.h" - //please DO NOT use iterator++, because it is slower than ++iterator!!! //post-incrementation is always slower than pre-incrementation ! - //void called when player click on auctioneer npc void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data) { uint64 guid; //NPC guid recv_data >> guid; - Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER); if (!unit) { sLog.outDebug("WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - SendAuctionHello(guid, unit); } - //this void causes that auction window is opened void WorldSession::SendAuctionHello(uint64 guid, Creature* unit) { AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction()); if (!ahEntry) return; - WorldPacket data(MSG_AUCTION_HELLO, 12); data << (uint64) guid; data << (uint32) ahEntry->houseId; SendPacket(&data); } - //call this method when player bids, creates, or deletes auction void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError) { @@ -79,7 +69,6 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin data << bidError; //when bid, then send 0, once... SendPacket(&data); } - //this function sends notification, if bidder is online void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template) { @@ -93,7 +82,6 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction data << uint32(0); SendPacket(&data); } - //this void causes on client to display: "Your auction sold" void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction) { @@ -107,53 +95,42 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction) data << (uint32) 0; //unk SendPacket(&data); } - //this function sends mail to old bidder void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice) { uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder,0, HIGHGUID_PLAYER); Player *oldBidder = objmgr.GetPlayer(oldBidder_guid); - uint32 oldBidder_accId = 0; if (!oldBidder) oldBidder_accId = objmgr.GetPlayerAccountIdByGUID(oldBidder_guid); - // old bidder exist if (oldBidder || oldBidder_accId) { std::ostringstream msgAuctionOutbiddedSubject; msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED; - if (oldBidder && !_player) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, auctionbot.GetAHBplayerGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - if (oldBidder && _player) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, _player->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - WorldSession::SendMailTo(oldBidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->bidder, msgAuctionOutbiddedSubject.str(), 0, NULL, auction->bid, 0, MAIL_CHECK_MASK_NONE); } } - //this function sends mail, when auction is cancelled to old bidder void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction) { uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); Player *bidder = objmgr.GetPlayer(bidder_guid); - uint32 bidder_accId = 0; if (!bidder) bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); - // bidder exist if (bidder || bidder_accId) { std::ostringstream msgAuctionCancelledSubject; msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER; - WorldSession::SendMailTo(bidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->bidder, msgAuctionCancelledSubject.str(), 0, NULL, auction->bid, 0, MAIL_CHECK_MASK_NONE); } } - //this void creates new auction and adds auction to some auctionhouse void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) { @@ -162,31 +139,24 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) recv_data >> auctioneer >> item; recv_data >> bid >> buyout >> etime; Player *pl = GetPlayer(); - if (!item || !bid || !etime) return; //check for cheaters - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } - AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction()); if (!auctionHouseEntry) { sLog.outDebug("WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", uint32(GUID_LOPART(auctioneer))); return; } - sLog.outDebug("WORLD: HandleAuctionSellItem - ETIME: %u", etime); - // client send time in minutes, convert to common used sec time etime *= MINUTE; - sLog.outDebug("WORLD: HandleAuctionSellItem - ETIME: %u", etime); - // client understand only 3 auction time switch(etime) { @@ -197,11 +167,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) default: return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *it = pl->GetItemByGuid(item); //do not allow to sell already auctioned items if (auctionmgr.GetAItem(GUID_LOPART(item))) @@ -216,21 +184,17 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_ITEM_NOT_FOUND); return; } - if (!it->CanBeTraded()) { SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); return; } - if (it->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || it->GetUInt32Value(ITEM_FIELD_DURATION)) { SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); return; } - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - //we have to take deposit : uint32 deposit = auctionmgr.GetAuctionDeposit(auctionHouseEntry, etime, it); if (pl->GetMoney() < deposit) @@ -238,17 +202,13 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY); return; } - if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)", GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount()); } - pl->ModifyMoney(-int32(deposit)); - uint32 auction_time = uint32(etime * sWorld.getRate(RATE_AUCTION_TIME)); - AuctionEntry *AH = new AuctionEntry; AH->Id = objmgr.GenerateAuctionID(); if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) @@ -265,23 +225,18 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->expire_time = time(NULL) + auction_time; AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), AH->auctioneer, bid, buyout, auction_time, AH->GetHouseId()); auctionmgr.AddAItem(it); auctionHouse->AddAuction(AH); - pl->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true); - CharacterDatabase.BeginTransaction(); it->DeleteFromInventoryDB(); it->SaveToDB(); // recursive and not have transaction guard into self, not in inventiory and can be save standalone AH->SaveToDB(); pl->SaveInventoryAndGoldToDB(); CharacterDatabase.CommitTransaction(); - SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK); } - //this function is called when client bids or buys out auction void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) { @@ -290,33 +245,26 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) uint32 price; recv_data >> auctioneer; recv_data >> auctionId >> price; - if (!auctionId || !price) return; //check for cheaters - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - AuctionEntry *auction = auctionHouse->GetAuction(auctionId); Player *pl = GetPlayer(); - if (!auction || auction->owner == pl->GetGUIDLow()) { //you cannot bid your own auction: SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR); return; } - // impossible have online own another character (use this for speedup check in case online owner) Player* auction_owner = objmgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)); if (!auction_owner && objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId()) @@ -325,11 +273,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR); return; } - // cheating if (price <= auction->bid) return; - // price too low for next bid if not buyout if ((price < auction->buyout || auction->buyout == 0) && price < auction->bid + auction->GetAuctionOutBid()) @@ -337,14 +283,12 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) //auction has already higher bid, client tests it! return; } - if (price > pl->GetMoney()) { //you don't have enought money!, client tests! //SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???); return; } - if ((price < auction->buyout) || (auction->buyout == 0)) { if (auction->bidder > 0) @@ -367,10 +311,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) auction->bidder = pl->GetGUIDLow(); auction->bid = price; GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price); - // after this update we should save player's money ... CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); - SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0); } else @@ -391,11 +333,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) auction->bidder = pl->GetGUIDLow(); auction->bid = auction->buyout; GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout); - auctionmgr.SendAuctionSalePendingMail(auction); auctionmgr.SendAuctionSuccessfulMail(auction); auctionmgr.SendAuctionWonMail(auction); - SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK); auction->DeleteFromDB(); uint32 item_template = auction->item_template; @@ -406,7 +346,6 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) pl->SaveInventoryAndGoldToDB(); CharacterDatabase.CommitTransaction(); } - //this void is called when auction_owner cancels his auction void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) { @@ -415,23 +354,18 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) recv_data >> auctioneer; recv_data >> auctionId; //sLog.outDebug("Cancel AUCTION AuctionID: %u", auctionId); - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - AuctionEntry *auction = auctionHouse->GetAuction(auctionId); Player *pl = GetPlayer(); - if (auction && auction->owner == pl->GetGUIDLow()) { Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); @@ -449,10 +383,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) // Return the item by mail std::ostringstream msgAuctionCanceledOwner; msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED; - MailItemsInfo mi; mi.AddItem(auction->item_guidlow, auction->item_template, pItem); - // item will deleted or added to received mail list WorldSession::SendMailTo(pl, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), pl->GetGUIDLow(), msgAuctionCanceledOwner.str(), 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE); } @@ -470,7 +402,6 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId); return; } - //inform player, that auction is removed SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, AUCTION_OK); // Now remove the auction @@ -482,14 +413,12 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) auctionmgr.RemoveAItem(auction->item_guidlow); auctionHouse->RemoveAuction(auction, item_template); } - //called when player lists his bids void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) { uint64 guid; //NPC guid uint32 listfrom; //page of auctions uint32 outbiddedCount; //count of outbidded auctions - recv_data >> guid; recv_data >> listfrom; // not used in fact (this list not have page control in client) recv_data >> outbiddedCount; @@ -498,20 +427,16 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) sLog.outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(),(16 + outbiddedCount * 4)); outbiddedCount = 0; } - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4)); Player *pl = GetPlayer(); data << (uint32) 0; //add 0 as count @@ -529,49 +454,39 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) ++count; } } - auctionHouse->BuildListBidderItems(data,pl,count,totalcount); data.put(0, count); // add count to placeholder data << totalcount; data << (uint32)300; //unk 2.3.0 SendPacket(&data); } - //this void sends player info about his auctions void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data) { uint32 listfrom; uint64 guid; - recv_data >> guid; recv_data >> listfrom; // not used in fact (this list not have page control in client) - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4)); data << (uint32) 0; // amount place holder - uint32 count = 0; uint32 totalcount = 0; - auctionHouse->BuildListOwnerItems(data,_player,count,totalcount); data.put(0, count); data << (uint32) totalcount; data << (uint32) 0; SendPacket(&data); } - //this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) { @@ -579,61 +494,47 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; uint64 guid; - recv_data >> guid; recv_data >> listfrom; // start, used for page control listing by 50 elements recv_data >> searchedname; - recv_data >> levelmin >> levelmax; recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory; recv_data >> quality >> usable; - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } - // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(pCreature->getFaction()); - //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); - WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)); uint32 count = 0; uint32 totalcount = 0; data << (uint32) 0; - // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchedname,wsearchedname)) return; - wstrToLower(wsearchedname); - auctionHouse->BuildListAuctionItems(data,_player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count,totalcount); - data.put(0, count); data << (uint32) totalcount; data << (uint32) 300; // unk 2.3.0 const? SendPacket(&data); } - void WorldSession::HandleAuctionListPendingSales(WorldPacket & recv_data) { sLog.outDebug("CMSG_AUCTION_LIST_PENDING_SALES"); recv_data.hexlike(); - uint32 count = 0; - WorldPacket data(SMSG_AUCTION_LIST_PENDING_SALES, 4); data << uint32(count); // count /*for (uint32 i = 0; i < count; ++i) diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index ffc0c55d9d3..2f7ba808fb3 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectMgr.h" #include "Player.h" @@ -26,7 +25,6 @@ #include "Database/SQLStorage.h" #include "Policies/SingletonImp.h" #include "DBCStores.h" - #include "AccountMgr.h" #include "AuctionHouseMgr.h" #include "Item.h" @@ -35,26 +33,20 @@ #include "ProgressBar.h" #include - INSTANTIATE_SINGLETON_1(AuctionHouseMgr); - using namespace std; - AuctionHouseMgr::AuctionHouseMgr() { } - AuctionHouseMgr::~AuctionHouseMgr() { for (ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr) delete itr->second; } - AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) { if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) return &mNeutralAuctions; - // team have linked auction houses FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); if (!u_entry) @@ -66,18 +58,15 @@ AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) else return &mNeutralAuctions; } - uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem) { uint32 MSV = pItem->GetProto()->SellPrice; int32 deposit; uint32 timeHr = (((time / 60) / 60) / 12); - if (MSV > 0) deposit = (int32)floor((double)MSV * (((double)(entry->depositPercent * 3) / 100.0f * (double)sWorld.getRate(RATE_AUCTION_DEPOSIT) * (double)pItem->GetCount()))) * timeHr; else deposit = 0; - sLog.outDebug("SellPrice:\t\t%u", MSV); sLog.outDebug("Deposit Percent:\t%f", ((double)entry->depositPercent / 100.0f)); sLog.outDebug("Auction Time1:\t\t%u", time); @@ -95,14 +84,12 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 return 0; } } - //does not clear ram void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) { Item *pItem = GetAItem(auction->item_guidlow); if (!pItem) return; - uint32 bidder_accId = 0; uint32 bidder_security = 0; uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); @@ -121,7 +108,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) { bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); bidder_security = accmgr.GetSecurity(bidder_accId); - if (bidder_security > SEC_PLAYER) // not do redundant DB requests { if (!objmgr.GetPlayerNameByGUID(bidder_guid,bidder_name)) @@ -133,44 +119,34 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) std::string owner_name; if (!objmgr.GetPlayerNameByGUID(auction->owner,owner_name)) owner_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN); - uint32 owner_accid = objmgr.GetPlayerAccountIdByGUID(auction->owner); - sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)", bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid); } } - // receiver exist if (bidder || bidder_accId) { std::ostringstream msgAuctionWonSubject; msgAuctionWonSubject << auction->item_template << ":0:" << AUCTION_WON; - std::ostringstream msgAuctionWonBody; msgAuctionWonBody.width(16); msgAuctionWonBody << std::right << std::hex << auction->owner; msgAuctionWonBody << std::dec << ":" << auction->bid << ":" << auction->buyout; sLog.outDebug("AuctionWon body string : %s", msgAuctionWonBody.str().c_str()); - //prepare mail data... : uint32 itemTextId = objmgr.CreateItemText(msgAuctionWonBody.str()); - // set owner to bidder (to prevent delete item with sender char deleting) // owner in `data` will set at mail receive and item extracting CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'",auction->bidder,pItem->GetGUIDLow()); CharacterDatabase.CommitTransaction(); - MailItemsInfo mi; mi.AddItem(auction->item_guidlow, auction->item_template, pItem); - if (bidder) bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template); - WorldSession::SendMailTo(bidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->bidder, msgAuctionWonSubject.str(), itemTextId, &mi, 0, 0, MAIL_CHECK_MASK_AUCTION); } } - void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction) { uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); @@ -181,26 +157,19 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction) { std::ostringstream msgAuctionSalePendingSubject; msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING; - std::ostringstream msgAuctionSalePendingBody; uint32 auctionCut = auction->GetAuctionCut(); - time_t distrTime = time(NULL) + sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY); - msgAuctionSalePendingBody.width(16); msgAuctionSalePendingBody << std::right << std::hex << auction->bidder; msgAuctionSalePendingBody << std::dec << ":" << auction->bid << ":" << auction->buyout; msgAuctionSalePendingBody << ":" << auction->deposit << ":" << auctionCut << ":0:"; msgAuctionSalePendingBody << secsToTimeBitFields(distrTime); - sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); - uint32 itemTextId = objmgr.CreateItemText(msgAuctionSalePendingBody.str()); - WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION); } } - //call this method to send mail to auction owner, when auction is successful, it does not clear ram void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) { @@ -212,21 +181,15 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) { std::ostringstream msgAuctionSuccessfulSubject; msgAuctionSuccessfulSubject << auction->item_template << ":0:" << AUCTION_SUCCESSFUL; - std::ostringstream auctionSuccessfulBody; uint32 auctionCut = auction->GetAuctionCut(); - auctionSuccessfulBody.width(16); auctionSuccessfulBody << std::right << std::hex << auction->bidder; auctionSuccessfulBody << std::dec << ":" << auction->bid << ":" << auction->buyout; auctionSuccessfulBody << ":" << auction->deposit << ":" << auctionCut; - sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); - uint32 itemTextId = objmgr.CreateItemText(auctionSuccessfulBody.str()); - uint32 profit = auction->bid + auction->deposit - auctionCut; - //FIXME: what do if owner offline if (owner && owner->GetGUIDLow() != auctionbot.GetAHBplayerGUID()) { @@ -237,14 +200,12 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->owner, msgAuctionSuccessfulSubject.str(), itemTextId, NULL, profit, 0, MAIL_CHECK_MASK_AUCTION, sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY)); } } - //does not clear ram void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction) { //return an item in auction to its owner by mail Item *pItem = GetAItem(auction->item_guidlow); if (!pItem) return; - uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); Player *owner = objmgr.GetPlayer(owner_guid); uint32 owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); @@ -253,22 +214,17 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction) { std::ostringstream subject; subject << auction->item_template << ":0:" << AUCTION_EXPIRED; - if (owner && owner->GetGUIDLow() != auctionbot.GetAHBplayerGUID()) owner->GetSession()->SendAuctionOwnerNotification(auction); - MailItemsInfo mi; mi.AddItem(auction->item_guidlow, auction->item_template, pItem); - WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), GUID_LOPART(owner_guid), subject.str(), 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE); } } - void AuctionHouseMgr::LoadAuctionItems() { // data needs to be at first place for Item::LoadFromDB QueryResult *result = CharacterDatabase.Query("SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid"); - if (!result) { barGoLink bar(1); @@ -277,45 +233,34 @@ void AuctionHouseMgr::LoadAuctionItems() sLog.outString(">> Loaded 0 auction items"); return; } - barGoLink bar(result->GetRowCount()); - uint32 count = 0; - Field *fields; do { bar.step(); - fields = result->Fetch(); uint32 item_guid = fields[1].GetUInt32(); uint32 item_template = fields[2].GetUInt32(); - ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); - if (!proto) { sLog.outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid,item_template); continue; } - Item *item = NewItemOrBag(proto); - if (!item->LoadFromDB(item_guid,0, result)) { delete item; continue; } AddAItem(item); - ++count; } while (result->NextRow()); delete result; - sLog.outString(); sLog.outString(">> Loaded %u auction items", count); } - void AuctionHouseMgr::LoadAuctions() { QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse"); @@ -327,11 +272,9 @@ void AuctionHouseMgr::LoadAuctions() sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } - Field *fields = result->Fetch(); uint32 AuctionCount=fields[0].GetUInt32(); delete result; - if (!AuctionCount) { barGoLink bar(1); @@ -340,7 +283,6 @@ void AuctionHouseMgr::LoadAuctions() sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } - result = CharacterDatabase.Query("SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit FROM auctionhouse"); if (!result) { @@ -350,17 +292,12 @@ void AuctionHouseMgr::LoadAuctions() sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } - barGoLink bar(AuctionCount); - AuctionEntry *aItem; - do { fields = result->Fetch(); - bar.step(); - aItem = new AuctionEntry; aItem->Id = fields[0].GetUInt32(); aItem->auctioneer = fields[1].GetUInt32(); @@ -373,7 +310,6 @@ void AuctionHouseMgr::LoadAuctions() aItem->bid = fields[8].GetUInt32(); aItem->startbid = fields[9].GetUInt32(); aItem->deposit = fields[10].GetUInt32(); - CreatureData const* auctioneerData = objmgr.GetCreatureData(aItem->auctioneer); if (!auctioneerData) { @@ -382,7 +318,6 @@ void AuctionHouseMgr::LoadAuctions() delete aItem; continue; } - CreatureInfo const* auctioneerInfo = objmgr.GetCreatureTemplate(auctioneerData->id); if (!auctioneerInfo) { @@ -391,7 +326,6 @@ void AuctionHouseMgr::LoadAuctions() delete aItem; continue; } - aItem->auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(auctioneerInfo->faction_A); if (!aItem->auctionHouseEntry) { @@ -401,7 +335,6 @@ void AuctionHouseMgr::LoadAuctions() delete aItem; continue; } - // check if sold item exists for guid // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) if (!GetAItem(aItem->item_guidlow)) @@ -411,44 +344,35 @@ void AuctionHouseMgr::LoadAuctions() delete aItem; continue; } - GetAuctionsMap(auctioneerInfo->faction_A)->AddAuction(aItem); - } while (result->NextRow()); delete result; - sLog.outString(); sLog.outString(">> Loaded %u auctions", AuctionCount); } - void AuctionHouseMgr::AddAItem(Item* it) { ASSERT(it); ASSERT(mAitems.find(it->GetGUIDLow()) == mAitems.end()); mAitems[it->GetGUIDLow()] = it; } - bool AuctionHouseMgr::RemoveAItem(uint32 id) { ItemMap::iterator i = mAitems.find(id); if (i == mAitems.end()) return false; - mAitems.erase(i); return true; } - void AuctionHouseMgr::Update() { mHordeAuctions.Update(); mAllianceAuctions.Update(); mNeutralAuctions.Update(); } - AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId) { uint32 houseid = 7; // goblin auction house - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) { //FIXME: found way for proper auctionhouse selection by another way @@ -481,7 +405,6 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem } } } - return sAuctionHouseStore.LookupEntry(houseid); } void AuctionHouseObject::AddAuction(AuctionEntry *ah) @@ -490,57 +413,45 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem AuctionsMap[ah->Id] = ah; auctionbot.IncrementItemCounts(ah); } - bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template) { auctionbot.DecrementItemCounts(auction, item_template); return AuctionsMap.erase(auction->Id) ? true : false; } - void AuctionHouseObject::Update() { time_t curTime = sWorld.GetGameTime(); ///- Handle expired auctions - // If storage is empty, no need to update. next == NULL in this case. if (AuctionsMap.empty()) return; - QueryResult* result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE time <= %u ORDER BY TIME ASC", (uint32)curTime+60); - if (!result) { delete result; return; } - if (result->GetRowCount() == 0) { delete result; return; } - vector expiredAuctions; - do { uint32 tmpdata = result->Fetch()->GetUInt32(); expiredAuctions.push_back(tmpdata); } while (result->NextRow()); delete result; - vector::iterator iter = expiredAuctions.begin(); while (!expiredAuctions.empty()) { // from auctionhousehandler.cpp, creates auction pointer & player pointer AuctionEntry* auction = GetAuction(*iter); - // Erase the auction from the vector. expiredAuctions.erase(iter); - if (!auction) continue; - ///- Either cancel the auction if there was no bidder if (auction->bidder == 0) auctionmgr.SendAuctionExpiredMail(auction); @@ -553,7 +464,6 @@ void AuctionHouseObject::Update() auctionmgr.SendAuctionSuccessfulMail(auction); auctionmgr.SendAuctionWonMail(auction); } - ///- In any case clear the auction auction->DeleteFromDB(); uint32 item_template = auction->item_template; @@ -561,7 +471,6 @@ void AuctionHouseObject::Update() RemoveAuction(auction, item_template); } } - void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount) { for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr) @@ -571,12 +480,10 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, { if (itr->second->BuildAuctionInfo(data)) ++count; - ++totalcount; } } } - void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount) { for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr) @@ -586,50 +493,38 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, { if (Aentry->BuildAuctionInfo(data)) ++count; - ++totalcount; } } } - void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player, std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount) { int loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); - for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr) { AuctionEntry *Aentry = itr->second; Item *item = auctionmgr.GetAItem(Aentry->item_guidlow); if (!item) continue; - ItemPrototype const *proto = item->GetProto(); - if (itemClass != 0xffffffff && proto->Class != itemClass) continue; - if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass) continue; - if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType) continue; - if (quality != 0xffffffff && proto->Quality != quality) continue; - if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax))) continue; - if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK) continue; - std::string name = proto->Name1; if (name.empty()) continue; - // local name if (loc_idx >= 0) { @@ -640,10 +535,8 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player name = il->Name[loc_idx]; } } - if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname)) continue; - if (count < 50 && totalcount >= listfrom) { ++count; @@ -652,7 +545,6 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player ++totalcount; } } - //this function inserts to WorldPacket auction's data bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const { @@ -664,14 +556,12 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const } data << uint32(Id); data << uint32(pItem->GetEntry()); - for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i) { data << uint32(pItem->GetEnchantmentId(EnchantmentSlot(i))); data << uint32(pItem->GetEnchantmentDuration(EnchantmentSlot(i))); data << uint32(pItem->GetEnchantmentCharges(EnchantmentSlot(i))); } - data << uint32(pItem->GetItemRandomPropertyId()); //random item property id data << uint32(pItem->GetItemSuffixFactor()); //SuffixFactor data << uint32(pItem->GetCount()); //item->count @@ -687,7 +577,6 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const data << uint32(bid); //current bid return true; } - uint32 AuctionEntry::GetAuctionCut() const { int32 cut = int32(((double)auctionHouseEntry->cutPercent / 100.0f) * (double)sWorld.getRate(RATE_AUCTION_CUT)) * bid; @@ -696,7 +585,6 @@ uint32 AuctionEntry::GetAuctionCut() const else return 0; } - /// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c uint32 AuctionEntry::GetAuctionOutBid() const { @@ -705,13 +593,11 @@ uint32 AuctionEntry::GetAuctionOutBid() const outbid = 1; return outbid; } - void AuctionEntry::DeleteFromDB() const { //No SQL injection (Id is integer) CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",Id); } - void AuctionEntry::SaveToDB() const { //No SQL injection (no strings) diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h index 0e3ead4f608..5d62e16ab85 100644 --- a/src/game/AuctionHouseMgr.h +++ b/src/game/AuctionHouseMgr.h @@ -17,22 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _AUCTION_HOUSE_MGR_H #define _AUCTION_HOUSE_MGR_H - #include "Policies/Singleton.h" - #include "SharedDefines.h" - #include "AuctionHouseBot.h" - class Item; class Player; class WorldPacket; - #define MIN_AUCTION_TIME (12*HOUR) - enum AuctionError { AUCTION_OK = 0, @@ -41,14 +34,12 @@ enum AuctionError AUCTION_ITEM_NOT_FOUND = 4, CANNOT_BID_YOUR_AUCTION_ERROR = 10 }; - enum AuctionAction { AUCTION_SELL_ITEM = 0, AUCTION_CANCEL = 1, AUCTION_PLACE_BID = 2 }; - struct AuctionEntry { uint32 Id; @@ -63,7 +54,6 @@ struct AuctionEntry uint32 bidder; uint32 deposit; //deposit can be calculated only when creating auction AuctionHouseEntry const* auctionHouseEntry; // in AuctionHouse.dbc - // helpers uint32 GetHouseId() const { return auctionHouseEntry->houseId; } uint32 GetHouseFaction() const { return auctionHouseEntry->faction; } @@ -73,7 +63,6 @@ struct AuctionEntry void DeleteFromDB() const; void SaveToDB() const; }; - //this class is used as auctionhouse instance class AuctionHouseObject { @@ -85,51 +74,37 @@ class AuctionHouseObject for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) delete itr->second; } - typedef std::map AuctionEntryMap; - uint32 Getcount() { return AuctionsMap.size(); } - AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();} AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();} - AuctionEntry* GetAuction(uint32 id) const { AuctionEntryMap::const_iterator itr = AuctionsMap.find(id); return itr != AuctionsMap.end() ? itr->second : NULL; } - void AddAuction(AuctionEntry *ah); - bool RemoveAuction(AuctionEntry *auction, uint32 item_template); - void Update(); - void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount); void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount); void BuildListAuctionItems(WorldPacket& data, Player* player, std::wstring const& searchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount); - private: AuctionEntryMap AuctionsMap; - // storage for "next" auction item for next Update() AuctionEntryMap::const_iterator next; }; - class AuctionHouseMgr { public: AuctionHouseMgr(); ~AuctionHouseMgr(); - typedef UNORDERED_MAP ItemMap; - AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId); AuctionHouseObject* GetBidsMap(uint32 factionTemplateId); - Item* GetAItem(uint32 id) { ItemMap::const_iterator itr = mAitems.find(id); @@ -139,7 +114,6 @@ class AuctionHouseMgr } return NULL; } - //auction messages void SendAuctionWonMail(AuctionEntry * auction); void SendAuctionSalePendingMail(AuctionEntry * auction); @@ -147,25 +121,18 @@ class AuctionHouseMgr void SendAuctionExpiredMail(AuctionEntry * auction); static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem); static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId); - public: //load first auction items, because of check if item exists, when loading void LoadAuctionItems(); void LoadAuctions(); - void AddAItem(Item* it); bool RemoveAItem(uint32 id); - void Update(); - private: AuctionHouseObject mHordeAuctions; AuctionHouseObject mAllianceAuctions; AuctionHouseObject mNeutralAuctions; - ItemMap mAitems; }; - #define auctionmgr Trinity::Singleton::Instance() - #endif diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index 2d58b63c0a9..5b406c2eb08 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -17,25 +17,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectMgr.h" #include "Database/DatabaseEnv.h" - #include "Bag.h" #include "Log.h" #include "UpdateData.h" - Bag::Bag( ): Item() { m_objectType |= TYPEMASK_CONTAINER; m_objectTypeId = TYPEID_CONTAINER; - m_valuesCount = CONTAINER_END; - memset(m_bagslot, 0, sizeof(Item *) * MAX_BAG_SIZE); } - Bag::~Bag() { for(uint8 i = 0; i < MAX_BAG_SIZE; ++i) @@ -51,68 +45,52 @@ Bag::~Bag() delete m_bagslot[i]; } } - void Bag::AddToWorld() { Item::AddToWorld(); - for(uint32 i = 0; i < GetBagSize(); ++i) if(m_bagslot[i]) m_bagslot[i]->AddToWorld(); } - void Bag::RemoveFromWorld() { for(uint32 i = 0; i < GetBagSize(); ++i) if(m_bagslot[i]) m_bagslot[i]->RemoveFromWorld(); - Item::RemoveFromWorld(); } - bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) { ItemPrototype const * itemProto = objmgr.GetItemPrototype(itemid); - if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE) return false; - Object::_Create( guidlow, 0, HIGHGUID_CONTAINER ); - SetEntry(itemid); SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); - SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); - SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability); SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability); SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags); SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1); - // Setting the number of Slots the Container has SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots); - // Cleaning 20 slots for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); m_bagslot[i] = NULL; } - return true; } - void Bag::SaveToDB() { Item::SaveToDB(); } - bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) { if(!Item::LoadFromDB(guid, owner_guid, result)) return false; - // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`) for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { @@ -123,44 +101,34 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) m_bagslot[i] = NULL; } } - return true; } - void Bag::DeleteFromDB() { for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) if (m_bagslot[i]) m_bagslot[i]->DeleteFromDB(); - Item::DeleteFromDB(); } - uint32 Bag::GetFreeSlots() const { uint32 slots = 0; for (uint32 i=0; i < GetBagSize(); ++i) if (!m_bagslot[i]) ++slots; - return slots; } - void Bag::RemoveItem( uint8 slot, bool /*update*/ ) { assert(slot < MAX_BAG_SIZE); - if (m_bagslot[slot]) m_bagslot[slot]->SetContainer(NULL); - m_bagslot[slot] = NULL; SetUInt64Value( CONTAINER_FIELD_SLOT_1 + (slot * 2), 0 ); } - void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ ) { assert(slot < MAX_BAG_SIZE); - if( pItem ) { m_bagslot[slot] = pItem; @@ -171,26 +139,21 @@ void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ ) pItem->SetSlot(slot); } } - void Bag::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const { Item::BuildCreateUpdateBlockForPlayer( data, target ); - for (uint32 i = 0; i < GetBagSize(); ++i) if(m_bagslot[i]) m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target ); } - // If the bag is empty returns true bool Bag::IsEmpty() const { for(uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) return false; - return true; } - uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const { Item *pItem; @@ -201,7 +164,6 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const if( pItem && pItem != eItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - if(eItem && eItem->GetProto()->GemProperties) { for(uint32 i=0; i < GetBagSize(); ++i) @@ -211,25 +173,20 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const count += pItem->GetGemCountWithID(item); } } - return count; } - uint8 Bag::GetSlotByItemGUID(uint64 guid) const { for(uint32 i = 0; i < GetBagSize(); ++i) if(m_bagslot[i] != 0) if(m_bagslot[i]->GetGUID() == guid) return i; - return NULL_SLOT; } - Item* Bag::GetItemByPos( uint8 slot ) const { if( slot < GetBagSize() ) return m_bagslot[slot]; - return NULL; } diff --git a/src/game/Bag.h b/src/game/Bag.h index 3ae786512ce..649c2e21a27 100644 --- a/src/game/Bag.h +++ b/src/game/Bag.h @@ -17,40 +17,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_BAG_H #define TRINITY_BAG_H - // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 #define MAX_BAG_SIZE 36 // 2.0.12 - #include "Item.h" #include "ItemPrototype.h" - class Bag : public Item { public: - Bag(); ~Bag(); - void AddToWorld(); void RemoveFromWorld(); - bool Create(uint32 guidlow, uint32 itemid, Player const* owner); - void Clear(); void StoreItem( uint8 slot, Item *pItem, bool update ); void RemoveItem( uint8 slot, bool update ); - Item* GetItemByPos( uint8 slot ) const; uint32 GetItemCount( uint32 item, Item* eItem = NULL ) const; - uint8 GetSlotByItemGUID(uint64 guid) const; bool IsEmpty() const; uint32 GetFreeSlots() const; uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); } - // DB operations // overwrite virtual Item::SaveToDB void SaveToDB(); @@ -58,15 +47,11 @@ class Bag : public Item bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL); // overwrite virtual Item::DeleteFromDB void DeleteFromDB(); - void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; - protected: - // Bag Storage space Item* m_bagslot[MAX_BAG_SIZE]; }; - inline Item* NewItemOrBag(ItemPrototype const * proto) { return (proto->InventoryType == INVTYPE_BAG) ? new Bag : new Item; diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 3eb699472d8..92c82f620f5 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -17,12 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Player.h" #include "ObjectMgr.h" #include "World.h" #include "WorldPacket.h" - #include "ArenaTeam.h" #include "BattleGround.h" #include "BattleGroundMgr.h" @@ -36,7 +34,6 @@ #include "SpellAuras.h" #include "Util.h" - namespace MaNGOS { class BattleGroundChatBuilder @@ -47,17 +44,14 @@ namespace MaNGOS void operator()(WorldPacket& data, int32 loc_idx) { char const* text = objmgr.GetMangosString(i_textId,loc_idx); - if (i_args) { // we need copy va_list before use or original va_list will corrupted va_list ap; va_copy(ap,*i_args); - char str [2048]; vsnprintf(str,2048,text, ap ); va_end(ap); - do_helper(data,&str[0]); } else @@ -67,7 +61,6 @@ namespace MaNGOS void do_helper(WorldPacket& data, char const* text) { uint64 target_guid = i_source ? i_source ->GetGUID() : 0; - data << uint8(i_msgtype); data << uint32(LANG_UNIVERSAL); data << uint64(target_guid); // there 0 for BG messages @@ -77,13 +70,11 @@ namespace MaNGOS data << text; data << uint8(i_source ? i_source->chatTag() : uint8(0)); } - ChatMsg i_msgtype; int32 i_textId; Player const* i_source; va_list* i_args; }; - class BattleGround2ChatBuilder { public: @@ -94,12 +85,9 @@ namespace MaNGOS char const* text = objmgr.GetMangosString(i_textId,loc_idx); char const* arg1str = i_arg1 ? objmgr.GetMangosString(i_arg1,loc_idx) : ""; char const* arg2str = i_arg2 ? objmgr.GetMangosString(i_arg2,loc_idx) : ""; - char str [2048]; snprintf(str,2048,text, arg1str, arg2str ); - uint64 target_guid = i_source ? i_source ->GetGUID() : 0; - data << uint8(i_msgtype); data << uint32(LANG_UNIVERSAL); data << uint64(target_guid); // there 0 for BG messages @@ -110,7 +98,6 @@ namespace MaNGOS data << uint8(i_source ? i_source->chatTag() : uint8(0)); } private: - ChatMsg i_msgtype; int32 i_textId; Player const* i_source; @@ -118,7 +105,6 @@ namespace MaNGOS int32 i_arg2; }; } // namespace MaNGOS - template void BattleGround::BroadcastWorker(Do& _do) { @@ -126,7 +112,6 @@ void BattleGround::BroadcastWorker(Do& _do) if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) _do(plr); } - BattleGround::BattleGround() { m_TypeID = BattleGroundTypeId(0); @@ -150,46 +135,32 @@ BattleGround::BattleGround() m_LevelMax = 0; m_InBGFreeSlotQueue = false; m_SetDeleteThis = false; - m_MaxPlayersPerTeam = 0; m_MaxPlayers = 0; m_MinPlayersPerTeam = 0; m_MinPlayers = 0; - m_MapId = 0; - m_TeamStartLocX[BG_TEAM_ALLIANCE] = 0; m_TeamStartLocX[BG_TEAM_HORDE] = 0; - m_TeamStartLocY[BG_TEAM_ALLIANCE] = 0; m_TeamStartLocY[BG_TEAM_HORDE] = 0; - m_TeamStartLocZ[BG_TEAM_ALLIANCE] = 0; m_TeamStartLocZ[BG_TEAM_HORDE] = 0; - m_TeamStartLocO[BG_TEAM_ALLIANCE] = 0; m_TeamStartLocO[BG_TEAM_HORDE] = 0; - m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamIds[BG_TEAM_HORDE] = 0; - m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0; - m_BgRaids[BG_TEAM_ALLIANCE] = NULL; m_BgRaids[BG_TEAM_HORDE] = NULL; - m_PlayersCount[BG_TEAM_ALLIANCE] = 0; m_PlayersCount[BG_TEAM_HORDE] = 0; - m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; - m_PrematureCountDown = false; m_PrematureCountDown = 0; - m_HonorMode = BG_NORMAL; - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; @@ -200,7 +171,6 @@ BattleGround::BattleGround() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; } - BattleGround::~BattleGround() { // remove objects and creatures @@ -208,11 +178,9 @@ BattleGround::~BattleGround() int size = m_BgCreatures.size(); for(int i = 0; i < size; ++i) DelCreature(i); - size = m_BgObjects.size(); for(int i = 0; i < size; ++i) DelObject(i); - if (GetInstanceID()) // not spam by useless queries in case BG templates { // delete creature and go respawn times @@ -222,7 +190,6 @@ BattleGround::~BattleGround() CharacterDatabase.PExecute("DELETE FROM instance WHERE id = '%u'",GetInstanceID()); // remove from battlegrounds } - sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID()); // unload map if (Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID())) @@ -230,11 +197,9 @@ BattleGround::~BattleGround() ((BattleGroundMap*)map)->SetUnload(); // remove from bg free slot queue this->RemoveFromBGFreeSlotQueue(); - for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) delete itr->second; } - void BattleGround::Update(uint32 diff) { if (!GetPlayersSize()) @@ -253,7 +218,6 @@ void BattleGround::Update(uint32 diff) m_SetDeleteThis = true; return; } - // remove offline players from bg after 5 minutes if (!m_OfflineQueue.empty()) { @@ -268,11 +232,9 @@ void BattleGround::Update(uint32 diff) } } } - /*********************************************************/ /*** BATTLEGROUND RESSURECTION SYSTEM ***/ /*********************************************************/ - //this should be handled by spell system m_LastResurrectTime += diff; if (m_LastResurrectTime >= RESURRECTION_INTERVAL) @@ -287,7 +249,6 @@ void BattleGround::Update(uint32 diff) Player *plr = objmgr.GetPlayer(*itr2); if (!plr) continue; - if (!sh && plr->IsInWorld()) { sh = plr->GetMap()->GetCreature(itr->first); @@ -296,14 +257,12 @@ void BattleGround::Update(uint32 diff) // Spirit Heal, effect 117 sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); } - // Resurrection visual plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); m_ResurrectQueue.push_back(*itr2); } (itr->second).clear(); } - m_ReviveQueue.clear(); m_LastResurrectTime = 0; } @@ -325,11 +284,9 @@ void BattleGround::Update(uint32 diff) } m_ResurrectQueue.clear(); } - /*********************************************************/ /*** BATTLEGROUND BALLANCE SYSTEM ***/ /*********************************************************/ - // if less then minimum players are in on one side, then start premature finish timer if (GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam())) { @@ -346,7 +303,6 @@ void BattleGround::Update(uint32 diff) winner = ALLIANCE; else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam()) winner = HORDE; - EndBattleGround(winner); m_PrematureCountDown = false; } @@ -370,26 +326,21 @@ void BattleGround::Update(uint32 diff) } else if (m_PrematureCountDown) m_PrematureCountDown = false; - /*********************************************************/ /*** BATTLEGROUND STARTING SYSTEM ***/ /*********************************************************/ - if (GetStatus() == STATUS_WAIT_JOIN && GetPlayersSize()) { ModifyStartDelayTime(diff); - if (!(m_Events & BG_STARTING_EVENT_1)) { m_Events |= BG_STARTING_EVENT_1; - // setup here, only when at least one player has ported to the map if (!SetupBattleGround()) { EndNow(); return; } - StartingEventCloseDoors(); SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]); //first start warning - 2 or 1 minute @@ -411,18 +362,14 @@ void BattleGround::Update(uint32 diff) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) { m_Events |= BG_STARTING_EVENT_4; - StartingEventOpenDoors(); - SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FOURTH], CHAT_MSG_BG_SYSTEM_NEUTRAL); SetStatus(STATUS_IN_PROGRESS); SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]); - //remove preparation if (isArena()) { //TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START); - for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) if (Player *plr = objmgr.GetPlayer(itr->first)) { @@ -443,14 +390,11 @@ void BattleGround::Update(uint32 diff) ++iter; } } - CheckArenaWinConditions(); } else { - PlaySoundToAll(SOUND_BG_START); - for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) if (Player* plr = objmgr.GetPlayer(itr->first)) plr->RemoveAurasDueToSpell(SPELL_PREPARATION); @@ -462,11 +406,9 @@ void BattleGround::Update(uint32 diff) } } } - /*********************************************************/ /*** BATTLEGROUND ENDING SYSTEM ***/ /*********************************************************/ - if (GetStatus() == STATUS_WAIT_LEAVE) { // remove all players from battleground after 2 minutes @@ -485,11 +427,9 @@ void BattleGround::Update(uint32 diff) } } } - //update start time m_StartTime += diff; } - void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O) { BattleGroundTeamId idx = GetTeamIndexByTeamId(TeamID); @@ -498,7 +438,6 @@ void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, flo m_TeamStartLocZ[idx] = Z; m_TeamStartLocO[idx] = O; } - void BattleGround::SendPacketToAll(WorldPacket *packet) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -510,54 +449,43 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); } } - void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender, bool self) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr) { sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - if (!self && sender == plr) continue; - uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); - if (team == TeamID) plr->GetSession()->SendPacket(packet); } } - void BattleGround::PlaySoundToAll(uint32 SoundID) { WorldPacket data; sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID); SendPacketToAll(&data); } - void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) { WorldPacket data; - for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr) { sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); - if (team == TeamID) { sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID); @@ -565,27 +493,22 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) } } } - void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr) { sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); - if (team == TeamID) plr->CastSpell(plr, SpellID, true); } } - void BattleGround::YellToAll(Creature* creature, const char* text, uint32 language) { for(std::map::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -602,102 +525,81 @@ void BattleGround::YellToAll(Creature* creature, const char* text, uint32 langua } } - void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr) { sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); - if (team == TeamID) UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor); } } - void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID) { FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); - if (!factionEntry) return; - for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr) { sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); - if (team == TeamID) plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation); } } - void BattleGround::UpdateWorldState(uint32 Field, uint32 Value) { WorldPacket data; sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value); SendPacketToAll(&data); } - void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source) { WorldPacket data; sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value); Source->GetSession()->SendPacket(&data); } - void BattleGround::EndBattleGround(uint32 winner) { this->RemoveFromBGFreeSlotQueue(); - ArenaTeam * winner_arena_team = NULL; ArenaTeam * loser_arena_team = NULL; uint32 loser_rating = 0; uint32 winner_rating = 0; WorldPacket data; int32 winmsg_id = 0; - if (winner == ALLIANCE) { winmsg_id = isBattleGround() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; - PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound - SetWinner(WINNER_ALLIANCE); } else if (winner == HORDE) { winmsg_id = isBattleGround() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; - PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound - SetWinner(WINNER_HORDE); } else { SetWinner(3); } - SetStatus(STATUS_WAIT_LEAVE); //we must set it this way, because end time is sent in packet! m_EndTime = TIME_TO_AUTOREMOVE; - // arena rating calculation if (isArena() && isRated()) { @@ -720,12 +622,10 @@ void BattleGround::EndBattleGround(uint32 winner) SetArenaTeamRatingChangeForTeam(HORDE, 0); } } - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); uint32 team = itr->second.Team; - if (!plr) { //if rated arena match - make member lost! @@ -739,11 +639,9 @@ void BattleGround::EndBattleGround(uint32 winner) sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } - // should remove spirit of redemption if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); - if (!plr->isAlive()) { plr->ResurrectPlayer(1.0f); @@ -754,10 +652,8 @@ void BattleGround::EndBattleGround(uint32 winner) plr->CombatStop(); plr->getHostilRefManager().deleteReferences(); } - //this line is obsolete - team is set ALWAYS //if(!team) team = plr->GetTeam(); - // per player calculation if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) { @@ -767,18 +663,15 @@ void BattleGround::EndBattleGround(uint32 winner) ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetGUID()); if (member) plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating); - winner_arena_team->MemberWon(plr,loser_rating); } else { loser_arena_team->MemberLost(plr,winner_rating); - // Arena lost => reset the win_rated_arena having the "no_loose" condition plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE); } } - if (team == winner) { RewardMark(plr,ITEM_WINNER_COUNT); @@ -787,20 +680,15 @@ void BattleGround::EndBattleGround(uint32 winner) } else if(winner) RewardMark(plr,ITEM_LOSER_COUNT); - plr->CombatStopWithPets(true); - BlockMovement(plr); - sBattleGroundMgr.BuildPvpLogDataPacket(&data, this); plr->GetSession()->SendPacket(&data); - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType()); plr->GetSession()->SendPacket(&data); plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1); } - if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) { // update arena points only after increasing the player's match count! @@ -814,17 +702,14 @@ void BattleGround::EndBattleGround(uint32 winner) winner_arena_team->NotifyStatsChanged(); loser_arena_team->NotifyStatsChanged(); } - if (winmsg_id) SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL); } - uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const { //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill) return MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills); } - uint32 BattleGround::GetBattlemasterEntry() const { switch(GetTypeID()) @@ -837,7 +722,6 @@ uint32 BattleGround::GetBattlemasterEntry() const default: return 0; } } - void BattleGround::RewardMark(Player *plr,uint32 count) { BattleGroundMarks mark; @@ -858,75 +742,60 @@ void BattleGround::RewardMark(Player *plr,uint32 count) default: return; } - //if (IsSpell) // RewardSpellCast(plr,mark); //else RewardItem(plr,mark,count); } - void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id) { // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens if (plr->HasAura(SPELL_AURA_PLAYER_INACTIVE)) return; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if(!spellInfo) { sLog.outError("Battleground reward casting spell %u not exist.",spell_id); return; } - plr->CastSpell(plr, spellInfo, true); } - void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count) { // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens if (plr->HasAura(SPELL_AURA_PLAYER_INACTIVE)) return; - ItemPosCountVec dest; uint32 no_space_count = 0; uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count ); - if( msg == EQUIP_ERR_ITEM_NOT_FOUND) { sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.",item_id); return; } - if( msg != EQUIP_ERR_OK ) // convert to possible store amount count -= no_space_count; - if( count != 0 && !dest.empty()) // can add some if (Item* item = plr->StoreNewItem( dest, item_id, true, 0)) plr->SendNewItem(item,count,true,false); - if (no_space_count > 0) SendRewardMarkByMail(plr,item_id,no_space_count); } - void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) { uint32 bmEntry = GetBattlemasterEntry(); if (!bmEntry) return; - ItemPrototype const* markProto = objmgr.GetItemPrototype(mark); if (!markProto) return; - if (Item* markItem = Item::CreateItem(mark,count,plr)) { // save new item before send markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted - // item MailItemsInfo mi; mi.AddItem(markItem->GetGUIDLow(), markItem->GetEntry(), markItem); - // subject: item name std::string subject = markProto->Name1; int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex(); @@ -934,17 +803,14 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId)) if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) subject = il->Name[loc_idx]; - // text std::string textFormat = plr->GetSession()->GetTrinityString(LANG_BG_MARK_BY_MAIL); char textBuf[300]; snprintf(textBuf,300,textFormat.c_str(),GetName(),GetName()); uint32 itemTextId = objmgr.CreateItemText( textBuf ); - WorldSession::SendMailTo(plr, MAIL_CREATURE, MAIL_STATIONERY_NORMAL, bmEntry, plr->GetGUIDLow(), subject, itemTextId , &mi, 0, 0, MAIL_CHECK_MASK_NONE); } } - void BattleGround::RewardQuestComplete(Player *plr) { uint32 quest; @@ -965,15 +831,12 @@ void BattleGround::RewardQuestComplete(Player *plr) default: return; } - RewardSpellCast(plr, quest); } - void BattleGround::BlockMovement(Player *plr) { plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave() } - void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket) { uint32 team = GetPlayerTeam(guid); @@ -987,30 +850,23 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac // check if the player was a participant of the match, or only entered through gm command (goname) participant = true; } - BattleGroundScoreMap::iterator itr2 = m_PlayerScores.find(guid); if (itr2 != m_PlayerScores.end()) { delete itr2->second; // delete player's score m_PlayerScores.erase(itr2); } - RemovePlayerFromResurrectQueue(guid); - Player *plr = objmgr.GetPlayer(guid); - // should remove spirit of redemption if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); - if(plr && !plr->isAlive()) // resurrect on exit { plr->ResurrectPlayer(1.0f); plr->SpawnCorpseBones(); } - RemovePlayer(plr, guid); // BG subclass specific code - if(participant) // if the player was a match participant, remove auras, calc rating, update queue { BattleGroundTypeId bgTypeId = GetTypeID(); @@ -1018,19 +874,15 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (plr) { plr->ClearAfkReports(); - if(!team) team = plr->GetTeam(); - // if arena, remove the specific arena auras if (isArena()) { plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing) - // unsummon current and summon old pet if there was one and there isn't a current pet plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT); plr->ResummonPetTemporaryUnSummonedIfAny(); - if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { //left a rated match while the encounter was in progress, consider as loser @@ -1046,7 +898,6 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0); plr->GetSession()->SendPacket(&data); } - // this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg plr->RemoveBattleGroundQueueId(bgQueueTypeId); } @@ -1062,7 +913,6 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating()); } } - // remove from raid group if player is member if (Group *group = GetBgRaid(team)) { @@ -1085,23 +935,18 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid); SendPacketToTeam(team, &data, plr, false); } - if (plr) { // Do next only if found in battleground plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG. // reset destination bg team plr->SetBGTeam(0); - if (Transport) plr->TeleportToBGEntryPoint(); - sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName()); } - //battleground object will be deleted next BattleGround::Update() call } - // this method is called when no players remains in battleground void BattleGround::Reset() { @@ -1113,32 +958,24 @@ void BattleGround::Reset() SetLastResurrectTime(0); SetArenaType(0); SetRated(false); - m_Events = 0; - if (m_InvitedAlliance > 0 || m_InvitedHorde > 0) sLog.outError("BattleGround system: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde); - m_InvitedAlliance = 0; m_InvitedHorde = 0; m_InBGFreeSlotQueue = false; - m_Players.clear(); - for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) delete itr->second; m_PlayerScores.clear(); - ResetBGSubclass(); } - void BattleGround::StartBattleGround() { SetStartTime(0); SetLastResurrectTime(0); // add BG to free slot queue AddToBGFreeSlotQueue(); - // add bg to update list // This must be done here, because we need to have already invited some players when first BG::Update() method is executed // and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes @@ -1146,31 +983,23 @@ void BattleGround::StartBattleGround() if(m_IsRated) sLog.outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); } - void BattleGround::AddPlayer(Player *plr) { // remove afk from player if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK)) plr->ToggleAFK(); - // score struct must be created in inherited class - uint64 guid = plr->GetGUID(); uint32 team = plr->GetBGTeam(); - BattleGroundPlayer bp; bp.OfflineRemoveTime = 0; bp.Team = team; - // Add to list/maps m_Players[guid] = bp; - UpdatePlayersCountByTeam(team, false); // +1 player - WorldPacket data; sBattleGroundMgr.BuildPlayerJoinedBattleGroundPacket(&data, plr); SendPacketToTeam(team, &data, plr, false); - // add arena specific auras if (isArena()) { @@ -1191,14 +1020,11 @@ void BattleGround::AddPlayer(Player *plr) else plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true); } - plr->DestroyConjuredItems(true); plr->UnsummonPetTemporaryIfAny(); - if(GetStatus() == STATUS_WAIT_JOIN) // not started yet { plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true); - plr->SetHealth(plr->GetMaxHealth()); plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); } @@ -1208,18 +1034,14 @@ void BattleGround::AddPlayer(Player *plr) if(GetStatus() == STATUS_WAIT_JOIN) // not started yet plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells. } - plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId()); plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId()); - // setup BG group membership PlayerAddedToBGCheckIfBGIsRunning(plr); AddOrSetPlayerToCorrectBgGroup(plr, guid, team); - // Log sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName()); } - /* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team) { @@ -1246,7 +1068,6 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, } } } - // This method should be called when player logs into running battleground void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid) { @@ -1264,7 +1085,6 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid) // if battleground is starting, then add preparation aura // we don't have to do that, because preparation aura isn't removed when player logs out } - // This method should be called when player logs out from running battleground void BattleGround::EventPlayerLoggedOut(Player* player) { @@ -1283,7 +1103,6 @@ void BattleGround::EventPlayerLoggedOut(Player* player) } } } - /* This method should be called only once ... it adds pointer to queue */ void BattleGround::AddToBGFreeSlotQueue() { @@ -1294,7 +1113,6 @@ void BattleGround::AddToBGFreeSlotQueue() m_InBGFreeSlotQueue = true; } } - /* This method removes this battleground from free queue - it must be called when deleting battleground - not used now*/ void BattleGround::RemoveFromBGFreeSlotQueue() { @@ -1310,7 +1128,6 @@ void BattleGround::RemoveFromBGFreeSlotQueue() } } } - // get the number of free slots for team // returns the number how many players can join battleground to MaxPlayersPerTeam uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const @@ -1342,7 +1159,6 @@ uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const // allow join more ppl if the other side has more players else if(otherTeam > GetInvitedCount(Team)) diff = otherTeam - GetInvitedCount(Team); - // difference based on max players per team (don't allow inviting more) uint32 diff2 = (GetInvitedCount(Team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(Team) : 0; // difference based on players who already entered @@ -1357,9 +1173,7 @@ uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const // or other side has less than minPlayersPerTeam else if (GetInvitedCount(Team) <= GetMinPlayersPerTeam()) diff3 = GetMinPlayersPerTeam() - GetInvitedCount(Team) + 1; - // return the minimum of the 3 differences - // min of diff and diff 2 diff = diff < diff2 ? diff : diff2; // min of diff, diff2 and diff3 @@ -1367,20 +1181,16 @@ uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const } return 0; } - bool BattleGround::HasFreeSlots() const { return GetPlayersSize() < GetMaxPlayers(); } - void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { //this procedure is called from virtual function implemented in bg subclass BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); - if(itr == m_PlayerScores.end()) // player not found... return; - switch(type) { case SCORE_KILLING_BLOWS: // Killing blows @@ -1413,18 +1223,14 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) break; } } - void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) { m_ReviveQueue[npc_guid].push_back(player_guid); - Player *plr = objmgr.GetPlayer(player_guid); if (!plr) return; - plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); } - void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid) { for(std::map >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) @@ -1434,25 +1240,20 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid) if (*itr2 == player_guid) { (itr->second).erase(itr2); - Player *plr = objmgr.GetPlayer(player_guid); if (!plr) return; - plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); - return; } } } } - bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime) { Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID()); if (!map) return false; - // must be created this way, adding to godatamap would add it to the base map of the instance // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created // so we must create it specific for this instance @@ -1467,11 +1268,9 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float } /* uint32 guid = go->GetGUIDLow(); - // without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata // iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed GameObjectData& data = objmgr.NewGOData(guid); - data.id = entry; data.mapid = GetMapId(); data.posX = x; @@ -1492,7 +1291,6 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float m_BgObjects[type] = go->GetGUID(); return true; } - //some doors aren't despawned so we cannot handle their closing in gameobject::update() //it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code void BattleGround::DoorClose(uint32 type) @@ -1513,7 +1311,6 @@ void BattleGround::DoorClose(uint32 type) sLog.outError("BattleGround: Door object not found (cannot close doors)"); } } - void BattleGround::DoorOpen(uint32 type) { GameObject *obj = HashMapHolder::Find(m_BgObjects[type]); @@ -1528,7 +1325,6 @@ void BattleGround::DoorOpen(uint32 type) sLog.outError("BattleGround: Door object not found! - doors will be closed."); } } - GameObject* BattleGround::GetBGObject(uint32 type) { GameObject *obj = HashMapHolder::Find(m_BgObjects[type]); @@ -1536,7 +1332,6 @@ GameObject* BattleGround::GetBGObject(uint32 type) sLog.outError("couldn't get gameobject %i",type); return obj; } - Creature* BattleGround::GetBGCreature(uint32 type) { Creature *creature = HashMapHolder::Find(m_BgCreatures[type]); @@ -1544,7 +1339,6 @@ Creature* BattleGround::GetBGCreature(uint32 type) sLog.outError("couldn't get creature %i",type); return creature; } - void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime) { Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID()); @@ -1573,13 +1367,11 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime) } } } - Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime) { Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID()); if (!map) return NULL; - Creature* pCreature = new Creature; if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) { @@ -1587,14 +1379,10 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f delete pCreature; return NULL; } - pCreature->SetHomePosition(x, y, z, o); - //pCreature->SetDungeonDifficulty(0); - map->Add(pCreature); m_BgCreatures[type] = pCreature->GetGUID(); - return pCreature; } /* @@ -1603,7 +1391,6 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime) Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId()); if (!map) return false; - if (respawntime == 0) { Creature *obj = HashMapHolder::Find(m_BgCreatures[type]); @@ -1631,7 +1418,6 @@ bool BattleGround::DelCreature(uint32 type) { if (!m_BgCreatures[type]) return true; - Creature *cr = HashMapHolder::Find(m_BgCreatures[type]); if (!cr) { @@ -1642,12 +1428,10 @@ bool BattleGround::DelCreature(uint32 type) m_BgCreatures[type] = 0; return true; } - bool BattleGround::DelObject(uint32 type) { if (!m_BgObjects[type]) return true; - GameObject *obj = HashMapHolder::Find(m_BgObjects[type]); if (!obj) { @@ -1659,16 +1443,13 @@ bool BattleGround::DelObject(uint32 type) m_BgObjects[type] = 0; return true; } - bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team) { uint32 entry = 0; - if (team == ALLIANCE) entry = BG_CREATURE_ENTRY_A_SPIRITGUIDE; else entry = BG_CREATURE_ENTRY_H_SPIRITGUIDE; - Creature* pCreature = AddCreature(entry,type,team,x,y,z,o); if (!pCreature) { @@ -1676,14 +1457,11 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float EndNow(); return false; } - pCreature->setDeathState(DEAD); - pCreature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pCreature->GetGUID()); // aura //TODO: Fix display here //pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); - //pCreature->SetUInt32Value(UNIT_FIELD_AURAFLAGS, 0x00000009); //pCreature->SetUInt32Value(UNIT_FIELD_AURALEVELS, 0x0000003C); //pCreature->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS, 0x000000FF); @@ -1691,52 +1469,42 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL); // correct cast speed pCreature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); - //pCreature->CastSpell(pCreature, SPELL_SPIRIT_HEAL_CHANNEL, true); - return true; } - void BattleGround::SendMessageToAll(int32 entry, ChatMsg type, Player const* source) { MaNGOS::BattleGroundChatBuilder bg_builder(type, entry, source); MaNGOS::LocalizedPacketDo bg_do(bg_builder); BroadcastWorker(bg_do); } - void BattleGround::PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...) { va_list ap; va_start(ap, source); - MaNGOS::BattleGroundChatBuilder bg_builder(type, entry, source, &ap); MaNGOS::LocalizedPacketDo bg_do(bg_builder); BroadcastWorker(bg_do); - va_end(ap); } - void BattleGround::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2) { MaNGOS::BattleGround2ChatBuilder bg_builder(type, entry, source, arg1, arg2); MaNGOS::LocalizedPacketDo bg_do(bg_builder); BroadcastWorker(bg_do); } - void BattleGround::EndNow() { RemoveFromBGFreeSlotQueue(); SetStatus(STATUS_WAIT_LEAVE); SetEndTime(0); } - //to be removed const char *BattleGround::GetTrinityString(int32 entry) { // FIXME: now we have different DBC locales and need localized message for each target client return objmgr.GetTrinityStringForDBCLocale(entry); } - /* important notice: buffs aren't spawned/despawned when players captures anything @@ -1747,7 +1515,6 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid) GameObject *obj = HashMapHolder::Find(go_guid); if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned()) return; - //change buff type, when buff is used: int32 index = m_BgObjects.size() - 1; while (index >= 0 && m_BgObjects[index] != go_guid) @@ -1757,7 +1524,6 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid) sLog.outError("BattleGround (Type: %u) has buff gameobject (Guid: %u Entry: %u Type:%u) but it hasn't that object in its internal data",GetTypeID(),GUID_LOPART(go_guid),obj->GetEntry(),obj->GetGoType()); return; } - //randomly select new buff uint8 buff = urand(0, 2); uint32 entry = obj->GetEntry(); @@ -1773,40 +1539,31 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid) index += buff; } } - SpawnBGObject(index, BUFF_RESPAWN_TIME); } - void BattleGround::HandleKillPlayer( Player *player, Player *killer ) { //keep in mind that for arena this will have to be changed a bit - // add +1 deaths UpdatePlayerScore(player, SCORE_DEATHS, 1); - // add +1 kills to group and +1 killing_blows to killer if (killer) { UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1); UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1); - for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); - if (!plr || plr == killer) continue; - if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player)) UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1); } } - // to be able to remove insignia -- ONLY IN BattleGrounds if (!isArena()) player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE ); } - // return the player's team based on battlegroundplayer info // used in same faction arena matches mainly uint32 BattleGround::GetPlayerTeam(uint64 guid) @@ -1816,12 +1573,10 @@ uint32 BattleGround::GetPlayerTeam(uint64 guid) return itr->second.Team; return 0; } - uint32 BattleGround::GetOtherTeam(uint32 teamId) { return (teamId) ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0; } - bool BattleGround::IsPlayerInBattleGround(uint64 guid) { BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid); @@ -1829,24 +1584,18 @@ bool BattleGround::IsPlayerInBattleGround(uint64 guid) return true; return false; } - void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr) { if (GetStatus() != STATUS_WAIT_LEAVE) return; - WorldPacket data; BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); - BlockMovement(plr); - sBattleGroundMgr.BuildPvpLogDataPacket(&data, this); plr->GetSession()->SendPacket(&data); - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType()); plr->GetSession()->SendPacket(&data); } - uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const { int count = 0; @@ -1861,7 +1610,6 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const } return count; } - void BattleGround::SetHoliday(bool is_holiday) { if(is_holiday) @@ -1869,7 +1617,6 @@ void BattleGround::SetHoliday(bool is_holiday) else m_HonorMode = BG_NORMAL; } - int32 BattleGround::GetObjectType(uint64 guid) { for(uint32 i = 0; i < m_BgObjects.size(); ++i) @@ -1878,11 +1625,9 @@ int32 BattleGround::GetObjectType(uint64 guid) sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!"); return -1; } - void BattleGround::HandleKillUnit(Creature *creature, Player *killer) { } - void BattleGround::CheckArenaWinConditions() { if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) @@ -1890,7 +1635,6 @@ void BattleGround::CheckArenaWinConditions() else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE)) EndBattleGround(ALLIANCE); } - void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) { Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; @@ -1898,12 +1642,10 @@ void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) if(bg_raid) bg_raid->SetBattlegroundGroup(this); old_raid = bg_raid; } - WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player ) { return objmgr.GetClosestGraveYard( player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam() ); } - bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const { BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 007f7a642dd..cb19fd92525 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -17,21 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUND_H #define __BATTLEGROUND_H - #include "Common.h" #include "SharedDefines.h" - class Creature; class GameObject; class Group; class Player; class WorldPacket; - struct WorldSafeLocsEntry; - enum BattleGroundSounds { SOUND_HORDE_WINS = 8454, @@ -39,7 +34,6 @@ enum BattleGroundSounds SOUND_BG_START = 3439, SOUND_BG_START_L70ETC = 11803, }; - enum BattleGroundQuests { SPELL_WS_QUEST_REWARD = 43483, @@ -50,7 +44,6 @@ enum BattleGroundQuests SPELL_AB_QUEST_REWARD_4_BASES = 24061, SPELL_AB_QUEST_REWARD_5_BASES = 24064 }; - enum BattleGroundMarks { SPELL_WS_MARK_LOSER = 24950, @@ -64,19 +57,16 @@ enum BattleGroundMarks ITEM_AB_MARK_OF_HONOR = 20559, ITEM_EY_MARK_OF_HONOR = 29024 }; - enum BattleGroundMarksCount { ITEM_WINNER_COUNT = 3, ITEM_LOSER_COUNT = 1 }; - enum BattleGroundCreatures { BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde }; - enum BattleGroundSpells { SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect @@ -93,7 +83,6 @@ enum BattleGroundSpells SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag SPELL_AURA_PLAYER_INACTIVE = 43681 // Inactive }; - enum BattleGroundTimeIntervals { RESURRECTION_INTERVAL = 30000, // ms @@ -106,7 +95,6 @@ enum BattleGroundTimeIntervals RESPAWN_IMMEDIATELY = 0, // secs BUFF_RESPAWN_TIME = 180, // secs }; - enum BattleGroundStartTimeIntervals { BG_START_DELAY_2M = 120000, // ms (2 minutes) @@ -115,16 +103,13 @@ enum BattleGroundStartTimeIntervals BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena BG_START_DELAY_NONE = 0, // ms }; - enum BattleGroundBuffObjects { BG_OBJECTID_SPEEDBUFF_ENTRY = 179871, BG_OBJECTID_REGENBUFF_ENTRY = 179904, BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905 }; - const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY }; - enum BattleGroundStatus { STATUS_NONE = 0, // first status, should mean bg is not instance @@ -133,22 +118,18 @@ enum BattleGroundStatus STATUS_IN_PROGRESS = 3, // means bg is running STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending }; - struct BattleGroundPlayer { time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes uint32 Team; // Player's team }; - struct BattleGroundObjectInfo { BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {} - GameObject *object; int32 timer; uint32 spellid; }; - // handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time enum BattleGroundQueueTypeId { @@ -163,7 +144,6 @@ enum BattleGroundQueueTypeId BATTLEGROUND_QUEUE_5v5 = 8 }; #define MAX_BATTLEGROUND_QUEUE_TYPES 9 - enum BGQueueIdBasedOnLevel // queue_id for level ranges { QUEUE_ID_MAX_LEVEL_19 = 0, @@ -176,7 +156,6 @@ enum BGQueueIdBasedOnLevel // queue_id for level ranges QUEUE_ID_MAX_LEVEL_80 = 7 }; #define MAX_BATTLEGROUND_QUEUES 8 - enum ScoreType { SCORE_KILLING_BLOWS = 1, @@ -202,34 +181,29 @@ enum ScoreType SCORE_SECONDARY_OBJECTIVES = 17 // TODO : implement them }; - enum ArenaType { ARENA_TYPE_2v2 = 2, ARENA_TYPE_3v3 = 3, ARENA_TYPE_5v5 = 5 }; - enum BattleGroundType { TYPE_BATTLEGROUND = 3, TYPE_ARENA = 4 }; - enum BattleGroundWinner { WINNER_HORDE = 0, WINNER_ALLIANCE = 1, WINNER_NONE = 2 }; - enum BattleGroundTeamId { BG_TEAM_ALLIANCE = 0, BG_TEAM_HORDE = 1 }; #define BG_TEAMS_COUNT 2 - enum BattleGroundStartingEvents { BG_STARTING_EVENT_NONE = 0x00, @@ -238,7 +212,6 @@ enum BattleGroundStartingEvents BG_STARTING_EVENT_3 = 0x04, BG_STARTING_EVENT_4 = 0x08 }; - enum BattleGroundStartingEventsIds { BG_STARTING_EVENT_FIRST = 0, @@ -247,7 +220,6 @@ enum BattleGroundStartingEventsIds BG_STARTING_EVENT_FOURTH = 3 }; #define BG_STARTING_EVENT_COUNT 4 - enum BattleGroundJoinError { BG_JOIN_ERR_OK = 0, @@ -261,7 +233,6 @@ enum BattleGroundJoinError BG_JOIN_ERR_ALL_QUEUES_USED = 8, BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9 }; - class BattleGroundScore { public: @@ -269,7 +240,6 @@ class BattleGroundScore BonusHonor(0), DamageDone(0), HealingDone(0) {} virtual ~BattleGroundScore() {} //virtual destructor is used when deleting score from scores map - uint32 KillingBlows; uint32 Deaths; uint32 HonorableKills; @@ -277,14 +247,12 @@ class BattleGroundScore uint32 DamageDone; uint32 HealingDone; }; - enum BGHonorMode { BG_NORMAL = 0, BG_HOLIDAY, BG_HONOR_MODE_NUM }; - /* This class is used to: 1. Add player to battleground @@ -295,7 +263,6 @@ This class is used to: class BattleGround { friend class BattleGroundMgr; - public: /* Construction */ BattleGround(); @@ -312,11 +279,9 @@ class BattleGround virtual void ResetBGSubclass() // must be implemented in BG subclass { } - /* achievement req. */ virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; } bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const; - /* Battleground */ // Get methods: char const* GetName() const { return m_Name; } @@ -330,19 +295,15 @@ class BattleGround uint32 GetLastResurrectTime() const { return m_LastResurrectTime; } uint32 GetMaxPlayers() const { return m_MaxPlayers; } uint32 GetMinPlayers() const { return m_MinPlayers; } - uint32 GetMinLevel() const { return m_LevelMin; } uint32 GetMaxLevel() const { return m_LevelMax; } - uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; } uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; } - int32 GetStartDelayTime() const { return m_StartDelayTime; } uint8 GetArenaType() const { return m_ArenaType; } uint8 GetWinner() const { return m_Winner; } uint32 GetBattlemasterEntry() const; uint32 GetBonusHonorFromKill(uint32 kills) const; - // Set methods: void SetName(char const* Name) { m_Name = Name; } void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; } @@ -366,16 +327,12 @@ class BattleGround void SetArenaType(uint8 type) { m_ArenaType = type; } void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; } void SetWinner(uint8 winner) { m_Winner = winner; } - void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; } void SetStartDelayTime(int Time) { m_StartDelayTime = Time; } - void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; } void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; } - void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available - void DecreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; } void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; } uint32 GetInvitedCount(uint32 team) const @@ -387,33 +344,25 @@ class BattleGround } bool HasFreeSlots() const; uint32 GetFreeSlotsForTeam(uint32 Team) const; - bool isArena() const { return m_IsArena; } bool isBattleGround() const { return !m_IsArena; } bool isRated() const { return m_IsRated; } - typedef std::map BattleGroundPlayerMap; BattleGroundPlayerMap const& GetPlayers() const { return m_Players; } uint32 GetPlayersSize() const { return m_Players.size(); } - typedef std::map BattleGroundScoreMap; BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } - uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } - void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); void RemovePlayerFromResurrectQueue(uint64 player_guid); - void StartBattleGround(); - GameObject* GetBGObject(uint32 type); Creature* GetBGCreature(uint32 type); /* Location */ void SetMapId(uint32 MapID) { m_MapId = MapID; } uint32 GetMapId() const { return m_MapId; } - void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O); void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const { @@ -423,17 +372,14 @@ class BattleGround Z = m_TeamStartLocZ[idx]; O = m_TeamStartLocO[idx]; } - /* Packet Transfer */ // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} void SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender = NULL, bool self = true); void SendPacketToAll(WorldPacket *packet); void YellToAll(Creature* creature, const char* text, uint32 language); - template void BroadcastWorker(Do& _do); - void PlaySoundToTeam(uint32 SoundID, uint32 TeamID); void PlaySoundToAll(uint32 SoundID); void CastSpellOnTeam(uint32 SpellID, uint32 TeamID); @@ -448,19 +394,14 @@ class BattleGround void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source); void EndBattleGround(uint32 winner); void BlockMovement(Player *plr); - void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... ); - // specialized version with 2 string id args void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); - /* Raid Group */ Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } void SetBgRaid(uint32 TeamID, Group *bg_raid); - virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; } uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases @@ -471,41 +412,32 @@ class BattleGround else ++m_PlayersCount[GetTeamIndexByTeamId(Team)]; } - // used for rated arena battles void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; } uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; } void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; } int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; } void CheckArenaWinConditions(); - /* Triggers handle */ // must be implemented in BG subclass virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {} // must be implemented in BG subclass if need AND call base class generic code virtual void HandleKillPlayer(Player *player, Player *killer); virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/); - /* Battleground events */ virtual void EventPlayerDroppedFlag(Player* /*player*/) {} virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {} virtual void EventPlayerCapturedFlag(Player* /*player*/) {} void EventPlayerLoggedIn(Player* player, uint64 plr_guid); void EventPlayerLoggedOut(Player* player); - /* Death related */ virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - virtual void AddPlayer(Player *plr); // must be implemented in BG subclass - void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team); - virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); // can be extended in in BG subclass - void HandleTriggerBuff(uint64 const& go_guid); void SetHoliday(bool is_holiday); - // TODO: make this protected: typedef std::vector BGObjects; typedef std::vector BGCreatures; @@ -519,40 +451,30 @@ class BattleGround bool DelObject(uint32 type); bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team); int32 GetObjectType(uint64 guid); - void DoorOpen(uint32 type); void DoorClose(uint32 type); //to be removed const char *GetTrinityString(int32 entry); - virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; } - // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player uint32 GetPlayerTeam(uint64 guid); uint32 GetOtherTeam(uint32 teamId); bool IsPlayerInBattleGround(uint64 guid); - void SetDeleteThis() {m_SetDeleteThis = true;} - /* virtual score-array - get's used in bg-subclasses */ int32 m_TeamScores[BG_TEAMS_COUNT]; - protected: //this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends BattleGround void EndNow(); void PlayerAddedToBGCheckIfBGIsRunning(Player* plr); - /* Scorekeeping */ - BattleGroundScoreMap m_PlayerScores; // Player scores // must be implemented in BG subclass virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {} - /* Player lists, those need to be accessible by inherited classes */ BattleGroundPlayerMap m_Players; // Spirit Guide guid + Player list GUIDS std::map > m_ReviveQueue; - /* these are important variables used for starting messages */ @@ -560,9 +482,7 @@ class BattleGround BattleGroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]; //this must be filled in constructors! uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]; - bool m_BuffChange; - BGHonorMode m_HonorMode; private: /* Battleground */ @@ -584,28 +504,21 @@ class BattleGround bool m_PrematureCountDown; uint32 m_PrematureCountDownTimer; char const *m_Name; - /* Player lists */ std::vector m_ResurrectQueue; // Player GUID std::deque m_OfflineQueue; // Player GUID - /* Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction */ /* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */ /* Invited players counters*/ uint32 m_InvitedAlliance; uint32 m_InvitedHorde; - /* Raid Group */ Group *m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde - /* Players count by team */ uint32 m_PlayersCount[BG_TEAMS_COUNT]; - /* Arena team ids by team */ uint32 m_ArenaTeamIds[BG_TEAMS_COUNT]; - int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT]; - /* Limits */ uint32 m_LevelMin; uint32 m_LevelMax; @@ -613,7 +526,6 @@ class BattleGround uint32 m_MaxPlayers; uint32 m_MinPlayersPerTeam; uint32 m_MinPlayers; - /* Start location */ uint32 m_MapId; float m_TeamStartLocX[BG_TEAMS_COUNT]; diff --git a/src/game/BattleGroundAA.cpp b/src/game/BattleGroundAA.cpp index 6133508ece1..4122325cd66 100644 --- a/src/game/BattleGroundAA.cpp +++ b/src/game/BattleGroundAA.cpp @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundAA.h" #include "Language.h" #include "Player.h" - BattleGroundAA::BattleGroundAA() { - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -36,47 +33,36 @@ BattleGroundAA::BattleGroundAA() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundAA::~BattleGroundAA() { - } - void BattleGroundAA::Update(uint32 diff) { BattleGround::Update(diff); } - void BattleGroundAA::StartingEventCloseDoors() { } - void BattleGroundAA::StartingEventOpenDoors() { } - void BattleGroundAA::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundAAScore* sc = new BattleGroundAAScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) { } - void BattleGroundAA::HandleKillPlayer(Player* player, Player* killer) { BattleGround::HandleKillPlayer(player, killer); } - void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) { } - bool BattleGroundAA::SetupBattleGround() { return true; diff --git a/src/game/BattleGroundAA.h b/src/game/BattleGroundAA.h index 06793ea38e0..241a1ba73c1 100644 --- a/src/game/BattleGroundAA.h +++ b/src/game/BattleGroundAA.h @@ -19,9 +19,7 @@ */ #ifndef __BATTLEGROUNDAA_H #define __BATTLEGROUNDAA_H - class BattleGround; - class BattleGroundAAScore : public BattleGroundScore { public: @@ -29,21 +27,17 @@ class BattleGroundAAScore : public BattleGroundScore virtual ~BattleGroundAAScore() {}; //TODO fix me }; - class BattleGroundAA : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundAA(); ~BattleGroundAA(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 6609c3400be..16eda4b9e94 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "World.h" #include "WorldPacket.h" #include "ObjectMgr.h" @@ -29,42 +28,34 @@ #include "Object.h" #include "Player.h" #include "Util.h" - // these variables aren't used outside of this file, so declare them only here uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = { 330, // normal honor 200 // holiday }; - uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = { 200, // normal honor 150 // holiday }; - BattleGroundAB::BattleGroundAB() { m_BuffChange = true; m_BgObjects.resize(BG_AB_OBJECT_MAX); m_BgCreatures.resize(BG_AB_ALL_NODES_COUNT); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; } - BattleGroundAB::~BattleGroundAB() { } - void BattleGroundAB::Update(uint32 diff) { BattleGround::Update(diff); - if (GetStatus() == STATUS_IN_PROGRESS) { int team_points[BG_TEAMS_COUNT] = { 0, 0 }; - for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) { // 3 sec delay to spawn new banner instead previous despawned one @@ -78,7 +69,6 @@ void BattleGroundAB::Update(uint32 diff) _CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false); } } - // 1-minute to occupy a node from contested state if (m_NodeTimers[node]) { @@ -98,7 +88,6 @@ void BattleGroundAB::Update(uint32 diff) _SendNodeUpdate(node); _NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE); // Message to chatlog - if (teamIndex == 0) { // FIXME: team and node names not localized @@ -113,12 +102,10 @@ void BattleGroundAB::Update(uint32 diff) } } } - for (int team = 0; team < BG_TEAMS_COUNT; ++team) if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED) ++team_points[team]; } - // Accumulate points for (int team = 0; team < BG_TEAMS_COUNT; ++team) { @@ -151,7 +138,6 @@ void BattleGroundAB::Update(uint32 diff) PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); m_IsInformedNearVictory = true; } - if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE) m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE; if (team == BG_TEAM_ALLIANCE) @@ -165,7 +151,6 @@ void BattleGroundAB::Update(uint32 diff) m_TeamScores500Disadvantage[otherTeam] = true; } } - // Test win condition if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE) EndBattleGround(ALLIANCE); @@ -173,7 +158,6 @@ void BattleGroundAB::Update(uint32 diff) EndBattleGround(HORDE); } } - void BattleGroundAB::StartingEventCloseDoors() { // despawn banners, auras and buffs @@ -181,18 +165,15 @@ void BattleGroundAB::StartingEventCloseDoors() SpawnBGObject(obj, RESPAWN_ONE_DAY); for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT * 3; ++i) SpawnBGObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + i, RESPAWN_ONE_DAY); - // Starting doors DoorClose(BG_AB_OBJECT_GATE_A); DoorClose(BG_AB_OBJECT_GATE_H); SpawnBGObject(BG_AB_OBJECT_GATE_A, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_AB_OBJECT_GATE_H, RESPAWN_IMMEDIATELY); - // Starting base spirit guides _NodeOccupied(BG_AB_SPIRIT_ALIANCE,ALLIANCE); _NodeOccupied(BG_AB_SPIRIT_HORDE,HORDE); } - void BattleGroundAB::StartingEventOpenDoors() { // spawn neutral banners @@ -207,26 +188,20 @@ void BattleGroundAB::StartingEventOpenDoors() DoorOpen(BG_AB_OBJECT_GATE_A); DoorOpen(BG_AB_OBJECT_GATE_H); } - void BattleGroundAB::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in the constructor BattleGroundABScore* sc = new BattleGroundABScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) { - } - void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; - switch(Trigger) { case 3948: // Arathi Basin Alliance Exit. @@ -255,7 +230,6 @@ void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger) break; } } - /* type: 0-neutral, 1-contested, 3-occupied teamIndex: 0-ally, 1-horde */ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay) @@ -268,30 +242,24 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool m_BannerTimers[node].teamIndex = teamIndex; return; } - uint8 obj = node*8 + type + teamIndex; - SpawnBGObject(obj, RESPAWN_IMMEDIATELY); - // handle aura with banner if (!type) return; obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7); SpawnBGObject(obj, RESPAWN_IMMEDIATELY); } - void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) { uint8 obj = node*8 + type + teamIndex; SpawnBGObject(obj, RESPAWN_ONE_DAY); - // handle aura with banner if (!type) return; obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7); SpawnBGObject(obj, RESPAWN_ONE_DAY); } - int32 BattleGroundAB::_GetNodeNameId(uint8 node) { switch (node) @@ -306,20 +274,16 @@ int32 BattleGroundAB::_GetNodeNameId(uint8 node) } return 0; } - void BattleGroundAB::FillInitialWorldStates(WorldPacket& data) { const uint8 plusArray[] = {0, 2, 3, 0, 1}; - // Node icons for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) data << uint32(BG_AB_OP_NODEICONS[node]) << uint32((m_Nodes[node]==0)?1:0); - // Node occupied states for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) data << uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]) << uint32((m_Nodes[node]==i)?1:0); - // How many bases each team owns uint8 ally = 0, horde = 0; for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) @@ -327,32 +291,25 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data) ++ally; else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) ++horde; - data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally); data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(horde); - // Team scores data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE); data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]); data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]); - // other unknown data << uint32(0x745) << uint32(0x2); // 37 1861 unk } - void BattleGroundAB::_SendNodeUpdate(uint8 node) { // Send node owner state update to refresh map icons on client const uint8 plusArray[] = {0, 2, 3, 0, 1}; - if (m_prevNodes[node]) UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0); else UpdateWorldState(BG_AB_OP_NODEICONS[node], 0); - UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1); - // How many bases each team owns uint8 ally = 0, horde = 0; for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) @@ -360,17 +317,14 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node) ++ally; else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) ++horde; - UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally); UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde); } - void BattleGroundAB::_NodeOccupied(uint8 node,Team team) { if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team)) sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team); // SpawnBGCreature(node,RESPAWN_IMMEDIATELY); - uint8 capturedNodes = 0; for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { @@ -382,12 +336,10 @@ void BattleGroundAB::_NodeOccupied(uint8 node,Team team) if (capturedNodes >= 4) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); } - void BattleGroundAB::_NodeDeOccupied(uint8 node) { if (node >= BG_AB_DYNAMIC_NODES_COUNT) return; - // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard std::vector ghost_list = m_ReviveQueue[m_BgCreatures[node]]; if (!ghost_list.empty()) @@ -398,27 +350,21 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node) Player* plr = objmgr.GetPlayer(*itr); if (!plr) continue; - if (!ClosestGrave) // cache ClosestGrave = GetClosestGraveYard(plr); - if (ClosestGrave) plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); } } - if (m_BgCreatures[node]) DelCreature(node); - // buff object isn't despawned } - /* Invoked if a player used a banner as a gameobject */ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; - uint8 node = BG_AB_NODE_STABLES; GameObject* obj=HashMapHolder::Find(m_BgObjects[node*8+7]); while ( (node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) @@ -426,19 +372,15 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ ++node; obj=HashMapHolder::Find(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); } - if (node == BG_AB_DYNAMIC_NODES_COUNT) { // this means our player isn't close to any of banners - maybe cheater ?? return; } - BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam()); - // Check if player really could use this banner, not cheated if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2)) return; - source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // If node is neutral, change to contested @@ -453,13 +395,11 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: team and node names not localized if (teamIndex == 0) SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); else SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); - sound = BG_AB_SOUND_NODE_CLAIMED; } // If node is contested @@ -477,7 +417,6 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); @@ -497,7 +436,6 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node,(teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE); - // FIXME: node names not localized if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); @@ -519,16 +457,13 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); - sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } - // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { @@ -540,7 +475,6 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ } PlaySoundToAll(sound); } - bool BattleGroundAB::SetupBattleGround() { for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) @@ -575,15 +509,12 @@ bool BattleGroundAB::SetupBattleGround() ) sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!"); } - return true; } - void BattleGroundAB::Reset() { //call parent's class reset BattleGround::Reset(); - m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; m_lastTick[BG_TEAM_ALLIANCE] = 0; @@ -598,7 +529,6 @@ void BattleGroundAB::Reset() m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks; m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false; m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false; - for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { m_Nodes[i] = 0; @@ -606,12 +536,10 @@ void BattleGroundAB::Reset() m_NodeTimers[i] = 0; m_BannerTimers[i].timer = 0; } - for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT; ++i) if (m_BgCreatures[i]) DelCreature(i); } - void BattleGroundAB::EndBattleGround(uint32 winner) { //win reward @@ -622,27 +550,22 @@ void BattleGroundAB::EndBattleGround(uint32 winner) //complete map_end rewards (even if no team wins) RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); - BattleGround::EndBattleGround(winner); } - WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) { BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam()); - // Is there any occupied node for this team? std::vector nodes; for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) if (m_Nodes[i] == teamIndex + 3) nodes.push_back(i); - WorldSafeLocsEntry const* good_entry = NULL; // If so, select the closest node to place ghost on if (!nodes.empty()) { float plr_x = player->GetPositionX(); float plr_y = player->GetPositionY(); - float mindist = 999999.0f; for (uint8 i = 0; i < nodes.size(); ++i) { @@ -661,16 +584,13 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) // If not, place ghost on starting location if (!good_entry) good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] ); - return good_entry; } - void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if( itr == m_PlayerScores.end() ) // player not found... return; - switch(type) { case SCORE_BASES_ASSAULTED: @@ -684,7 +604,6 @@ void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value break; } } - bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const { uint32 count = 0; @@ -692,6 +611,5 @@ bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) || (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)) ++count; - return count == BG_AB_DYNAMIC_NODES_COUNT; } diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index ef151ad187b..7da1c517528 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -19,9 +19,7 @@ */ #ifndef __BATTLEGROUNDAB_H #define __BATTLEGROUNDAB_H - class BattleGround; - enum BG_AB_WorldStates { BG_AB_OP_OCCUPIED_BASES_HORDE = 1778, @@ -41,7 +39,6 @@ enum BG_AB_WorldStates BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE) BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE) BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE) - BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE) BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE) BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE) @@ -59,11 +56,8 @@ enum BG_AB_WorldStates BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE) */ }; - const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787}; - const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843}; - /* Note: code uses that these IDs follow each other */ enum BG_AB_NodeObjectId { @@ -73,7 +67,6 @@ enum BG_AB_NodeObjectId BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner BG_AB_OBJECTID_NODE_BANNER_4 = 180091 // Gold mine banner }; - enum BG_AB_ObjectType { // for all 5 node points 8*5=40 objects @@ -106,7 +99,6 @@ enum BG_AB_ObjectType BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE = 56, BG_AB_OBJECT_MAX = 57, }; - /* Object id templates from DB */ enum BG_AB_ObjectTypes { @@ -114,26 +106,21 @@ enum BG_AB_ObjectTypes BG_AB_OBJECTID_BANNER_CONT_A = 180059, BG_AB_OBJECTID_BANNER_H = 180060, BG_AB_OBJECTID_BANNER_CONT_H = 180061, - BG_AB_OBJECTID_AURA_A = 180100, BG_AB_OBJECTID_AURA_H = 180101, BG_AB_OBJECTID_AURA_C = 180102, - BG_AB_OBJECTID_GATE_A = 180255, BG_AB_OBJECTID_GATE_H = 180256 }; - enum BG_AB_Timers { BG_AB_FLAG_CAPTURING_TIME = 60000, }; - enum BG_AB_Score { BG_AB_WARNING_NEAR_VICTORY_SCORE = 1800, BG_AB_MAX_TEAM_SCORE = 2000 }; - /* do NOT change the order, else wrong behaviour */ enum BG_AB_BattleGroundNodes { @@ -142,15 +129,11 @@ enum BG_AB_BattleGroundNodes BG_AB_NODE_FARM = 2, BG_AB_NODE_LUMBER_MILL = 3, BG_AB_NODE_GOLD_MINE = 4, - BG_AB_DYNAMIC_NODES_COUNT = 5, // dynamic nodes that can be captured - BG_AB_SPIRIT_ALIANCE = 5, BG_AB_SPIRIT_HORDE = 6, - BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static) }; - enum BG_AB_NodeStatus { BG_AB_NODE_TYPE_NEUTRAL = 0, @@ -161,7 +144,6 @@ enum BG_AB_NodeStatus BG_AB_NODE_STATUS_ALLY_OCCUPIED = 3, BG_AB_NODE_STATUS_HORDE_OCCUPIED = 4 }; - enum BG_AB_Sounds { BG_AB_SOUND_NODE_CLAIMED = 8192, @@ -171,12 +153,10 @@ enum BG_AB_Sounds BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8174, BG_AB_SOUND_NEAR_VICTORY = 8456 }; - #define BG_AB_NotABBGWeekendHonorTicks 330 #define BG_AB_ABBGWeekendHonorTicks 200 #define BG_AB_NotABBGWeekendReputationTicks 200 #define BG_AB_ABBGWeekendReputationTicks 150 - // x, y, z, o const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { {1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables @@ -185,20 +165,16 @@ const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { {856.1419f, 1148.902f, 11.18469f, -2.303835f}, // lumber mill {1146.923f, 848.1782f, -110.917f, -0.7330382f} // gold mine }; - // x, y, z, o, rot0, rot1, rot2, rot3 const float BG_AB_DoorPositions[2][8] = { {1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f}, {708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f} }; - // Tick intervals and given points: case 0,1,2,3,4,5 captured nodes const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000}; const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30}; - // WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899}; - // x, y, z, o const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { {1185.71f, 1185.24f, -56.36f, 2.56f}, // stables @@ -207,7 +183,6 @@ const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { {807.46f, 1189.16f, 11.92f, 5.44f}, // lumber mill {1146.62f, 816.94f, -98.49f, 6.14f} // gold mine }; - // x, y, z, o const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = { {1200.03f, 1171.09f, -56.47f, 5.15f}, // stables @@ -218,14 +193,12 @@ const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = { {1354.05f, 1275.48f, -11.30f, 4.77f}, // alliance starting base {714.61f, 646.15f, -10.87f, 4.34f} // horde starting base }; - struct BG_AB_BannerTimer { uint32 timer; uint8 type; uint8 teamIndex; }; - class BattleGroundABScore : public BattleGroundScore { public: @@ -234,15 +207,12 @@ class BattleGroundABScore : public BattleGroundScore uint32 BasesAssaulted; uint32 BasesDefended; }; - class BattleGroundAB : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundAB(); ~BattleGroundAB(); - void Update(uint32 diff); void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); @@ -253,15 +223,11 @@ class BattleGroundAB : public BattleGround virtual void Reset(); void EndBattleGround(uint32 winner); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - /* Scorekeeping */ virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - virtual void FillInitialWorldStates(WorldPacket& data); - /* Nodes occupying */ virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); - /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; } @@ -270,14 +236,11 @@ class BattleGroundAB : public BattleGround void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay); void _DelBanner(uint8 node, uint8 type, uint8 teamIndex); void _SendNodeUpdate(uint8 node); - /* Creature spawning/despawning */ // TODO: working, scripted peons spawning void _NodeOccupied(uint8 node,Team team); void _NodeDeOccupied(uint8 node); - int32 _GetNodeNameId(uint8 node); - /* Nodes info: 0: neutral 1: ally contested diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 42d15a6ce84..4db2f4b3df2 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "ObjectMgr.h" #include "WorldPacket.h" - #include "BattleGround.h" #include "BattleGroundAV.h" #include "Formulas.h" @@ -28,36 +26,29 @@ #include "Language.h" #include "Player.h" #include "SpellAuras.h" - BattleGroundAV::BattleGroundAV() { m_BgObjects.resize(BG_AV_OBJECT_MAX); m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; } - BattleGroundAV::~BattleGroundAV() { } - const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this function to Battleground.cpp (needs to find a way to get m_MaxLevel) { return Trinity::Honor::hk_honor_at_level(m_MaxLevel, kills); } - void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer) { if(GetStatus() != STATUS_IN_PROGRESS) return; - BattleGround::HandleKillPlayer(player, killer); UpdateScore(player->GetTeam(),-1); } - void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) { sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry()); @@ -95,7 +86,6 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if(creature) YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL); - } else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0] ) { @@ -120,7 +110,6 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) else if ( entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4][0]) ChangeMineOwner(AV_SOUTH_MINE,killer->GetTeam()); } - void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) { if (GetStatus() != STATUS_IN_PROGRESS) @@ -224,13 +213,11 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) } } - void BattleGroundAV::UpdateScore(uint16 team, int16 points ) { //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive assert( team == ALLIANCE || team == HORDE); uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde m_Team_Scores[teamindex] += points; - UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]); if( points < 0) { @@ -247,7 +234,6 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points ) } } } - Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type ) { uint32 level; @@ -271,7 +257,6 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type ) return NULL; if(creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) creature->SetRespawnDelay(RESPAWN_ONE_DAY); // TODO: look if this can be done by database + also add this for the wingcommanders - if((isStatic && cinfoid>=10 && cinfoid<=14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3) || (cinfoid>=AV_NPC_H_GRAVEDEFENSE0 && cinfoid<=AV_NPC_H_GRAVEDEFENSE3)))) { @@ -289,17 +274,14 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type ) //TODO: find a way to add a motionmaster without killing the creature (i //just copied this code from a gm-command } - if(level != 0) level += m_MaxLevel-60; //maybe we can do this more generic for custom level-range.. actually it's blizzlike creature->SetLevel(level); return creature; } - void BattleGroundAV::Update(uint32 diff) { BattleGround::Update(diff); - if(GetStatus() == STATUS_IN_PROGRESS) { for(uint8 i=0; i<=1;i++)//0=alliance, 1=horde @@ -335,7 +317,6 @@ void BattleGroundAV::Update(uint32 diff) { if( m_Mine_Timer <= 0) UpdateScore(m_Mine_Owner[mine],1); - if(m_Mine_Reclaim_Timer[mine] > diff) m_Mine_Reclaim_Timer[mine] -= diff; else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0 @@ -345,7 +326,6 @@ void BattleGroundAV::Update(uint32 diff) } if( m_Mine_Timer <= 0) m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines - //looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) if(m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this @@ -357,13 +337,11 @@ void BattleGroundAV::Update(uint32 diff) } } } - void BattleGroundAV::StartingEventCloseDoors() { DoorClose(BG_AV_OBJECT_DOOR_A); DoorClose(BG_AV_OBJECT_DOOR_H); } - void BattleGroundAV::StartingEventOpenDoors() { sLog.outDebug("BG_AV: start spawning mine stuff"); @@ -373,14 +351,11 @@ void BattleGroundAV::StartingEventOpenDoors() SpawnBGObject(i,RESPAWN_IMMEDIATELY); for(uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population ChangeMineOwner(mine, AV_NEUTRAL_TEAM,true); - UpdateWorldState(AV_SHOW_H_SCORE, 1); UpdateWorldState(AV_SHOW_A_SCORE, 1); - DoorOpen(BG_AV_OBJECT_DOOR_H); DoorOpen(BG_AV_OBJECT_DOOR_A); } - void BattleGroundAV::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); @@ -389,9 +364,7 @@ void BattleGroundAV::AddPlayer(Player *plr) m_PlayerScores[plr->GetGUID()] = sc; if(m_MaxLevel==0) m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information.. - } - void BattleGroundAV::EndBattleGround(uint32 winner) { //calculate bonuskills for both teams: @@ -414,7 +387,6 @@ void BattleGroundAV::EndBattleGround(uint32 winner) } } } - for(int i=0; i<=1; i++) //0=ally 1=horde { if(m_CaptainAlive[i]) @@ -427,11 +399,9 @@ void BattleGroundAV::EndBattleGround(uint32 winner) if(kills[i] != 0) RewardHonorToTeam(GetBonusHonor(kills[i]),(i == 0)?ALLIANCE:HORDE); } - //TODO add enterevademode for all attacking creatures BattleGround::EndBattleGround(winner); } - void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/) { if(!plr) @@ -445,13 +415,11 @@ void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/) plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN); } - void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) return; - uint32 SpellId = 0; switch(Trigger) { @@ -481,18 +449,14 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) // Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } - if (SpellId) Source->CastSpell(Source, SpellId, true); } - void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found... return; - switch(type) { case SCORE_GRAVEYARDS_ASSAULTED: @@ -522,19 +486,14 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value } } - - void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { - uint32 object = GetObjectThroughNode(node); sLog.outDebug("bg_av: player destroyed point node %i object %i",node,object); - //despawn banner SpawnBGObject(object, RESPAWN_ONE_DAY); DestroyNode(node); UpdateNodeWorldState(node); - uint32 owner = m_Nodes[node].Owner; if( IsTower(node) ) { @@ -547,11 +506,9 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) //spawn destroyed aura for(uint8 i=0; i<=9; i++) SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10),RESPAWN_IMMEDIATELY); - UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER); RewardReputationToTeam((owner == ALLIANCE)?730:729,BG_AV_REP_TOWER,owner); RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER),owner); - SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY); SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY); } @@ -579,12 +536,10 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE) ); else sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE) ); - Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if(creature) YellToAll(creature,buf,LANG_UNIVERSAL); } - void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) { //mine=0 northmine mine=1 southmin //changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them @@ -593,12 +548,10 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) team = AV_NEUTRAL_TEAM; else PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD); - if(m_Mine_Owner[mine] == team && !initial) return; m_Mine_PrevOwner[mine] = m_Mine_Owner[mine]; m_Mine_Owner[mine] = team; - if(!initial) { sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine); @@ -611,7 +564,6 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) DelCreature(i); //TODO here also } SendMineWorldStates(mine); - sLog.outDebug("bg_av populating mine %i (0=north,1=south)",mine); uint16 miner; //also neutral team exists.. after a big time, the neutral team tries to conquer the mine @@ -674,7 +626,6 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) } return; } - bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team) { if(GOId == BG_AV_OBJECTID_MINE_N) @@ -683,12 +634,10 @@ bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team) return (m_Mine_Owner[AV_SOUTH_MINE]==team); return true; //cause it's no mine'object it is ok if this is true } - void BattleGroundAV::PopulateNode(BG_AV_Nodes node) { uint32 owner = m_Nodes[node].Owner; assert(owner); - uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); uint32 creatureid; if(IsTower(node)) @@ -709,7 +658,6 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node) DelCreature(node); if( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) sLog.outError("AV: couldn't spawn spiritguide at node %i",node); - } for(uint8 i=0; i<4; i++) { @@ -727,7 +675,6 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node) DelCreature(node); } - const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) { sLog.outDebug("bg_AV getnodethroughobject %i",object); @@ -749,7 +696,6 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) assert(false); return BG_AV_Nodes(0); } - const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node) { //this function is the counterpart to GetNodeThroughObject() sLog.outDebug("bg_AV GetObjectThroughNode %i",node); @@ -786,9 +732,7 @@ const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node) return 0; } - //called when using banner - void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj) { if(GetStatus() != STATUS_IN_PROGRESS) @@ -816,15 +760,12 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target break; } } - void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) { assert(GetStatus() == STATUS_IN_PROGRESS); BG_AV_Nodes node = GetNodeThroughObject(object); - uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner uint32 team = player->GetTeam(); - if(owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED) return; if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) @@ -840,13 +781,11 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) return; } - //spawn new go :) if(m_Nodes[node].Owner == ALLIANCE) SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner else SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner - if(!IsTower(node)) { SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY); @@ -854,11 +793,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) } // despawn old go SpawnBGObject(object, RESPAWN_ONE_DAY); - DefendNode(node,team); PopulateNode(node); UpdateNodeWorldState(node); - if(IsTower(node)) { //spawn big flag+aura on top of tower @@ -888,11 +825,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) else PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD); } - void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) { assert(GetStatus() == STATUS_IN_PROGRESS); - BG_AV_Nodes node = GetNodeThroughObject(object); uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner uint32 team = player->GetTeam(); @@ -900,7 +835,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) if(owner == team || team == m_Nodes[node].TotalOwner) return; //surely a gm used this object - if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff { if(object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping @@ -938,7 +872,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) SpawnBGObject(spawn+i,RESPAWN_IMMEDIATELY); } } - //if snowfall gots capped it can be handled like all other graveyards if( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM) { @@ -980,11 +913,9 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) } DePopulateNode(node); } - SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner AssaultNode(node,team); UpdateNodeWorldState(node); - //send a nice message to all :) char buf[256]; sprintf(buf, ( IsTower(node) ) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE )); @@ -995,7 +926,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS); } - void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) { bool stateok; @@ -1009,7 +939,6 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0); } } - //towers for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_MAX; i++) for (uint8 j =1; j <= 3; j+=2) @@ -1034,7 +963,6 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) SendMineWorldStates(AV_NORTH_MINE); SendMineWorldStates(AV_SOUTH_MINE); } - const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray { //neutral stuff cant get handled (currently its only snowfall) @@ -1057,7 +985,6 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i sLog.outError("BG_AV: should update a strange worldstate state:%i team:%i",state,team); return 5; //this will crash the game, but i want to know if something is wrong here } - void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node) { UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1); @@ -1066,14 +993,12 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node) else UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0); } - void BattleGroundAV::SendMineWorldStates(uint32 mine) { assert(mine == AV_NORTH_MINE || mine==AV_SOUTH_MINE); // currently i'm sure, that this works (: // assert(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM); // assert(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM); - uint8 owner,prevowner,mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array mine2 = (mine==AV_NORTH_MINE)?0:1; if(m_Mine_PrevOwner[mine] == ALLIANCE) @@ -1088,13 +1013,11 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine) owner = 2; else owner = 1; - UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1); if( prevowner != owner) UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0); } - WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) { WorldSafeLocsEntry const* good_entry = NULL; @@ -1120,11 +1043,9 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) // If not, place ghost on starting location if( !good_entry ) good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7] ); - return good_entry; } - bool BattleGroundAV::SetupBattleGround() { // Create starting objects @@ -1137,7 +1058,6 @@ bool BattleGroundAV::SetupBattleGround() sLog.outErrorDb("BatteGroundAV: Failed to spawn some object BattleGround not created!1"); return false; } - //spawn node-objects for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i) { @@ -1232,7 +1152,6 @@ bool BattleGroundAV::SetupBattleGround() return false; } } - if(!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) { sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8"); @@ -1249,7 +1168,6 @@ bool BattleGroundAV::SetupBattleGround() return false; } } - uint16 i; sLog.outDebug("Alterac Valley: entering state STATUS_WAIT_JOIN ..."); // Initial Nodes @@ -1280,7 +1198,6 @@ bool BattleGroundAV::SetupBattleGround() for(i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++) SpawnBGObject(i, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE,RESPAWN_IMMEDIATELY); - //creatures sLog.outDebug("BG_AV start poputlating nodes"); for(BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i ) @@ -1303,7 +1220,6 @@ bool BattleGroundAV::SetupBattleGround() AddAVCreature(AV_NPC_HERALD,AV_CPLACE_HERALD); return true; } - const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node) { switch (node) @@ -1331,7 +1247,6 @@ const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node) } } } - void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) { if (m_Nodes[node].TotalOwner == team) @@ -1361,18 +1276,15 @@ void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) m_Nodes[node].PrevState = m_Nodes[node].State; m_Nodes[node].State = POINT_ASSAULTED; } - void BattleGroundAV::DestroyNode(BG_AV_Nodes node) { assert(m_Nodes[node].State == POINT_ASSAULTED); - m_Nodes[node].TotalOwner = m_Nodes[node].Owner; m_Nodes[node].PrevOwner = m_Nodes[node].Owner; m_Nodes[node].PrevState = m_Nodes[node].State; m_Nodes[node].State = (m_Nodes[node].Tower)? POINT_DESTROYED : POINT_CONTROLED; m_Nodes[node].Timer = 0; } - void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower) { m_Nodes[node].TotalOwner = team; @@ -1384,7 +1296,6 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower) m_Nodes[node].Timer = 0; m_Nodes[node].Tower = tower; } - void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team) { assert(m_Nodes[node].TotalOwner == team); @@ -1396,7 +1307,6 @@ void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team) m_Nodes[node].State = POINT_CONTROLED; m_Nodes[node].Timer = 0; } - void BattleGroundAV::ResetBGSubclass() { m_MaxLevel=0; @@ -1420,12 +1330,9 @@ void BattleGroundAV::ResetBGSubclass() for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers InitNode(i,HORDE,true); InitNode(BG_AV_NODES_SNOWFALL_GRAVE,AV_NEUTRAL_TEAM,false); //give snowfall neutral owner - m_Mine_Timer=AV_MINE_TICK_TIMER; for(uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++) if(m_BgCreatures[i]) DelCreature(i); - } - diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h index 306c513ae95..7e5bd367b70 100644 --- a/src/game/BattleGroundAV.h +++ b/src/game/BattleGroundAV.h @@ -17,44 +17,32 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUNDAV_H #define __BATTLEGROUNDAV_H - class BattleGround; - #define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!" #define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!" #define LANG_BG_AV_S_MINE_BOSS_CLAIMS "Snivvle is here! Snivvle claims the Coldtooth Mine!" - #define BG_AV_CAPTIME 240000 //4:00 #define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05 - #define BG_AV_SCORE_INITIAL_POINTS 600 #define SEND_MSG_NEAR_LOSE 120 - #define BG_AV_KILL_BOSS 4 #define BG_AV_REP_BOSS 350 - #define BG_AV_KILL_CAPTAIN 3 #define BG_AV_REP_CAPTAIN 125 #define BG_AV_RES_CAPTAIN 100 - #define BG_AV_KILL_TOWER 3 #define BG_AV_REP_TOWER 12 #define BG_AV_RES_TOWER 75 - #define BG_AV_GET_COMMANDER 1 //for a safely returned wingcommander //bonushonor at the end #define BG_AV_KILL_SURVIVING_TOWER 2 #define BG_AV_REP_SURVIVING_TOWER 12 - #define BG_AV_KILL_SURVIVING_CAPTAIN 2 #define BG_AV_REP_SURVIVING_CAPTAIN 125 - enum BG_AV_Sounds { //TODO: get out if there comes a sound when neutral team captures mine - /* 8212: alliance grave assault @@ -62,7 +50,6 @@ enum BG_AV_Sounds drek "mlanzenabschaum! In meiner Burg?! Toetet sie all" - nicht immer der sound 8333: galv "sterbt fuer euch ist kein platz hier" - 8332: bal "Verschwinde, dreckiger Abschaum! Die Allianz wird im Alteractal " 8174: @@ -85,21 +72,16 @@ horde: mine capture horde wins */ - AV_SOUND_NEAR_VICTORY = 8456, //not confirmed yet - AV_SOUND_ALLIANCE_ASSAULTS = 8212, //tower,grave + enemy boss if someone tries to attack him AV_SOUND_HORDE_ASSAULTS = 8174, AV_SOUND_ALLIANCE_GOOD = 8173, //if something good happens for the team: wins(maybe only through killing the boss), captures mine or grave, destroys tower and defends grave AV_SOUND_HORDE_GOOD = 8213, AV_SOUND_BOTH_TOWER_DEFEND = 8192, - AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff) AV_SOUND_HORDE_CAPTAIN = 8333, - }; - enum BG_AV_OTHER_VALUES { AV_STATICCPLACE_MAX = 123, @@ -118,25 +100,21 @@ enum BG_AV_ObjectIds BG_AV_OBJECTID_BANNER_H = 178943, // can only be used by alliance BG_AV_OBJECTID_BANNER_CONT_A = 178940, // can only be used by horde BG_AV_OBJECTID_BANNER_CONT_H = 179435, // can only be used by alliance - BG_AV_OBJECTID_BANNER_A_B = 178365, BG_AV_OBJECTID_BANNER_H_B = 178364, BG_AV_OBJECTID_BANNER_CONT_A_B = 179286, BG_AV_OBJECTID_BANNER_CONT_H_B = 179287, BG_AV_OBJECTID_BANNER_SNOWFALL_N = 180418, - //snowfall eyecandy banner: BG_AV_OBJECTID_SNOWFALL_CANDY_A = 179044, BG_AV_OBJECTID_SNOWFALL_CANDY_PA = 179424, BG_AV_OBJECTID_SNOWFALL_CANDY_H = 179064, BG_AV_OBJECTID_SNOWFALL_CANDY_PH = 179425, - //banners on top of towers: BG_AV_OBJECTID_TOWER_BANNER_A = 178927, //[PH] Alliance A1 Tower Banner BIG BG_AV_OBJECTID_TOWER_BANNER_H = 178955, //[PH] Horde H1 Tower Banner BIG BG_AV_OBJECTID_TOWER_BANNER_PA = 179446, //[PH] Alliance H1 Tower Pre-Banner BIG BG_AV_OBJECTID_TOWER_BANNER_PH = 179436, //[PH] Horde A1 Tower Pre-Banner BIG - //Auras BG_AV_OBJECTID_AURA_A = 180421, BG_AV_OBJECTID_AURA_H = 180422, @@ -144,18 +122,14 @@ enum BG_AV_ObjectIds BG_AV_OBJECTID_AURA_A_S = 180100, BG_AV_OBJECTID_AURA_H_S = 180101, BG_AV_OBJECTID_AURA_N_S = 180102, - BG_AV_OBJECTID_GATE_A = 180424, BG_AV_OBJECTID_GATE_H = 180424, - //mine supplies BG_AV_OBJECTID_MINE_N = 178785, BG_AV_OBJECTID_MINE_S = 178784, - BG_AV_OBJECTID_FIRE = 179065, BG_AV_OBJECTID_SMOKE = 179066 }; - enum BG_AV_Nodes { BG_AV_NODES_FIRSTAID_STATION = 0, @@ -173,10 +147,8 @@ enum BG_AV_Nodes BG_AV_NODES_TOWER_POINT = 12, BG_AV_NODES_FROSTWOLF_ETOWER = 13, BG_AV_NODES_FROSTWOLF_WTOWER = 14, - BG_AV_NODES_MAX = 15 }; - enum BG_AV_ObjectTypes { BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION = 0, @@ -190,7 +162,6 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_FLAG_A_DUNBALDAR_NORTH = 8, BG_AV_OBJECT_FLAG_A_ICEWING_BUNKER = 9, BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER = 10, - BG_AV_OBJECT_FLAG_C_A_FIRSTAID_STATION = 11, BG_AV_OBJECT_FLAG_C_A_STORMPIKE_GRAVE = 12, BG_AV_OBJECT_FLAG_C_A_STONEHEART_GRAVE = 13, @@ -202,7 +173,6 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_FLAG_C_A_TOWER_POINT = 19, BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_ETOWER = 20, BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER = 21, - BG_AV_OBJECT_FLAG_C_H_FIRSTAID_STATION = 22, BG_AV_OBJECT_FLAG_C_H_STORMPIKE_GRAVE = 23, BG_AV_OBJECT_FLAG_C_H_STONEHEART_GRAVE = 24, @@ -214,7 +184,6 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_FLAG_C_H_DUNBALDAR_NORTH = 30, BG_AV_OBJECT_FLAG_C_H_ICEWING_BUNKER = 31, BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER = 32, - BG_AV_OBJECT_FLAG_H_FIRSTAID_STATION = 33, BG_AV_OBJECT_FLAG_H_STORMPIKE_GRAVE = 34, BG_AV_OBJECT_FLAG_H_STONEHEART_GRAVE = 35, @@ -226,9 +195,7 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_FLAG_H_TOWER_POINT = 41, BG_AV_OBJECT_FLAG_H_FROSTWOLF_ETOWER = 42, BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER = 43, - BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE = 44, - BG_AV_OBJECT_DOOR_H = 45, BG_AV_OBJECT_DOOR_A = 46, //auras for graveyards (3auras per graveyard neutral,alliance,horde) @@ -253,7 +220,6 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_AURA_N_FROSTWOLF_HUT = 65, BG_AV_OBJECT_AURA_A_FROSTWOLF_HUT = 66, BG_AV_OBJECT_AURA_H_FROSTWOLF_HUT = 67, - //big flags on top of towers 2 flags on each (contested,(alliance | horde)) + 2 auras BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH = 67, BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH = 68, @@ -287,7 +253,6 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_TAURA_H_FROSTWOLF_ETOWER = 96, BG_AV_OBJECT_TAURA_A_FROSTWOLF_WTOWER = 97, BG_AV_OBJECT_TAURA_H_FROSTWOLF_WTOWER = 98, - BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH = 99, BG_AV_OBJECT_BURN_DUNBALDAR_NORTH = 109, BG_AV_OBJECT_BURN_ICEWING_BUNKER = 119, @@ -306,12 +271,9 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_MINE_SUPPLY_N_MAX = 224, BG_AV_OBJECT_MINE_SUPPLY_S_MIN = 225, BG_AV_OBJECT_MINE_SUPPLY_S_MAX = 236, - BG_AV_OBJECT_MAX = 237 }; - - enum BG_AV_OBJECTS { AV_OPLACE_FIRSTAID_STATION = 0, @@ -337,7 +299,6 @@ enum BG_AV_OBJECTS AV_OPLACE_BIGBANNER_TOWER_POINT = 20, AV_OPLACE_BIGBANNER_FROSTWOLF_ETOWER = 21, AV_OPLACE_BIGBANNER_FROSTWOLF_WTOWER = 22, - AV_OPLACE_BURN_DUNBALDAR_SOUTH = 23, AV_OPLACE_BURN_DUNBALDAR_NORTH = 33, AV_OPLACE_BURN_ICEWING_BUNKER = 43, @@ -356,7 +317,6 @@ enum BG_AV_OBJECTS AV_OPLACE_MINE_SUPPLY_N_MAX = 136, AV_OPLACE_MINE_SUPPLY_S_MIN = 137, AV_OPLACE_MINE_SUPPLY_S_MAX = 148, - AV_OPLACE_MAX = 149 }; const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { @@ -473,7 +433,6 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { {-1295.55f,-263.865f,105.033f,0.925024f}, {-1294.71f,-281.466f,107.664f,-1.50098f}, {-1289.69f,-259.521f,107.612f,-2.19912f}, - //the two buildings of the captains //alliance {-64.4987f,-289.33f,33.4616f,-2.82743f}, @@ -497,7 +456,6 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { {-568.04f,-188.707f,81.55f,0}, {-501.775f,-151.581f,81.2027f,0}, {-509.975f,-191.652f,83.2978f,0}, - //snowfall eyecandy {-191.153f,-129.868f,78.5595f,-1.25664f }, {-201.282f,-134.319f,78.6753f,-0.942478f }, @@ -529,13 +487,11 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { {-947.642f,-208.807f,77.0101f,1.36136f}, {-951.394f,-193.695f,67.634f,0.802851f} }; - const float BG_AV_DoorPositons[2][4] = { {780.487f, -493.024f, 99.9553f, 3.0976f}, //alliance {-1375.193f, -538.981f, 55.2824f, 0.72178f} //horde }; - //creaturestuff starts here //is related to BG_AV_CreaturePos enum BG_AV_CreaturePlace @@ -557,7 +513,6 @@ enum BG_AV_CreaturePlace AV_CPLACE_DEFENSE_FROSTWOLF = 25, AV_CPLACE_DEFENSE_ICE_GRAVE = 29, AV_CPLACE_DEFENSE_FROST_HUT = 33, - AV_CPLACE_DEFENSE_DUN_S = 37, AV_CPLACE_DEFENSE_DUN_N = 41, AV_CPLACE_DEFENSE_ICEWING = 45, @@ -566,7 +521,6 @@ enum BG_AV_CreaturePlace AV_CPLACE_DEFENSE_TOWERPOINT = 57, AV_CPLACE_DEFENSE_FROST_E = 61, AV_CPLACE_DEFENSE_FROST_t = 65, - AV_CPLACE_A_MARSHAL_SOUTH = 69, AV_CPLACE_A_MARSHAL_NORTH = 70, AV_CPLACE_A_MARSHAL_ICE = 71, @@ -596,13 +550,10 @@ enum BG_AV_CreaturePlace AV_CPLACE_MINE_S_S_MAX = 299, //boss AV_CPLACE_MINE_S_3 = 300, - //herald AV_CPLACE_HERALD = 301, - AV_CPLACE_MAX = 302 }; - //x, y, z, o const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { //spiritguides @@ -692,7 +643,6 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { {-1302.41f,-259.256f,114.065f,1.67602f}, {-1287.97f,-262.087f,114.165f,6.18264f}, {-1291.59f,-271.166f,114.151f,5.28257f}, - //alliance marshall {721.104f,-7.64155f,50.7046f,3.45575f},// south {723.058f,-14.1548f,50.7046f,3.40339f},// north @@ -703,7 +653,6 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { {-1370.96f,-223.532f,98.4266f,4.93012f}, {-1378.37f,-228.614f,99.3546f,5.38565f}, {-1358.02f,-228.998f,98.868f,3.87768f}, - //irondeep mine //Irondeep Trogg {971.671f,-442.657f,57.6951f,3.1765f}, @@ -939,13 +888,10 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { {-848.902f,-92.931f,68.6325f,3.33350}, //herald {-48.459f,-288.802f,55.47f,1.0} - }; - enum BG_AV_CreatureIds { - AV_NPC_A_GRAVEDEFENSE0 = 0, // stormpike Defender AV_NPC_A_GRAVEDEFENSE1 = 1, // seasoned defender AV_NPC_A_GRAVEDEFENSE2 = 2, // veteran defender @@ -953,7 +899,6 @@ enum BG_AV_CreatureIds AV_NPC_A_TOWERDEFENSE = 4, // stormpike bowman AV_NPC_A_CAPTAIN = 5, // balinda AV_NPC_A_BOSS = 6, // vanndar - AV_NPC_H_GRAVEDEFENSE0 = 7, // frostwolf guardian AV_NPC_H_GRAVEDEFENSE1 = 8, // seasoned guardian AV_NPC_H_GRAVEDEFENSE2 = 9, // veteran guardian @@ -961,7 +906,6 @@ enum BG_AV_CreatureIds AV_NPC_H_TOWERDEFENSE = 11, // frostwolf bowman AV_NPC_H_CAPTAIN = 12, // galvangar AV_NPC_H_BOSS = 13, // drek thar - AV_NPC_A_MARSHAL_SOUTH = 14, AV_NPC_MARSHAL_NORTH = 15, AV_NPC_A_MARSHAL_ICE = 16, @@ -997,9 +941,7 @@ enum BG_AV_CreatureIds AV_NPC_S_MINE_H_4 = 46, AV_NPC_HERALD = 47, AV_NPC_INFO_MAX = 48 - }; - //entry, team, minlevel, maxlevel //TODO this array should be removed, the only needed things are the entrys (for spawning(?) and handlekillunit) const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { @@ -1021,46 +963,37 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { { 14762, 1534, 60, 60 }, //Dun Baldar North Marshal { 14764, 1534, 60, 60 }, //Icewing Marshal { 14765, 1534, 60, 60 }, //Stonehearth Marshal - { 14773, 1214, 60, 60 }, //Iceblood Warmaster { 14776, 1214, 60, 60 }, //Tower Point Warmaster { 14772, 1214, 60, 60 }, //East Frostwolf Warmaster { 14777, 1214, 60, 60 }, //West Frostwolf Warmaster - { 10987, 59, 52, 53 }, //Irondeep Trogg { 11600, 59, 53, 54 }, //Irondeep Shaman { 11602, 59, 54, 55 }, //Irondeep Skullthumper { 11657, 59, 58, 58 }, //Morloch - {13396,469,52,53}, //irondeep alliance TODO: get the right ids {13080,469,53,54}, {13098,469,54,55}, {13078,469,58,58}, - {13397,67,52,53}, //irondeep horde {13099,67,53,54}, {13081,67,54,55}, {13079,67,58,58}, - { 11603, 59, 52, 53 }, //south mine neutral { 11604, 59, 53, 54 }, { 11605, 59, 54, 55 }, { 11677, 59, 58, 58 }, { 10982, 59, 52, 53 }, //vermin - {13317,469,52,53}, //alliance {13096,469,54,55}, //explorer {13087,469,54,55}, //invader {13086,469,58,58}, - {13316,67,52,53}, //horde {13097,67,54,55}, //surveypr {13089,67,54,55}, //guard {13088,67,58,58}, {14848,67,58,58} //Herald - }; - //x,y,z,o,static_creature_info-id const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatures {-1235.31f,-340.777f,60.5088f,3.31613f,0 },//2225 - Zora Guthrek @@ -1186,9 +1119,7 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatur {773.651f,-497.482f,99.0408f,2.11185f,46 },//14284 - Stormpike Battleguard {949.1f,-506.913f,95.4237f,3.31613f,46 },//14284 - Stormpike Battleguard {-1370.9f,-219.793f,98.4258f,5.04381f,47}, //drek thar - }; - const uint32 BG_AV_StaticCreatureInfo[51][4] = { { 2225, 1215, 55, 55 }, //Zora Guthrek { 3343, 1215, 55, 55 }, //Grelkor @@ -1242,7 +1173,6 @@ const uint32 BG_AV_StaticCreatureInfo[51][4] = { { 11947, 1214, 61, 61 }, //Captain Galvangar { 11949, 1216, 61, 61 } //Captain Balinda Stonehearth }; - enum BG_AV_Graveyards { AV_GRAVE_STORM_AID = 751, @@ -1256,8 +1186,6 @@ enum BG_AV_Graveyards AV_GRAVE_MAIN_HORDE = 610 }; - - const uint32 BG_AV_GraveyardIds[9]= { AV_GRAVE_STORM_AID, AV_GRAVE_STORM_GRAVE, @@ -1269,7 +1197,6 @@ const uint32 BG_AV_GraveyardIds[9]= { AV_GRAVE_MAIN_ALLIANCE, AV_GRAVE_MAIN_HORDE }; - enum BG_AV_BUFF { //TODO add all other buffs here AV_BUFF_ARMOR = 21163, @@ -1283,19 +1210,15 @@ enum BG_AV_States POINT_DESTROYED = 2, POINT_CONTROLED = 3 }; - enum BG_AV_WorldStates { AV_Alliance_Score = 3127, AV_Horde_Score = 3128, AV_SHOW_H_SCORE = 3133, AV_SHOW_A_SCORE = 3134, - /* //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (: ) - // Graves - // Alliance //Stormpike first aid station AV_AID_A_C = 1325, @@ -1338,7 +1261,6 @@ enum BG_AV_WorldStates AV_FROSTWOLFHUT_H_C = 1330, AV_FROSTWOLFHUT_H_A = 1332, //over ac - //Towers //Alliance //Dunbaldar South Bunker @@ -1374,38 +1296,30 @@ enum BG_AV_WorldStates AV_FROSTWOLFE_CONTROLLED = 1383, AV_FROSTWOLFE_DESTROYED = 1366, AV_FROSTWOLFE_ASSAULTED = 1388, - //mines - AV_N_MINE_N = 1360, AV_N_MINE_A = 1358, AV_N_MINE_H = 1359, - AV_S_MINE_N = 1357, AV_S_MINE_A = 1355, AV_S_MINE_H = 1356, - //towers assaulted by own team (unused) AV_STONEH_UNUSED = 1377, AV_ICEWING_UNUSED = 1376, AV_DUNS_UNUSED = 1375, AV_DUNN_UNUSED = 1374, - AV_ICEBLOOD_UNUSED = 1395, AV_TOWERPOINT_UNUSED = 1394, AV_FROSTWOLFE_UNUSED = 1393, AV_FROSTWOLFW_UNUSED = 1392 */ - }; - //alliance_control neutral_control horde_control const uint32 BG_AV_MineWorldStates[2][3] = { {1358, 1360,1359}, {1355, 1357,1356} }; - //alliance_control alliance_assault h_control h_assault const uint32 BG_AV_NodeWorldStates[16][4] = { //Stormpike first aid station @@ -1439,7 +1353,6 @@ const uint32 BG_AV_NodeWorldStates[16][4] = { //Frostwolf West {1365,1387,1382,1392}, }; - enum BG_AV_QuestIds { AV_QUEST_A_SCRAPS1 = 7223, @@ -1465,7 +1378,6 @@ enum BG_AV_QuestIds AV_QUEST_A_RIDER_TAME = 7027, AV_QUEST_H_RIDER_TAME = 7001 }; - struct BG_AV_NodeInfo { uint16 TotalOwner; @@ -1476,9 +1388,7 @@ struct BG_AV_NodeInfo int Timer; bool Tower; }; - inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); } - class BattleGroundAVScore : public BattleGroundScore { public: @@ -1492,30 +1402,24 @@ class BattleGroundAVScore : public BattleGroundScore uint32 LeadersKilled; uint32 SecondaryObjectives; }; - class BattleGroundAV : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundAV(); ~BattleGroundAV(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); virtual void ResetBGSubclass(); - /*general stuff*/ void UpdateScore(uint16 team, int16 points); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - /*handlestuff*/ //these are functions which get called from extern virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); void HandleKillPlayer(Player* player, Player *killer); @@ -1523,62 +1427,47 @@ class BattleGroundAV : public BattleGround void HandleQuestComplete(uint32 questid, Player *player); bool PlayerCanDoMineQuest(int32 GOId,uint32 team); - void EndBattleGround(uint32 winner); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - private: /* Nodes occupying */ void EventPlayerAssaultsPoint(Player* player, uint32 object); void EventPlayerDefendsPoint(Player* player, uint32 object); void EventPlayerDestroyedPoint(BG_AV_Nodes node); - void AssaultNode(BG_AV_Nodes node,uint16 team); void DestroyNode(BG_AV_Nodes node); void InitNode(BG_AV_Nodes node, uint16 team, bool tower); void DefendNode(BG_AV_Nodes node, uint16 team); - void PopulateNode(BG_AV_Nodes node); void DePopulateNode(BG_AV_Nodes node); - const BG_AV_Nodes GetNodeThroughObject(uint32 object); const uint32 GetObjectThroughNode(BG_AV_Nodes node); const char* GetNodeName(BG_AV_Nodes node); const bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; } - /*mine*/ void ChangeMineOwner(uint8 mine, uint32 team, bool initial=false); - /*worldstates*/ void FillInitialWorldStates(WorldPacket& data); const uint8 GetWorldStateType(uint8 state, uint16 team); void SendMineWorldStates(uint32 mine); void UpdateNodeWorldState(BG_AV_Nodes node); - /*general */ Creature* AddAVCreature(uint16 cinfoid, uint16 type); const uint16 GetBonusHonor(uint8 kills); //TODO remove this when mangos handles this right - /*variables */ int32 m_Team_Scores[2]; uint32 m_Team_QuestStatus[2][9]; //[x][y] x=team y=questcounter - BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]; - uint32 m_Mine_Owner[2]; uint32 m_Mine_PrevOwner[2]; //only for worldstates needed int32 m_Mine_Timer; //ticks for both teams uint32 m_Mine_Reclaim_Timer[2]; uint32 m_CaptainBuffTimer[2]; bool m_CaptainAlive[2]; - uint8 m_MaxLevel; //TODO remove this when battleground-getmaxlevel() returns something usefull bool m_IsInformedNearVictory[2]; - }; - #endif diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 05475328b01..e79d2b606ff 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundBE.h" #include "Language.h" @@ -25,11 +24,9 @@ #include "ObjectMgr.h" #include "Player.h" #include "WorldPacket.h" - BattleGroundBE::BattleGroundBE() { m_BgObjects.resize(BG_BE_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -40,94 +37,72 @@ BattleGroundBE::BattleGroundBE() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundBE::~BattleGroundBE() { - } - void BattleGroundBE::Update(uint32 diff) { BattleGround::Update(diff); - /*if (GetStatus() == STATUS_IN_PROGRESS) { // update something }*/ } - void BattleGroundBE::StartingEventCloseDoors() { for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); - for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); } - void BattleGroundBE::StartingEventOpenDoors() { for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } - void BattleGroundBE::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundBEScore* sc = new BattleGroundBEScore; - m_PlayerScores[plr->GetGUID()] = sc; - UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); } - void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; - UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; - if (!killer) { sLog.outError("Killer player not found"); return; } - BattleGround::HandleKillPlayer(player,killer); - UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - bool BattleGroundBE::HandlePlayerUnderMap(Player *player) { player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false); return true; } - void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) return; - //uint32 SpellId = 0; //uint64 buff_guid = 0; switch(Trigger) @@ -143,24 +118,20 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger) Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } - //if (buff_guid) // HandleTriggerBuff(buff_guid,Source); } - void BattleGroundBE::FillInitialWorldStates(WorldPacket &data) { data << uint32(0x9f1) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 data << uint32(0x9f0) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 data << uint32(0x9f3) << uint32(1); // 9 } - void BattleGroundBE::Reset() { //call parent's class reset BattleGround::Reset(); } - bool BattleGroundBE::SetupBattleGround() { // gates @@ -175,22 +146,16 @@ bool BattleGroundBE::SetupBattleGround() sLog.outErrorDb("BatteGroundBE: Failed to spawn some object!"); return false; } - return true; } - void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found... return; - //there is nothing special in this score BattleGround::UpdatePlayerScore(Source,type,value); - } - /* 21:45:46 id:231310 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 0000: 32 02 00 00 76 0e 00 00 00 00 00 00 09 00 f3 09 | 2...v........... @@ -199,7 +164,6 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value 0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................ 0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................ 0050: 00 00 00 00 00 00 | ...... - spell 32724 - Gold Team spell 32725 - Green Team 35774 Gold Team diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h index e75e332f44f..b3996498e53 100644 --- a/src/game/BattleGroundBE.h +++ b/src/game/BattleGroundBE.h @@ -19,9 +19,7 @@ */ #ifndef __BATTLEGROUNDBE_H #define __BATTLEGROUNDBE_H - class BattleGround; - enum BattleGroundBEObjectTypes { BG_BE_OBJECT_DOOR_1 = 0, @@ -32,7 +30,6 @@ enum BattleGroundBEObjectTypes BG_BE_OBJECT_BUFF_2 = 5, BG_BE_OBJECT_MAX = 6 }; - enum BattleGroundBEObjects { BG_BE_OBJECT_TYPE_DOOR_1 = 183971, @@ -42,28 +39,23 @@ enum BattleGroundBEObjects BG_BE_OBJECT_TYPE_BUFF_1 = 184663, BG_BE_OBJECT_TYPE_BUFF_2 = 184664 }; - class BattleGroundBEScore : public BattleGroundScore { public: BattleGroundBEScore() {}; virtual ~BattleGroundBEScore() {}; }; - class BattleGroundBE : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundBE(); ~BattleGroundBE(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); @@ -71,7 +63,6 @@ class BattleGroundBE : public BattleGround virtual void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); - /* Scorekeeping */ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); }; diff --git a/src/game/BattleGroundDS.cpp b/src/game/BattleGroundDS.cpp index 0be870be175..e133bc740b0 100644 --- a/src/game/BattleGroundDS.cpp +++ b/src/game/BattleGroundDS.cpp @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundDS.h" #include "Language.h" #include "Player.h" - BattleGroundDS::BattleGroundDS() { - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -34,47 +31,36 @@ BattleGroundDS::BattleGroundDS() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundDS::~BattleGroundDS() { - } - void BattleGroundDS::Update(uint32 diff) { BattleGround::Update(diff); } - void BattleGroundDS::StartingEventCloseDoors() { } - void BattleGroundDS::StartingEventOpenDoors() { } - void BattleGroundDS::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundDSScore* sc = new BattleGroundDSScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) { } - void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer) { BattleGround::HandleKillPlayer(player, killer); } - void BattleGroundDS::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) { } - bool BattleGroundDS::SetupBattleGround() { return true; diff --git a/src/game/BattleGroundDS.h b/src/game/BattleGroundDS.h index 44a6cfbd33a..8b310a67da0 100644 --- a/src/game/BattleGroundDS.h +++ b/src/game/BattleGroundDS.h @@ -17,9 +17,7 @@ */ #ifndef __BATTLEGROUNDDS_H #define __BATTLEGROUNDDS_H - class BattleGround; - class BattleGroundDSScore : public BattleGroundScore { public: @@ -27,21 +25,17 @@ class BattleGroundDSScore : public BattleGroundScore virtual ~BattleGroundDSScore() {}; //TODO fix me }; - class BattleGroundDS : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundDS(); ~BattleGroundDS(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 0c7ea66388b..5678eeec494 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "ObjectMgr.h" #include "World.h" #include "WorldPacket.h" @@ -29,13 +28,11 @@ #include "Object.h" #include "Player.h" #include "Util.h" - // these variables aren't used outside of this file, so declare them only here uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = { 330, // normal honor 200 // holiday }; - BattleGroundEY::BattleGroundEY() { m_BuffChange = true; @@ -45,21 +42,17 @@ BattleGroundEY::BattleGroundEY() m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; } - BattleGroundEY::~BattleGroundEY() { } - void BattleGroundEY::Update(uint32 diff) { BattleGround::Update(diff); - if (GetStatus() == STATUS_IN_PROGRESS) { m_PointAddingTimer -= diff; @@ -71,11 +64,9 @@ void BattleGroundEY::Update(uint32 diff) if (m_TeamPointsCount[BG_TEAM_HORDE] > 0) AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]); } - if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND) { m_FlagsTimer -= diff; - if (m_FlagsTimer < 0) { m_FlagsTimer = 0; @@ -85,7 +76,6 @@ void BattleGroundEY::Update(uint32 diff) RespawnFlagAfterDrop(); } } - m_TowerCapCheckTimer -= diff; if (m_TowerCapCheckTimer <= 0) { @@ -101,21 +91,17 @@ void BattleGroundEY::Update(uint32 diff) } } } - void BattleGroundEY::StartingEventCloseDoors() { SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_IMMEDIATELY); - for(uint32 i = BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER; i < BG_EY_OBJECT_MAX; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); } - void BattleGroundEY::StartingEventOpenDoors() { SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_ONE_DAY); SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_ONE_DAY); - for(uint32 i = BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER; i <= BG_EY_OBJECT_FLAG_NETHERSTORM; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); for(uint32 i = 0; i < EY_POINTS_MAX; ++i) @@ -125,7 +111,6 @@ void BattleGroundEY::StartingEventOpenDoors() SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3, RESPAWN_IMMEDIATELY); } } - void BattleGroundEY::AddPoints(uint32 Team, uint32 Points) { BattleGroundTeamId team_index = GetTeamIndexByTeamId(Team); @@ -138,7 +123,6 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points) } UpdateTeamScore(Team); } - void BattleGroundEY::CheckSomeoneJoinedPoint() { GameObject *obj = NULL; @@ -175,7 +159,6 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() } } } - void BattleGroundEY::CheckSomeoneLeftPoint() { //reset current point counts @@ -217,7 +200,6 @@ void BattleGroundEY::CheckSomeoneLeftPoint() } } } - void BattleGroundEY::UpdatePointStatuses() { for(uint8 point = 0; point < EY_POINTS_MAX; ++point) @@ -226,14 +208,12 @@ void BattleGroundEY::UpdatePointStatuses() continue; //count new point bar status: m_PointBarStatus[point] += (m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] < BG_EY_POINT_MAX_CAPTURERS_COUNT) ? m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] : BG_EY_POINT_MAX_CAPTURERS_COUNT; - if (m_PointBarStatus[point] > BG_EY_PROGRESS_BAR_ALI_CONTROLLED) //point is fully alliance's m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_ALI_CONTROLLED; if (m_PointBarStatus[point] < BG_EY_PROGRESS_BAR_HORDE_CONTROLLED) //point is fully horde's m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_HORDE_CONTROLLED; - uint32 pointOwnerTeamId = 0; //find which team should own this point if (m_PointBarStatus[point] <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW) @@ -242,7 +222,6 @@ void BattleGroundEY::UpdatePointStatuses() pointOwnerTeamId = ALLIANCE; else pointOwnerTeamId = EY_POINT_NO_OWNER; - for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i) { Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); @@ -255,7 +234,6 @@ void BattleGroundEY::UpdatePointStatuses() //point was uncontrolled and player is from team which captured point if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId) this->EventTeamCapturedPoint(plr, point); - //point was under control and player isn't from team which controlled it if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point]) this->EventTeamLostPoint(plr, point); @@ -264,7 +242,6 @@ void BattleGroundEY::UpdatePointStatuses() } } } - void BattleGroundEY::UpdateTeamScore(uint32 Team) { uint32 score = GetTeamScore(Team); @@ -278,19 +255,16 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team) PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY); m_IsInformedNearVictory = true; }*/ - if (score >= BG_EY_MAX_TEAM_SCORE) { score = BG_EY_MAX_TEAM_SCORE; EndBattleGround(Team); } - if (Team == ALLIANCE) UpdateWorldState(EY_ALLIANCE_RESOURCES, score); else UpdateWorldState(EY_HORDE_RESOURCES, score); } - void BattleGroundEY::EndBattleGround(uint32 winner) { //win reward @@ -301,10 +275,8 @@ void BattleGroundEY::EndBattleGround(uint32 winner) //complete map reward RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); - BattleGround::EndBattleGround(winner); } - void BattleGroundEY::UpdatePointsCount(uint32 Team) { if (Team == ALLIANCE) @@ -312,7 +284,6 @@ void BattleGroundEY::UpdatePointsCount(uint32 Team) else UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]); } - void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point) { //we MUST firstly send 0, after that we can send 1!!! @@ -333,18 +304,14 @@ void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point) UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 1); } } - void BattleGroundEY::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map BattleGroundEYScore* sc = new BattleGroundEYScore; - m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID()); - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) { // sometimes flag aura not removed :( @@ -368,15 +335,12 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) } } } - void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; - if(!Source->isAlive()) //hack code, must be removed later return; - switch(Trigger) { case TR_BLOOD_ELF_POINT: @@ -416,7 +380,6 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) break; } } - bool BattleGroundEY::SetupBattleGround() { // doors @@ -477,7 +440,6 @@ bool BattleGroundEY::SetupBattleGround() sLog.outErrorDb("BatteGroundEY: Failed to spawn some object BattleGround not created!"); return false; } - //buffs for (int i = 0; i < EY_POINTS_MAX; ++i) { @@ -493,7 +455,6 @@ bool BattleGroundEY::SetupBattleGround() ) sLog.outError("BattleGroundEY: Cannot spawn buff"); } - WorldSafeLocsEntry const *sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) @@ -501,22 +462,18 @@ bool BattleGroundEY::SetupBattleGround() sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!"); return false; } - sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!"); return false; } - return true; } - void BattleGroundEY::Reset() { //call parent's class reset BattleGround::Reset(); - m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0; @@ -531,7 +488,6 @@ void BattleGroundEY::Reset() m_TowerCapCheckTimer = 0; bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID()); m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks; - for(uint8 i = 0; i < EY_POINTS_MAX; ++i) { m_PointOwnedByTeam[i] = EY_POINT_NO_OWNER; @@ -543,47 +499,37 @@ void BattleGroundEY::Reset() m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].clear(); m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].reserve(30); } - void BattleGroundEY::RespawnFlag(bool send_message) { if (m_FlagCapturedBgObjectType > 0) SpawnBGObject(m_FlagCapturedBgObjectType, RESPAWN_ONE_DAY); - m_FlagCapturedBgObjectType = 0; m_FlagState = BG_EY_FLAG_STATE_ON_BASE; SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY); - if (send_message) { SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound... } - UpdateWorldState(NETHERSTORM_FLAG, 1); } - void BattleGroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); - GameObject *obj = HashMapHolder::Find(GetDroppedFlagGUID()); if (obj) obj->Delete(); else sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID())); - SetDroppedFlagGUID(0); } - void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; - BattleGround::HandleKillPlayer(player, killer); EventPlayerDroppedFlag(player); } - void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) { if (GetStatus() != STATUS_IN_PROGRESS) @@ -597,13 +543,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) } return; } - if (!IsFlagPickedup()) return; - if (GetFlagPickerGUID() != Source->GetGUID()) return; - SetFlagPicker(0); Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); m_FlagState = BG_EY_FLAG_STATE_ON_GROUND; @@ -613,18 +556,15 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) //this does not work correctly :( (it should remove flag carrier name) UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN); UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN); - if (Source->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL); else SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL); } - void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) return; - if (Source->GetTeam() == ALLIANCE) { UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER); @@ -635,34 +575,27 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_ON_PLAYER); PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_HORDE); } - if (m_FlagState == BG_EY_FLAG_STATE_ON_BASE) UpdateWorldState(NETHERSTORM_FLAG, 0); m_FlagState = BG_EY_FLAG_STATE_ON_PLAYER; - SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY); SetFlagPicker(Source->GetGUID()); //get flag aura on player Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true); Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); - if (Source->GetTeam() == ALLIANCE) PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName()); else PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName()); } - void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point) { if (GetStatus() != STATUS_IN_PROGRESS) return; - //Natural point uint32 Team = m_PointOwnedByTeam[Point]; - if (!Team) return; - if (Team == ALLIANCE) { m_TeamPointsCount[BG_TEAM_ALLIANCE]--; @@ -677,36 +610,27 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point) SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY); } - SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType, RESPAWN_IMMEDIATELY); SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY); - //buff isn't despawned - m_PointOwnedByTeam[Point] = EY_POINT_NO_OWNER; m_PointState[Point] = EY_POINT_NO_OWNER; - if (Team == ALLIANCE) SendMessageToAll(m_LoosingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); else SendMessageToAll(m_LoosingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source); - UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); } - void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) { if (GetStatus() != STATUS_IN_PROGRESS) return; - uint32 Team = Source->GetTeam(); - SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY); SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY); SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 2, RESPAWN_ONE_DAY); - if (Team == ALLIANCE) { m_TeamPointsCount[BG_TEAM_ALLIANCE]++; @@ -721,53 +645,39 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY); } - //buff isn't respawned - m_PointOwnedByTeam[Point] = Team; m_PointState[Point] = EY_POINT_UNDER_CONTROL; - if (Team == ALLIANCE) SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); else SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source); - if (m_BgCreatures[Point]) DelCreature(Point); - WorldSafeLocsEntry const *sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); - // SpawnBGCreature(Point,RESPAWN_IMMEDIATELY); - UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); } - void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) { if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) return; - SetFlagPicker(0); m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN; Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); - Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); - if (Source->GetTeam() == ALLIANCE) PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); else PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); - SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY); - m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; m_FlagCapturedBgObjectType = BgObjectType; - uint8 team_id = 0; if (Source->GetTeam() == ALLIANCE) { @@ -779,19 +689,15 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType team_id = BG_TEAM_HORDE; SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source); } - if (m_TeamPointsCount[team_id] > 0) AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]); - UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); } - void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found return; - switch(type) { case SCORE_FLAG_CAPTURES: // flags captured @@ -802,7 +708,6 @@ void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value break; } } - void BattleGroundEY::FillInitialWorldStates(WorldPacket& data) { data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]); @@ -815,33 +720,19 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data) data << uint32(0xab1) << uint32(0x0); data << uint32(0xab0) << uint32(0x0); data << uint32(0xaaf) << uint32(0x0); - data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); - data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - data << uint32(MAGE_TOWER_UNCONTROL) << uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); - data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - data << uint32(FEL_REAVER_UNCONTROL) << uint32(m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL); - data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - data << uint32(BLOOD_ELF_UNCONTROL) << uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); - data << uint32(NETHERSTORM_FLAG) << uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE); - data << uint32(0xad2) << uint32(0x1); data << uint32(0xad1) << uint32(0x1); data << uint32(0xabe) << uint32(GetTeamScore(HORDE)); @@ -852,39 +743,31 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data) data << uint32(0xa9e) << uint32(0x0); data << uint32(0xc0d) << uint32(0x17b); } - WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player) { uint32 g_id = 0; - switch(player->GetTeam()) { case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break; case HORDE: g_id = EY_GRAVEYARD_MAIN_HORDE; break; default: return NULL; } - float distance, nearestDistance; - WorldSafeLocsEntry const* entry = NULL; WorldSafeLocsEntry const* nearestEntry = NULL; entry = sWorldSafeLocsStore.LookupEntry(g_id); nearestEntry = entry; - if (!entry) { sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!"); return NULL; } - float plr_x = player->GetPositionX(); float plr_y = player->GetPositionY(); float plr_z = player->GetPositionZ(); - distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z); nearestDistance = distance; - for(uint8 i = 0; i < EY_POINTS_MAX; ++i) { if (m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL) @@ -903,16 +786,13 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player) } } } - return nearestEntry; } - bool BattleGroundEY::IsAllNodesConrolledByTeam(uint32 team) const { uint32 count = 0; for(int i = 0; i < EY_POINTS_MAX; ++i) if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL) ++count; - return count == EY_POINTS_MAX; } diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 3385a06bfb0..086c4d79fbd 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -17,17 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUNDEY_H #define __BATTLEGROUNDEY_H - #include "Language.h" - class BattleGround; - #define BG_EY_FLAG_RESPAWN_TIME (10*IN_MILISECONDS) //10 seconds #define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds - enum BG_EY_WorldStates { EY_ALLIANCE_RESOURCES = 2749, @@ -54,7 +49,6 @@ enum BG_EY_WorldStates NETHERSTORM_FLAG_STATE_ALLIANCE = 2769, NETHERSTORM_FLAG_STATE_HORDE = 2770 }; - enum BG_EY_ProgressBarConsts { BG_EY_POINT_MAX_CAPTURERS_COUNT = 5, @@ -68,7 +62,6 @@ enum BG_EY_ProgressBarConsts BG_EY_PROGRESS_BAR_NEUTRAL_HIGH = 70, BG_EY_PROGRESS_BAR_ALI_CONTROLLED = 100 }; - enum BG_EY_Sounds { //strange ids, but sure about them @@ -78,13 +71,11 @@ enum BG_EY_Sounds BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, BG_EY_SOUND_FLAG_RESET = 8192 }; - enum BG_EY_Spells { BG_EY_NETHERSTORM_FLAG_SPELL = 34976, BG_EY_PLAYER_DROPPED_FLAG_SPELL = 34991 }; - enum EYBattleGroundObjectEntry { BG_OBJECT_A_DOOR_EY_ENTRY = 184719, //Alliance door @@ -100,7 +91,6 @@ enum EYBattleGroundObjectEntry BG_OBJECT_HU_TOWER_CAP_EY_ENTRY = 184082, //Human Tower Cap Pt BG_OBJECT_DR_TOWER_CAP_EY_ENTRY = 184083 //Draenei Tower Cap Pt }; - enum EYBattleGroundPointsTrigger { TR_BLOOD_ELF_POINT = 4476, @@ -112,7 +102,6 @@ enum EYBattleGroundPointsTrigger TR_MAGE_TOWER_BUFF = 4570, TR_DRAENEI_RUINS_BUFF = 4571 }; - enum EYBattleGroundGaveyards { EY_GRAVEYARD_MAIN_ALLIANCE = 1103, @@ -122,18 +111,15 @@ enum EYBattleGroundGaveyards EY_GRAVEYARD_DRAENEI_RUINS = 1107, EY_GRAVEYARD_MAGE_TOWER = 1108 }; - enum EYBattleGroundPoints { FEL_REALVER = 0, BLOOD_ELF = 1, DRAENEI_RUINS = 2, MAGE_TOWER = 3, - EY_PLAYERS_OUT_OF_POINTS = 4, EY_POINTS_MAX = 4 }; - enum EYBattleGroundCreaturesTypes { EY_SPIRIT_FEL_REALVER = 0, @@ -142,10 +128,8 @@ enum EYBattleGroundCreaturesTypes EY_SPIRIT_MAGE_TOWER = 3, EY_SPIRIT_MAIN_ALLIANCE = 4, EY_SPIRIT_MAIN_HORDE = 5, - BG_EY_CREATURES_MAX = 6 }; - enum EYBattleGroundObjectTypes { BG_EY_OBJECT_DOOR_A = 0, @@ -210,16 +194,13 @@ enum EYBattleGroundObjectTypes BG_EY_OBJECT_BERSERKBUFF_MAGE_TOWER = 58, BG_EY_OBJECT_MAX = 59 }; - #define BG_EY_NotEYWeekendHonorTicks 330 #define BG_EY_EYWeekendHonorTicks 200 - enum BG_EY_Score { BG_EY_WARNING_NEAR_VICTORY_SCORE = 1800, BG_EY_MAX_TEAM_SCORE = 2000 }; - enum BG_EY_FlagState { BG_EY_FLAG_STATE_ON_BASE = 0, @@ -227,14 +208,12 @@ enum BG_EY_FlagState BG_EY_FLAG_STATE_ON_PLAYER = 2, BG_EY_FLAG_STATE_ON_GROUND = 3 }; - enum EYBattleGroundPointState { EY_POINT_NO_OWNER = 0, EY_POINT_STATE_UNCONTROLLED = 0, EY_POINT_UNDER_CONTROL = 3 }; - struct BattleGroundEYPointIconsStruct { BattleGroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex) @@ -243,7 +222,6 @@ struct BattleGroundEYPointIconsStruct uint32 WorldStateAllianceControlledIndex; uint32 WorldStateHordeControlledIndex; }; - struct BattleGroundEYLoosingPointStruct { BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde) @@ -251,14 +229,12 @@ struct BattleGroundEYLoosingPointStruct DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde) {} - uint32 SpawnNeutralObjectType; uint32 DespawnObjectTypeAlliance; uint32 MessageIdAlliance; uint32 DespawnObjectTypeHorde; uint32 MessageIdHorde; }; - struct BattleGroundEYCapturingPointStruct { BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId) @@ -267,7 +243,6 @@ struct BattleGroundEYCapturingPointStruct SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), GraveYardId(_GraveYardId) {} - uint32 DespawnNeutralObjectType; uint32 SpawnObjectTypeAlliance; uint32 MessageIdAlliance; @@ -275,10 +250,8 @@ struct BattleGroundEYCapturingPointStruct uint32 MessageIdHorde; uint32 GraveYardId; }; - const uint8 BG_EY_TickPoints[EY_POINTS_MAX] = {1, 2, 5, 10}; const uint32 BG_EY_FlagPoints[EY_POINTS_MAX] = {75, 85, 100, 500}; - //constant arrays: const BattleGroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] = { @@ -301,7 +274,6 @@ const BattleGroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) }; - class BattleGroundEYScore : public BattleGroundScore { public: @@ -309,21 +281,17 @@ class BattleGroundEYScore : public BattleGroundScore virtual ~BattleGroundEYScore() {}; uint32 FlagCaptures; }; - class BattleGroundEY : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundEY(); ~BattleGroundEY(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - /* BG Flags */ uint64 GetFlagPickerGUID() const { return m_FlagKeeper; } void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; } @@ -331,7 +299,6 @@ class BattleGroundEY : public BattleGround uint8 GetFlagState() const { return m_FlagState; } void RespawnFlag(bool send_message); void RespawnFlagAfterDrop(); - void RemovePlayer(Player *plr,uint64 guid); void HandleBuffUse(uint64 const& buff_guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); @@ -345,11 +312,9 @@ class BattleGroundEY : public BattleGround virtual void FillInitialWorldStates(WorldPacket& data); void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} - /* Battleground Events */ virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); virtual void EventPlayerDroppedFlag(Player *Source); - /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; private: @@ -358,38 +323,30 @@ class BattleGroundEY : public BattleGround void EventTeamLostPoint(Player *Source, uint32 Point); void UpdatePointsCount(uint32 Team); void UpdatePointsIcons(uint32 Team, uint32 Point); - /* Point status updating procedures */ void CheckSomeoneLeftPoint(); void CheckSomeoneJoinedPoint(); void UpdatePointStatuses(); - /* Scorekeeping */ uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; } void AddPoints(uint32 Team, uint32 Points); - void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } - uint32 m_HonorScoreTics[2]; uint32 m_TeamPointsCount[2]; - uint32 m_Points_Trigger[EY_POINTS_MAX]; - uint64 m_FlagKeeper; // keepers guid uint64 m_DroppedFlagGUID; uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured uint8 m_FlagState; // for checking flag state int32 m_FlagsTimer; int32 m_TowerCapCheckTimer; - uint32 m_PointOwnedByTeam[EY_POINTS_MAX]; uint8 m_PointState[EY_POINTS_MAX]; int32 m_PointBarStatus[EY_POINTS_MAX]; typedef std::vector PlayersNearPointType; PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1]; uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX]; - int32 m_PointAddingTimer; uint32 m_HonorTics; }; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 3e7c453e300..1e685ec1f3a 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -17,13 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "WorldPacket.h" #include "WorldSession.h" - #include "ArenaTeam.h" #include "BattleGroundMgr.h" #include "BattleGroundWS.h" @@ -34,42 +32,33 @@ #include "Player.h" #include "Object.h" #include "Opcodes.h" - void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) { uint64 guid; recv_data >> guid; sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); - Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; - if(!unit->isBattleMaster()) // it's not battlemaster return; - // Stop the npc if moving unit->StopMoving(); - BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry()); - if (!_player->GetBGAccessByLevel(bgTypeId)) { // temp, must be gossip message... SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR); return; } - SendBattlegGroundList(guid, bgTypeId); } - void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId ) { WorldPacket data; sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId, 0); SendPacket( &data ); } - void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { uint64 guid; @@ -78,40 +67,31 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) uint8 joinAsGroup; bool isPremade = false; Group * grp; - recv_data >> guid; // battlemaster guid recv_data >> bgTypeId_; // battleground type id (DBC id) recv_data >> instanceId; // instance id, 0 if First Available selected recv_data >> joinAsGroup; // join as group - if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow()); return; } - BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); - // can do this, since it's battleground, not arena BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0); - // ignore if player is already in BG if (_player->InBattleGround()) return; - // get bg instance or bg template if instance not found BattleGround *bg = NULL; if (instanceId) bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId); - if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))) { sLog.outError("Battleground: no available bg / template found"); return; } - // check queueing conditions if (!joinAsGroup) { @@ -146,7 +126,6 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) } } // if we're here, then the conditions to join a bg are met. We can proceed in joining. - // _player->GetGroup() was already checked, grp is already initialized GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0); uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); @@ -157,9 +136,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { Player *member = itr->getSource(); if(!member) continue; // this should never happen - uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); @@ -175,12 +152,10 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { // already checked if queueSlot is valid, now just get it uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } @@ -188,31 +163,25 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) if (!ginfo->IsInvitedToBGInstanceGUID) sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true); } - void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ ) { // empty opcode sLog.outDebug("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); - BattleGround *bg = _player->GetBattleGround(); if(!bg) // can't be received if player not in battleground return; - switch( bg->GetTypeID() ) { case BATTLEGROUND_WS: { uint32 count1 = 0; //always constant zero? uint32 count2 = 0; //count of next fields - Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID()); if (ali_plr) ++count2; - Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID()); if (horde_plr) ++count2; - WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2)); data << count1; // alliance flag holders count - obsolete, now always 0 /*for(uint8 i = 0; i < count1; ++i) @@ -234,7 +203,6 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv data << (float)horde_plr->GetPositionX(); data << (float)horde_plr->GetPositionY(); } - SendPacket(&data); } break; @@ -256,57 +224,44 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv break; } } - void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message"); - BattleGround *bg = _player->GetBattleGround(); if (!bg) return; - WorldPacket data; sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg); SendPacket(&data); - sLog.outDebug( "WORLD: Sent MSG_PVP_LOG_DATA Message"); } - void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) { sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); - uint32 bgTypeId; recv_data >> bgTypeId; // id from DBC - uint8 fromWhere; recv_data >> fromWhere; // 0 - battlemaster, 1 - UI - BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) { sLog.outError("Battleground: invalid bgtype received."); return; } - WorldPacket data; sBattleGroundMgr.BuildBattleGroundListPacket(&data, 0, _player, BattleGroundTypeId(bgTypeId), fromWhere); SendPacket( &data ); } - void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) { sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message"); - uint8 type; // arenatype if arena uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1 uint32 instanceId; uint32 bgTypeId_; // type id from dbc uint16 unk; // 0x1F90 constant? uint8 action; // enter battle 0x1, leave queue 0x0 - recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action; - if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_); @@ -327,12 +282,10 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) // if the player is not in queue, continue or no group information - this should never happen if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo) continue; - BattleGround * bg = NULL; // get possibly needed data from groupinfo uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; uint8 status = 0; - if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) { // not invited to bg, get template @@ -345,11 +298,9 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); status = STATUS_WAIT_JOIN; } - // if bg not found, then continue, don't invite if already in the instance if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID())) continue; - // re - invite player with proper data WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, status, INVITE_ACCEPT_WAIT_TIME, 0, arenatype); @@ -358,7 +309,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) } return; } - //get GroupQueueInfo from BattleGroundQueue BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type); @@ -369,7 +319,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) sLog.outError("Battleground: itrplayerstatus not found."); return; } - instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID; // if action == 1, then instanceId is required if (!instanceId && action == 1) @@ -377,9 +326,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) sLog.outError("Battleground: instance not found."); return; } - BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId); - // bg template might and must be used in case of leaving queue, when instance is not created yet if (!bg && action == 0) bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); @@ -388,7 +335,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId); return; } - if (_player->InBattleGroundQueue()) { //we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function! @@ -397,7 +343,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) uint32 isRated = itrPlayerStatus->second.GroupInfo->IsRated; uint32 rating = itrPlayerStatus->second.GroupInfo->ArenaTeamRating; uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating; - //some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it if (action == 1 && arenaType == 0) { @@ -425,9 +370,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) case 1: // port to battleground if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) return; // cheating? - _player->SetBattleGroundEntryPoint(); - // resurrect the player if (!_player->isAlive()) { @@ -439,9 +382,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) { _player->GetMotionMaster()->MovementExpired(); _player->CleanupAfterTaxiFlight(); - } - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); _player->GetSession()->SendPacket(&data); // remove battleground queue status from BGmgr @@ -450,7 +391,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new if (BattleGround *currentBg = _player->GetBattleGround()) currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); - // set the destination instance id _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); // set the destination team @@ -491,34 +431,26 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) } } } - void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug( "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); - //uint8 unk1, unk2; //uint32 bgTypeId; // id from DBC //uint16 unk3; - //recv_data >> unk1 >> unk2 >> bgTypeId >> unk3; - no used currently - //if(bgTypeId >= MAX_BATTLEGROUND_TYPES) // cheating? but not important in this case // return; - // not allow leave battleground in combat if (_player->isInCombat()) if (BattleGround* bg = _player->GetBattleGround()) if (bg->GetStatus() != STATUS_WAIT_LEAVE) return; - _player->LeaveBattleground(); } - void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) { // empty opcode sLog.outDebug( "WORLD: Battleground status" ); - WorldPacket data; // we must update all queues here BattleGround *bg = NULL; @@ -571,76 +503,56 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } } } - void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - BattleGround *bg = _player->GetBattleGround(); if (!bg) return; - uint64 guid; recv_data >> guid; - Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; - if(!unit->isSpiritService()) // it's not spirit service return; - sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, guid); } - void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - BattleGround *bg = _player->GetBattleGround(); if (!bg) return; - uint64 guid; recv_data >> guid; - Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; - if(!unit->isSpiritService()) // it's not spirit service return; - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); } - void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); //recv_data.hexlike(); - uint64 guid; // arena Battlemaster guid uint8 arenaslot; // 2v2, 3v3 or 5v5 uint8 asGroup; // asGroup uint8 isRated; // isRated Group * grp; - recv_data >> guid >> arenaslot >> asGroup >> isRated; - // ignore if we already in BG or BG queue if (_player->InBattleGround()) return; - Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; - if(!unit->isBattleMaster()) // it's not battle master return; - uint8 arenatype = 0; uint32 arenaRating = 0; - switch(arenaslot) { case 0: @@ -656,7 +568,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) sLog.outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); return; } - //check existance BattleGround* bg = NULL; if (!(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA))) @@ -664,10 +575,8 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) sLog.outError("Battleground: template bg (all arenas) not found"); return; } - BattleGroundTypeId bgTypeId = bg->GetTypeID(); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype); - // check queueing conditions if (!asGroup) { @@ -692,9 +601,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) return; } } - uint32 ateamId = 0; - if (isRated) { ateamId = _player->GetArenaTeamId(arenaslot); @@ -713,19 +620,15 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *member = itr->getSource(); - // calc avg personal rating avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5); } - if (arenatype) avg_pers_rating /= arenatype; - // if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating if (avg_pers_rating + 150 < arenaRating) arenaRating = avg_pers_rating; } - GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); if (asGroup) @@ -738,14 +641,11 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) } else bg->SetRated(false); - for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *member = itr->getSource(); if(!member) continue; - uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); @@ -762,7 +662,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) else { uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); @@ -772,24 +671,19 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) } sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenatype, isRated, arenaRating); } - void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) { uint64 playerGuid; recv_data >> playerGuid; Player *reportedPlayer = objmgr.GetPlayer(playerGuid); - if (!reportedPlayer) { sLog.outDebug("WorldSession::HandleReportPvPAFK: player not found"); return; } - sLog.outDebug("WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName(), reportedPlayer->GetName()); - reportedPlayer->ReportedAfkBy(_player); } - void WorldSession::SendBattleGroundOrArenaJoinError(uint8 err) { WorldPacket data; diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index f2143de5bdc..99339a835a6 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -17,13 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectMgr.h" #include "World.h" #include "WorldPacket.h" #include "Policies/SingletonImp.h" - #include "ArenaTeam.h" #include "BattleGroundMgr.h" #include "BattleGroundAV.h" @@ -45,13 +43,10 @@ #include "GameEventMgr.h" #include "ProgressBar.h" #include "SharedDefines.h" - INSTANTIATE_SINGLETON_1( BattleGroundMgr ); - /*********************************************************/ /*** BATTLEGROUND QUEUE SYSTEM ***/ /*********************************************************/ - BattleGroundQueue::BattleGroundQueue() { for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) @@ -65,7 +60,6 @@ BattleGroundQueue::BattleGroundQueue() } } } - BattleGroundQueue::~BattleGroundQueue() { m_QueuedPlayers.clear(); @@ -79,18 +73,15 @@ BattleGroundQueue::~BattleGroundQueue() } } } - /*********************************************************/ /*** BATTLEGROUND QUEUE SELECTION POOLS ***/ /*********************************************************/ - // selection pool initialization, used to clean up from prev selection void BattleGroundQueue::SelectionPool::Init() { SelectedGroups.clear(); PlayerCount = 0; } - // remove group info from selection pool // returns true when we need to try to add new group to selection pool // returns false when selection pool is ok or when we kicked smaller group than we need to kick @@ -123,7 +114,6 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size) } return true; } - // add group to selection pool // used when building selection pools // returns true if we can invite more players, or when we added group to selection pool @@ -142,16 +132,13 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de return true; return false; } - /*********************************************************/ /*** BATTLEGROUND QUEUES ***/ /*********************************************************/ - // add group to bg queue with the given leader and bg specifications GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId BgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) { BGQueueIdBasedOnLevel queue_id = leader->GetBattleGroundQueueIdFromLevel(BgTypeId); - // create new ginfo // cannot use the method like in addplayer, because that could modify an in-queue group's stats // (e.g. leader leaving queue then joining as individual again) @@ -166,9 +153,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId ginfo->Team = leader->GetTeam(); ginfo->ArenaTeamRating = arenaRating; ginfo->OpponentsTeamRating = 0; - ginfo->Players.clear(); - //compute index (if group is premade or joined a rated match) to queues uint32 index = 0; if (!isRated && !isPremade) @@ -176,13 +161,10 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId if (ginfo->Team == HORDE) index++; sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index); - m_QueuedGroups[queue_id][index].push_back(ginfo); - // return ginfo, because it is needed to add players to this group info return ginfo; } - //add player to playermap void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo) { @@ -190,11 +172,9 @@ void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo) PlayerQueueInfo& info = m_QueuedPlayers[plr->GetGUID()]; info.LastOnlineTime = getMSTime(); info.GroupInfo = ginfo; - // add the pinfo to ginfo's list ginfo->Players[plr->GetGUID()] = &info; } - void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id) { uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime()); @@ -209,7 +189,6 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g if (ginfo->IsRated) team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE } - //store pointer to arrayindex of player that was added first uint32* lastPlayerAddedPointer = &(m_WaitTimeLastPlayer[team_index][queue_id]); //remove his time from sum @@ -222,7 +201,6 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g (*lastPlayerAddedPointer)++; (*lastPlayerAddedPointer) %= COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; } - uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id) { uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas! @@ -243,15 +221,12 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueue //if there aren't enough values return 0 - not available return 0; } - //remove player from queue and from group info, if group info is empty then remove it too void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount) { //Player *plr = objmgr.GetPlayer(guid); - int32 queue_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; - //remove player from map, if he's there itr = m_QueuedPlayers.find(guid); if (itr == m_QueuedPlayers.end()) @@ -259,14 +234,12 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid)); return; } - GroupQueueInfo* group = itr->second.GroupInfo; GroupsQueueType::iterator group_itr, group_itr_tmp; // mostly people with the highest levels are in battlegrounds, thats why // we count from MAX_BATTLEGROUND_QUEUES - 1 to 0 // variable index removes useless searching in other team's queue uint32 index = (group->Team == HORDE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; - for (int32 queue_id_tmp = MAX_BATTLEGROUND_QUEUES - 1; queue_id_tmp >= 0 && queue_id == -1; --queue_id_tmp) { //we must check premade and normal team's queue - because when players from premade are joining bg, @@ -293,17 +266,14 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou return; } sLog.outDebug("BattleGroundQueue: Removing player GUID %u, from queue_id %u", GUID_LOPART(guid), (uint32)queue_id); - // ALL variables are correctly set // We can ignore leveling up in queue - it should not cause crash // remove player from group // if only one player there, remove group - // remove player queue info from group queue info std::map::iterator pitr = group->Players.find(guid); if (pitr != group->Players.end()) group->Players.erase(pitr); - // if invited to bg, and should decrease invited count, then do it if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID) { @@ -311,14 +281,11 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou if (bg) bg->DecreaseInvitedCount(group->Team); } - // remove player queue info m_QueuedPlayers.erase(itr); - //if we left BG queue(not porting) OR if arena team left queue for rated match if ((decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty())) AnnounceWorld(group, guid, false); - //if player leaves queue and he is invited to rated arena match, then he have to loose if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount) { @@ -334,7 +301,6 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou at->SaveToDB(); } } - // remove group queue info if needed if (group->Players.empty()) { @@ -363,7 +329,6 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou RemovePlayer(group->Players.begin()->first, decreaseInvitedCount); } } - //Announce world message void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue) { @@ -374,7 +339,6 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); if (!bg) return; - char const* bgName = bg->GetName(); if (isAddedToQueue) { @@ -406,7 +370,6 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); if (!bg || !plr) return; - BGQueueIdBasedOnLevel queue_id = plr->GetBattleGroundQueueIdFromLevel(bg->GetTypeID()); char const* bgName = bg->GetName(); uint32 MinPlayers = bg->GetMinPlayersPerTeam(); @@ -421,7 +384,6 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qHorde += (*itr)->Players.size(); - // Show queue status to player only (when joining queue) if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) { @@ -437,13 +399,11 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe } } } - bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side) { // set side if needed if (side) ginfo->Team = side; - if (!ginfo->IsInvitedToBGInstanceGUID) { // not yet invited @@ -452,13 +412,10 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b BattleGroundTypeId bgTypeId = bg->GetTypeID(); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, bg->GetArenaType()); BGQueueIdBasedOnLevel queue_id = bg->GetQueueId(); - // set ArenaTeamId for rated matches if (bg->isArena() && bg->isRated()) bg->SetArenaTeamIdForTeam(ginfo->Team, ginfo->ArenaTeamId); - ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME; - // loop through the players for(std::map::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) { @@ -467,39 +424,29 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b // if offline, skip him, this should not happen - player is removed from queue when he logs out if (!plr) continue; - // invite the player PlayerInvitedToBGUpdateAverageWaitTime(ginfo, queue_id); //sBattleGroundMgr.InvitePlayer(plr, bg, ginfo->Team); - // set invited player counters bg->IncreaseInvitedCount(ginfo->Team); - plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID); - // create remind invite events BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime); plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME)); // create automatic remove events BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); - WorldPacket data; - uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); - sLog.outDebug("Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",plr->GetName(),plr->GetGUIDLow(),bg->GetInstanceID(),queueSlot,bg->GetTypeID()); - // send status packet sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType); plr->GetSession()->SendPacket(&data); } return true; } - return false; } - /* This function is inviting players to already running battlegrounds Invitation type is based on config file @@ -509,7 +456,6 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel { int32 hordeFree = bg->GetFreeSlotsForTeam(HORDE); int32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE); - //iterator for iterating through bg queue GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); //count of groups in queue - used to stop cycles @@ -524,11 +470,9 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel uint32 hordeIndex = 0; for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++) ++Horde_itr; - //if ofc like BG queue invitation is set in config, then we are happy if (sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) == 0) return; - /* if we reached this code, then we have to solve NP - complete problem called Subset sum problem So one solution is to check all possible invitation subgroups, or we can use these conditions: @@ -536,7 +480,6 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel that we will invite now whole queue, because only 1 change has been made to queues from the last BattleGroundQueue::Update call 2. Other thing we should consider is group order in queue */ - // At first we need to compare free space in bg and our selection pool int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); @@ -579,7 +522,6 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); } } - // this method checks if premade versus premade battleground is possible // then after 30 mins (default) in queue it moves premade group to normal queue // it tries to invite as much players as it can - to MaxPlayersPerTeam, because premade groups have more than MinPlayersPerTeam players @@ -597,7 +539,6 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 for( horde_group = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) if (!(*horde_group)->IsInvitedToBGInstanceGUID) break; - if (ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end()) { m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam); @@ -639,7 +580,6 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 //selection pools are not set return false; } - // this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 minPlayers, uint32 maxPlayers) { @@ -682,7 +622,6 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas //return true if there are enough players in selection pools - enable to work .debug bg command correctly return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers; } - // this method will check if we can invite players to same faction skirmish match bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_id, uint32 minPlayersPerTeam) { @@ -719,7 +658,6 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_ } if (m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam) return false; - //here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue for(GroupsQueueType::iterator itr = m_SelectionPools[otherTeam].SelectedGroups.begin(); itr != m_SelectionPools[otherTeam].SelectedGroups.end(); ++itr) { @@ -741,7 +679,6 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_ } return true; } - /* this method is called when group is inserted, or player / group is removed from BG Queue - there is only one player's status changed, so we don't use while(true) cycles to invite whole queue it must be called after fully adding the members of a group to ensure group joining @@ -755,7 +692,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].empty() && m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].empty() ) return; - //battleground with free slot for player should be always in the beggining of the queue // maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level BGFreeSlotQueueType::iterator itr, next; @@ -769,20 +705,16 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve { BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!) // and iterator is invalid - // clear selection pools m_SelectionPools[BG_TEAM_ALLIANCE].Init(); m_SelectionPools[BG_TEAM_HORDE].Init(); - // call a function that does the job for us FillPlayersToBG(bg, queue_id); - // now everything is set, invite players for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr) InviteGroupToBG((*citr), bg, (*citr)->Team); for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr) InviteGroupToBG((*citr), bg, (*citr)->Team); - if (!bg->HasFreeSlots()) { // remove BG from BGFreeSlotQueue @@ -790,9 +722,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve } } } - // finished iterating through the bgs with free slots, maybe we need to create a new bg - BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg_template) { @@ -833,10 +763,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve }*/ } } - m_SelectionPools[BG_TEAM_ALLIANCE].Init(); m_SelectionPools[BG_TEAM_HORDE].Init(); - if (bg_template->isBattleGround()) { //check if there is premade against premade match @@ -860,7 +788,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve m_SelectionPools[BG_TEAM_HORDE].Init(); } } - // now check if there are in queues enough players to start new game of (normal battleground, or non-rated arena) if (!isRated) { @@ -875,7 +802,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } - // invite those selection pools for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) @@ -911,7 +837,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve else if (!front1 && !front2) return; //queues are empty } - //set rating range uint32 arenaMinRating = (arenaRating <= sBattleGroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattleGroundMgr.GetMaxRatingDifference(); uint32 arenaMaxRating = arenaRating + sBattleGroundMgr.GetMaxRatingDifference(); @@ -920,13 +845,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve // the discard time is current_time - time_to_discard, teams that joined after that, will have their ratings taken into account // else leave the discard time on 0, this way all ratings will be discarded uint32 discardTime = getMSTime() - sBattleGroundMgr.GetRatingDiscardTimer(); - // we need to find 2 teams which will play next game - GroupsQueueType::iterator itr_team[BG_TEAMS_COUNT]; - //optimalization : --- we dont need to use selection_pools - each update we select max 2 groups - for(uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++) { // take the group that joined first @@ -979,7 +900,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve } } } - //if we have 2 teams, then start new arena and invite players! if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) { @@ -989,7 +909,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve sLog.outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); return; } - (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamRating; sLog.outDebug("setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamId, (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating); (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamRating; @@ -1009,33 +928,26 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]); itr_team[BG_TEAM_HORDE] = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].begin(); } - InviteGroupToBG(*(itr_team[BG_TEAM_ALLIANCE]), arena, ALLIANCE); InviteGroupToBG(*(itr_team[BG_TEAM_HORDE]), arena, HORDE); - sLog.outDebug("Starting rated arena match!"); - arena->StartBattleGround(); } } } - /*********************************************************/ /*** BATTLEGROUND QUEUE EVENTS ***/ /*********************************************************/ - bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Player* plr = objmgr.GetPlayer( m_PlayerGuid ); // player logged off (we should do nothing, he is correctly removed from queue in another procedure) if (!plr) return true; - BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId); //if battleground ended and its instance deleted - do nothing if (!bg) return true; - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue or in battleground @@ -1054,12 +966,10 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) } return true; //event will be deleted } - void BGQueueInviteEvent::Abort(uint64 /*e_time*/) { //do nothing } - /* this event has many possibilities when it is executed: 1. player is in battleground ( he clicked enter on invitation window ) @@ -1075,11 +985,9 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) if (!plr) // player logged off (we should do nothing, he is correctly removed from queue in another procedure) return true; - BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId); //battleground can be deleted already when we are removing queue info //bg pointer can be NULL! so use it carefully! - uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId); if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue, or in Battleground { @@ -1091,32 +999,26 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) && qMapItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime ) { sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID); - plr->RemoveBattleGroundQueueId(m_BgQueueTypeId); sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].RemovePlayer(m_PlayerGuid, true); //update queues if battleground isn't ended if (bg) sBattleGroundMgr.ScheduleQueueUpdate(m_BgQueueTypeId, m_BgTypeId, bg->GetQueueId()); - WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); plr->GetSession()->SendPacket(&data); } } - //event will be deleted return true; } - void BGQueueRemoveEvent::Abort(uint64 /*e_time*/) { //do nothing } - /*********************************************************/ /*** BATTLEGROUND MANAGER ***/ /*********************************************************/ - BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false) { for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++) @@ -1124,12 +1026,10 @@ BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTe m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); m_Testing=false; } - BattleGroundMgr::~BattleGroundMgr() { DeleteAllBattleGrounds(); } - void BattleGroundMgr::DeleteAllBattleGrounds() { for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++) @@ -1143,7 +1043,6 @@ void BattleGroundMgr::DeleteAllBattleGrounds() delete bg; } } - // destroy template battlegrounds that listed only in queues (other already terminated) for(uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId) { @@ -1152,7 +1051,6 @@ void BattleGroundMgr::DeleteAllBattleGrounds() delete BGFreeSlotQueue[bgTypeId].front(); } } - // used to update running battlegrounds, and delete finished ones void BattleGroundMgr::Update(uint32 diff) { @@ -1180,7 +1078,6 @@ void BattleGroundMgr::Update(uint32 diff) } } } - // update scheduled queues if (!m_QueueUpdateScheduler.empty()) { @@ -1198,7 +1095,6 @@ void BattleGroundMgr::Update(uint32 diff) m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id); } } - // if rating difference counts, maybe force-update queues if (sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER)) { @@ -1234,11 +1130,9 @@ void BattleGroundMgr::Update(uint32 diff) m_AutoDistributionTimeChecker -= diff; } } - void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype) { // we can be in 3 queues in same time... - if (StatusID == 0 || !bg) { data->Initialize(SMSG_BATTLEFIELD_STATUS, 4*3); @@ -1246,7 +1140,6 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro *data << uint64(0); return; } - data->Initialize(SMSG_BATTLEFIELD_STATUS, (4+1+1+4+2+4+1+4+4+4)); *data << uint32(QueueSlot); // queue id (0...2) - player can be in 3 queues in time // uint64 in client @@ -1295,15 +1188,12 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro *data << uint8(0); break; } - if (bg->isArena() && (StatusID == STATUS_WAIT_QUEUE)) *data << uint32(BATTLEGROUND_AA); // all arenas I don't think so. else *data << uint32(bg->GetTypeID()); // BG id from DBC - *data << uint16(0x1F90); // unk value 8080 *data << uint32(bg->GetInstanceID()); // instance id - *data << uint8(bg->isArena()); // minimap-icon 0=faction 1=arena */ *data << uint32(StatusID); // status @@ -1328,14 +1218,12 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro break; } } - void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) { uint8 type = (bg->isArena() ? 1 : 0); // last check on 3.0.3 data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize())); *data << uint8(type); // type (battleground=0/arena=1) - if(type) // arena { // it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H @@ -1356,7 +1244,6 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) *data << (uint8)0; } } - if (bg->GetStatus() != STATUS_WAIT_LEAVE) { *data << uint8(0); // bg not ended @@ -1366,9 +1253,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) *data << uint8(1); // bg ended *data << uint8(bg->GetWinner()); // who win } - *data << (int32)(bg->GetPlayerScoresSize()); - for(BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr) { *data << (uint64)itr->first; @@ -1432,7 +1317,6 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) } } } - void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId) { /*bgTypeId is: @@ -1447,32 +1331,27 @@ void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, Batt data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4); *data << uint32(bgTypeId); } - void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value) { data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4); *data << uint32(field); *data << uint32(value); } - void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid) { data->Initialize(SMSG_PLAY_SOUND, 4); *data << uint32(soundid); } - void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8); *data << uint64(guid); } - void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8); *data << uint64(plr->GetGUID()); } - BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId) { //cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from @@ -1480,10 +1359,8 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst BattleGround* bg = GetBattleGroundTemplate(bgTypeId); if (!bg) return NULL; - if (bg->isArena()) return GetBattleGround(instanceId, bgTypeId); - for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr) { if (itr->second->GetClientInstanceID() == instanceId) @@ -1491,7 +1368,6 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst } return NULL; } - BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId) { if (!InstanceID) @@ -1511,18 +1387,15 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT itr = m_BattleGrounds[bgTypeId].find(InstanceID); return ( (itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL ); } - BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId) { //map is sorted and we can be sure that lowest instance id has only BG template return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second; } - uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) { if (IsArenaType(bgTypeId)) return 0; //arenas don't have client-instanceids - // we create here an instanceid, which is just for // displaying this to the client and without any other use.. // the client-instanceIds are unique for each battleground-type @@ -1539,7 +1412,6 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI m_ClientBattleGroundIds[bgTypeId][queue_id].insert(lastId + 1); return lastId + 1; } - // create a new battleground that will really be used to play BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType, bool isRated) { @@ -1550,7 +1422,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId); return NULL; } - //for arenas there is random map used if (bg_template->isArena()) { @@ -1564,7 +1435,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI return NULL; } } - BattleGround *bg = NULL; // create a copy of the BG template switch(bgTypeId) @@ -1606,23 +1476,18 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI //error, but it is handled few lines above return 0; } - // generate a new instance id bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id bg->SetClientInstanceID(CreateClientVisibleInstanceId(bgTypeId, queue_id)); - // reset the new bg (set status to status_wait_queue from status_none) bg->Reset(); - // start the joining of the bg bg->SetStatus(STATUS_WAIT_JOIN); bg->SetQueueId(queue_id); bg->SetArenaType(arenaType); bg->SetRated(isRated); - return bg; } - // used to create the BG templates uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) { @@ -1643,7 +1508,6 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA case BATTLEGROUND_RV: bg = new BattleGroundRV; break; default:bg = new BattleGround; break; // placeholder for non implemented BG } - bg->SetMapId(MapID); bg->SetTypeID(bgTypeId); bg->SetInstanceID(0); @@ -1656,14 +1520,11 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO); bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO); bg->SetLevelRange(LevelMin, LevelMax); - // add bg to update list AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); - // return some not-null value, bgTypeId is good enough for me return bgTypeId; } - void BattleGroundMgr::CreateInitialBattleGrounds() { float AStartLoc[4]; @@ -1672,32 +1533,23 @@ void BattleGroundMgr::CreateInitialBattleGrounds() BattlemasterListEntry const *bl; WorldSafeLocsEntry const *start; bool IsArena; - uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template"); - if (!result) { barGoLink bar(1); - bar.step(); - sLog.outString(); sLog.outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); return; } - barGoLink bar(result->GetRowCount()); - do { Field *fields = result->Fetch(); bar.step(); - uint32 bgTypeID_ = fields[0].GetUInt32(); - // can be overwrite by values from DB bl = sBattlemasterListStore.LookupEntry(bgTypeID_); if (!bl) @@ -1705,9 +1557,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_); continue; } - BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_); - IsArena = (bl->type == TYPE_ARENA); MinPlayersPerTeam = fields[1].GetUInt32(); MaxPlayersPerTeam = fields[2].GetUInt32(); @@ -1724,9 +1574,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() MinLvl = bl->minlvl; MaxLvl = bl->maxlvl; } - start1 = fields[5].GetUInt32(); - start = sWorldSafeLocsStore.LookupEntry(start1); if (start) { @@ -1747,9 +1595,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", bgTypeID, start1); continue; } - start2 = fields[7].GetUInt32(); - start = sWorldSafeLocsStore.LookupEntry(start2); if (start) { @@ -1770,20 +1616,15 @@ void BattleGroundMgr::CreateInitialBattleGrounds() sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", bgTypeID, start2); continue; } - //sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl); if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3])) continue; - ++count; } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString( ">> Loaded %u battlegrounds", count ); } - void BattleGroundMgr::InitAutomaticArenaPointDistribution() { if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) @@ -1804,22 +1645,17 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() sLog.outDebug("Automatic Arena Point Distribution initialized."); } } - void BattleGroundMgr::DistributeArenaPoints() { // used to distribute arena points based on last week's stats sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_START); - sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START); - //temporary structure for storing maximum points to add values for all players std::map PlayerPoints; - //at first update all points for all team members for(ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr) if (ArenaTeam * at = team_itr->second) at->UpdateArenaPointsHelper(PlayerPoints); - //cycle that gives points to all players for (std::map::iterator plr_itr = PlayerPoints.begin(); plr_itr != PlayerPoints.end(); ++plr_itr) { @@ -1837,11 +1673,8 @@ void BattleGroundMgr::DistributeArenaPoints() std::min(int32(plr_itr->second),int32(sWorld.getConfig(CONFIG_MAX_ARENA_POINTS)))); } } - PlayerPoints.clear(); - sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END); - sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START); for(ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr) { @@ -1852,20 +1685,15 @@ void BattleGroundMgr::DistributeArenaPoints() at->NotifyStatsChanged(); // notify the players of the changes } } - sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END); - sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END); } - void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere) { if (!plr) return; - uint32 PlayerLevel = 10; PlayerLevel = plr->getLevel(); - data->Initialize(SMSG_BATTLEFIELD_LIST); *data << uint64(guid); // battlemaster guid *data << uint8(fromWhere); // from where you joined @@ -1878,11 +1706,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6 else // battleground { *data << uint8(0x00); // unk, different for each bg type - size_t count_pos = data->wpos(); uint32 count = 0; *data << uint32(0x00); // number of bg instances - uint32 queue_id = plr->GetBattleGroundQueueIdFromLevel(bgTypeId); for(std::set::iterator itr = m_ClientBattleGroundIds[bgTypeId][queue_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][queue_id].end();++itr) { @@ -1892,7 +1718,6 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6 data->put( count_pos , count); } } - void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId) { BattleGround *bg = GetBattleGround(instanceId, bgTypeId); @@ -1904,7 +1729,6 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGr if (team==0) team = pl->GetTeam(); bg->GetTeamStartLoc(team, x, y, z, O); - sLog.outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O); pl->TeleportTo(mapid, x, y, z, O); } @@ -1913,7 +1737,6 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGr sLog.outError("player %u trying to port to non-existent bg instance %u",pl->GetGUIDLow(), instanceId); } } - void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid) { WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); @@ -1923,7 +1746,6 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround * data << guid << time_; pl->GetSession()->SendPacket(&data); } - bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) { return ( bgTypeId == BATTLEGROUND_AA || @@ -1931,7 +1753,6 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) bgTypeId == BATTLEGROUND_NA || bgTypeId == BATTLEGROUND_RL ); } - BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType) { switch(bgTypeId) @@ -1967,7 +1788,6 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType return BATTLEGROUND_QUEUE_NONE; } } - BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId) { switch(bgQueueTypeId) @@ -1990,7 +1810,6 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue return BattleGroundTypeId(0); // used for unknown template (it existed and do nothing) } } - uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId) { switch(bgQueueTypeId) @@ -2005,7 +1824,6 @@ uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId) return 0; } } - void BattleGroundMgr::ToggleTesting() { m_Testing = !m_Testing; @@ -2014,7 +1832,6 @@ void BattleGroundMgr::ToggleTesting() else sWorld.SendWorldText(LANG_DEBUG_BG_OFF); } - void BattleGroundMgr::ToggleArenaTesting() { m_ArenaTesting = !m_ArenaTesting; @@ -2023,7 +1840,6 @@ void BattleGroundMgr::ToggleArenaTesting() else sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF); } - void BattleGroundMgr::SetHolidayWeekends(uint32 mask) { for(uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype) @@ -2034,7 +1850,6 @@ void BattleGroundMgr::SetHolidayWeekends(uint32 mask) } } } - void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) { //This method must be atomic, TODO add mutex @@ -2052,7 +1867,6 @@ void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, if (!found) m_QueueUpdateScheduler.push_back(schedule_id); } - uint32 BattleGroundMgr::GetMaxRatingDifference() const { // this is for stupid people who can't use brain and set max rating difference to 0 @@ -2061,44 +1875,33 @@ uint32 BattleGroundMgr::GetMaxRatingDifference() const diff = 5000; return diff; } - uint32 BattleGroundMgr::GetRatingDiscardTimer() const { return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); } - uint32 BattleGroundMgr::GetPrematureFinishTime() const { return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER); } - void BattleGroundMgr::LoadBattleMastersEntry() { mBattleMastersMap.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" ); - uint32 count = 0; - if (!result) { barGoLink bar( 1 ); bar.step(); - sLog.outString(); sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); return; } - barGoLink bar( result->GetRowCount() ); - do { ++count; bar.step(); - Field *fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); uint32 bgTypeId = fields[1].GetUInt32(); if (!sBattlemasterListStore.LookupEntry(bgTypeId)) @@ -2106,13 +1909,9 @@ void BattleGroundMgr::LoadBattleMastersEntry() sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); continue; } - mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId); - } while( result->NextRow() ); - delete result; - sLog.outString(); sLog.outString( ">> Loaded %u battlemaster entries", count ); } diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 9100142ebd0..2de067d3639 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -17,32 +17,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUNDMGR_H #define __BATTLEGROUNDMGR_H - #include "Common.h" #include "Policies/Singleton.h" - #include "BattleGround.h" - typedef std::map BattleGroundSet; - //this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears typedef std::list BGFreeSlotQueueType; - typedef UNORDERED_MAP BattleMastersMap; - #define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day #define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10 - struct GroupQueueInfo; // type predefinition struct PlayerQueueInfo // stores information for players in queue { uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo }; - struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!) { std::map Players; // player queue info map @@ -57,7 +48,6 @@ struct GroupQueueInfo // stores informatio uint32 ArenaTeamRating; // if rated match, inited to the rating of the team uint32 OpponentsTeamRating; // for rated arena matches }; - enum BattleGroundQueueGroupTypes { BG_QUEUE_PREMADE_ALLIANCE = 0, @@ -66,16 +56,13 @@ enum BattleGroundQueueGroupTypes BG_QUEUE_NORMAL_HORDE = 3 }; #define BG_QUEUE_GROUP_TYPES_COUNT 4 - class BattleGround; class BattleGroundQueue { public: BattleGroundQueue(); ~BattleGroundQueue(); - void Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0); - void FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id); bool CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam); bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 minPlayers, uint32 maxPlayers); @@ -85,16 +72,12 @@ class BattleGroundQueue void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); - void DecreaseGroupLength(uint32 queueId, uint32 AsGroup); void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue); - typedef std::map QueuedPlayersMap; QueuedPlayersMap m_QueuedPlayers; - //we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well typedef std::list GroupsQueueType; - /* This two dimensional array is used to store All queued groups First dimension specifies the bgTypeId @@ -105,7 +88,6 @@ class BattleGroundQueue BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches */ GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_QUEUES][BG_QUEUE_GROUP_TYPES_COUNT]; - // class to select and invite groups to bg class SelectionPool { @@ -119,18 +101,14 @@ class BattleGroundQueue private: uint32 PlayerCount; }; - //one selection pool for horde, other one for alliance SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; - private: - bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side); uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES]; uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES]; }; - /* This class is used to invite player to BG again, when minute lasts from his first invitation it is capable to solve all possibilities @@ -143,7 +121,6 @@ class BGQueueInviteEvent : public BasicEvent { }; virtual ~BGQueueInviteEvent() {}; - virtual bool Execute(uint64 e_time, uint32 p_time); virtual void Abort(uint64 e_time); private: @@ -152,7 +129,6 @@ class BGQueueInviteEvent : public BasicEvent BattleGroundTypeId m_BgTypeId; uint32 m_RemoveTime; }; - /* This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation We must store removeInvite time in case player left queue and joined and is invited again @@ -164,9 +140,7 @@ class BGQueueRemoveEvent : public BasicEvent BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId) {} - virtual ~BGQueueRemoveEvent() {} - virtual bool Execute(uint64 e_time, uint32 p_time); virtual void Abort(uint64 e_time); private: @@ -176,7 +150,6 @@ class BGQueueRemoveEvent : public BasicEvent BattleGroundTypeId m_BgTypeId; BattleGroundQueueTypeId m_BgQueueTypeId; }; - class BattleGroundMgr { public: @@ -184,7 +157,6 @@ class BattleGroundMgr BattleGroundMgr(); ~BattleGroundMgr(); void Update(uint32 diff); - /* Packet Building */ void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr); void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid); @@ -195,41 +167,30 @@ class BattleGroundMgr void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype); void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid); void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid); - /* Battlegrounds */ BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId); BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown - BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType, bool isRated); - uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); - void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; }; void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); } uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); - void CreateInitialBattleGrounds(); void DeleteAllBattleGrounds(); - void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId); - /* Battleground queues */ //these queues are instantiated when creating BattlegroundMrg BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code - BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; - void ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); uint32 GetMaxRatingDifference() const; uint32 GetRatingDiscardTimer() const; uint32 GetPrematureFinishTime() const; - void InitAutomaticArenaPointDistribution(); void DistributeArenaPoints(); void ToggleArenaTesting(); void ToggleTesting(); - void SetHolidayWeekends(uint32 mask); void LoadBattleMastersEntry(); BattleGroundTypeId GetBattleMasterBG(uint32 entry) const @@ -239,20 +200,16 @@ class BattleGroundMgr return itr->second; return BATTLEGROUND_WS; } - bool isArenaTesting() const { return m_ArenaTesting; } bool isTesting() const { return m_Testing; } - static bool IsArenaType(BattleGroundTypeId bgTypeId); static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); } static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType); static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId); static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId); - static bool IsBGWeekend(BattleGroundTypeId bgTypeId); private: BattleMastersMap mBattleMastersMap; - /* Battlegrounds */ BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; std::vectorm_QueueUpdateScheduler; @@ -263,7 +220,6 @@ class BattleGroundMgr bool m_ArenaTesting; bool m_Testing; }; - #define sBattleGroundMgr Trinity::Singleton::Instance() #endif diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index 92e71c1c283..b9f85117f1a 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundNA.h" #include "Language.h" @@ -25,11 +24,9 @@ #include "ObjectMgr.h" #include "Player.h" #include "WorldPacket.h" - BattleGroundNA::BattleGroundNA() { m_BgObjects.resize(BG_NA_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -40,90 +37,69 @@ BattleGroundNA::BattleGroundNA() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundNA::~BattleGroundNA() { - } - void BattleGroundNA::Update(uint32 diff) { BattleGround::Update(diff); - /*if (GetStatus() == STATUS_IN_PROGRESS) { // update something }*/ } - void BattleGroundNA::StartingEventCloseDoors() { for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } - void BattleGroundNA::StartingEventOpenDoors() { for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } - void BattleGroundNA::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundNAScore* sc = new BattleGroundNAScore; - m_PlayerScores[plr->GetGUID()] = sc; - UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE)); } - void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; - UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; - if (!killer) { sLog.outError("BattleGroundNA: Killer player not found"); return; } - BattleGround::HandleKillPlayer(player,killer); - UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - bool BattleGroundNA::HandlePlayerUnderMap(Player *player) { player->TeleportTo(GetMapId(),4055.504395,2919.660645,13.611241,player->GetOrientation(),false); return true; } - void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; - //uint32 SpellId = 0; //uint64 buff_guid = 0; switch(Trigger) @@ -136,24 +112,20 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger) Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } - //if (buff_guid) // HandleTriggerBuff(buff_guid,Source); } - void BattleGroundNA::FillInitialWorldStates(WorldPacket &data) { data << uint32(0xa0f) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 data << uint32(0xa10) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 data << uint32(0xa11) << uint32(1); // 9 } - void BattleGroundNA::Reset() { //call parent's class reset BattleGround::Reset(); } - bool BattleGroundNA::SetupBattleGround() { // gates @@ -168,10 +140,8 @@ bool BattleGroundNA::SetupBattleGround() sLog.outErrorDb("BatteGroundNA: Failed to spawn some object!"); return false; } - return true; } - /* 20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r........... diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h index 56e2cf373c4..00d2e554d7e 100644 --- a/src/game/BattleGroundNA.h +++ b/src/game/BattleGroundNA.h @@ -19,9 +19,7 @@ */ #ifndef __BATTLEGROUNDNA_H #define __BATTLEGROUNDNA_H - class BattleGround; - enum BattleGroundNAObjectTypes { BG_NA_OBJECT_DOOR_1 = 0, @@ -32,7 +30,6 @@ enum BattleGroundNAObjectTypes BG_NA_OBJECT_BUFF_2 = 5, BG_NA_OBJECT_MAX = 6 }; - enum BattleGroundNAObjects { BG_NA_OBJECT_TYPE_DOOR_1 = 183978, @@ -42,7 +39,6 @@ enum BattleGroundNAObjects BG_NA_OBJECT_TYPE_BUFF_1 = 184663, BG_NA_OBJECT_TYPE_BUFF_2 = 184664 }; - class BattleGroundNAScore : public BattleGroundScore { public: @@ -50,21 +46,17 @@ class BattleGroundNAScore : public BattleGroundScore virtual ~BattleGroundNAScore() {}; //TODO fix me }; - class BattleGroundNA : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundNA(); ~BattleGroundNA(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index b9f9943bbf2..c4ca4b1b66f 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundRL.h" #include "Language.h" @@ -26,11 +25,9 @@ #include "ObjectMgr.h" #include "Player.h" #include "WorldPacket.h" - BattleGroundRL::BattleGroundRL() { m_BgObjects.resize(BG_RL_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -41,91 +38,70 @@ BattleGroundRL::BattleGroundRL() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundRL::~BattleGroundRL() { - } - void BattleGroundRL::Update(uint32 diff) { BattleGround::Update(diff); - /*if (GetStatus() == STATUS_IN_PROGRESS) { // update something }*/ } - void BattleGroundRL::StartingEventCloseDoors() { for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } - void BattleGroundRL::StartingEventOpenDoors() { for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } - void BattleGroundRL::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundRLScore* sc = new BattleGroundRLScore; - m_PlayerScores[plr->GetGUID()] = sc; - UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); } - void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; - UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; - if (!killer) { sLog.outError("Killer player not found"); return; } - BattleGround::HandleKillPlayer(player,killer); - UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); - CheckArenaWinConditions(); } - bool BattleGroundRL::HandlePlayerUnderMap(Player *player) { player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false); return true; } - void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) return; - //uint32 SpellId = 0; //uint64 buff_guid = 0; switch(Trigger) @@ -138,24 +114,20 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger) Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } - //if (buff_guid) // HandleTriggerBuff(buff_guid,Source); } - void BattleGroundRL::FillInitialWorldStates(WorldPacket &data) { data << uint32(0xbb8) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 data << uint32(0xbb9) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 data << uint32(0xbba) << uint32(1); // 9 } - void BattleGroundRL::Reset() { //call parent's reset BattleGround::Reset(); } - bool BattleGroundRL::SetupBattleGround() { // gates @@ -168,10 +140,8 @@ bool BattleGroundRL::SetupBattleGround() sLog.outErrorDb("BatteGroundRL: Failed to spawn some object!"); return false; } - return true; } - /* Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86 0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <............... diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h index 772c9dd0879..7fb7ef60c2d 100644 --- a/src/game/BattleGroundRL.h +++ b/src/game/BattleGroundRL.h @@ -19,9 +19,7 @@ */ #ifndef __BATTLEGROUNDRL_H #define __BATTLEGROUNDRL_H - class BattleGround; - enum BattleGroundRLObjectTypes { BG_RL_OBJECT_DOOR_1 = 0, @@ -30,7 +28,6 @@ enum BattleGroundRLObjectTypes BG_RL_OBJECT_BUFF_2 = 3, BG_RL_OBJECT_MAX = 4 }; - enum BattleGroundRLObjects { BG_RL_OBJECT_TYPE_DOOR_1 = 185918, @@ -38,7 +35,6 @@ enum BattleGroundRLObjects BG_RL_OBJECT_TYPE_BUFF_1 = 184663, BG_RL_OBJECT_TYPE_BUFF_2 = 184664 }; - class BattleGroundRLScore : public BattleGroundScore { public: @@ -46,23 +42,19 @@ class BattleGroundRLScore : public BattleGroundScore virtual ~BattleGroundRLScore() {}; //TODO fix me }; - class BattleGroundRL : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundRL(); ~BattleGroundRL(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); diff --git a/src/game/BattleGroundRV.cpp b/src/game/BattleGroundRV.cpp index 54070961018..a0fc8377eaf 100644 --- a/src/game/BattleGroundRV.cpp +++ b/src/game/BattleGroundRV.cpp @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundRV.h" #include "Language.h" #include "Player.h" - BattleGroundRV::BattleGroundRV() { - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -34,47 +31,36 @@ BattleGroundRV::BattleGroundRV() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } - BattleGroundRV::~BattleGroundRV() { - } - void BattleGroundRV::Update(uint32 diff) { BattleGround::Update(diff); } - void BattleGroundRV::StartingEventCloseDoors() { } - void BattleGroundRV::StartingEventOpenDoors() { } - void BattleGroundRV::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundRVScore* sc = new BattleGroundRVScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) { } - void BattleGroundRV::HandleKillPlayer(Player* player, Player* killer) { BattleGround::HandleKillPlayer(player, killer); } - void BattleGroundRV::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) { } - bool BattleGroundRV::SetupBattleGround() { return true; diff --git a/src/game/BattleGroundRV.h b/src/game/BattleGroundRV.h index e3e94baf101..4cfa8940bc3 100644 --- a/src/game/BattleGroundRV.h +++ b/src/game/BattleGroundRV.h @@ -17,9 +17,7 @@ */ #ifndef __BATTLEGROUNDRV_H #define __BATTLEGROUNDRV_H - class BattleGround; - class BattleGroundRVScore : public BattleGroundScore { public: @@ -27,21 +25,17 @@ class BattleGroundRVScore : public BattleGroundScore virtual ~BattleGroundRVScore() {}; //TODO fix me }; - class BattleGroundRV : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundRV(); ~BattleGroundRV(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index acf16ad3af0..ce5688b7706 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -15,12 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundSA.h" #include "Language.h" #include "Player.h" - BattleGroundSA::BattleGroundSA() { //TODO FIX ME! @@ -29,52 +27,39 @@ BattleGroundSA::BattleGroundSA() m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; } - BattleGroundSA::~BattleGroundSA() { - } - void BattleGroundSA::Update(uint32 diff) { BattleGround::Update(diff); } - void BattleGroundSA::StartingEventCloseDoors() { } - void BattleGroundSA::StartingEventOpenDoors() { } - void BattleGroundSA::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundSAScore* sc = new BattleGroundSAScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) { - } - void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) return; } - void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found... return; - BattleGround::UpdatePlayerScore(Source,type,value); } diff --git a/src/game/BattleGroundSA.h b/src/game/BattleGroundSA.h index 3ba23d02656..81b87b6e3e7 100644 --- a/src/game/BattleGroundSA.h +++ b/src/game/BattleGroundSA.h @@ -15,40 +15,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUNDSA_H #define __BATTLEGROUNDSA_H - class BattleGround; - class BattleGroundSAScore : public BattleGroundScore { public: BattleGroundSAScore() {}; virtual ~BattleGroundSAScore() {}; }; - class BattleGroundSA : public BattleGround { friend class BattleGroundMgr; - public: BattleGroundSA(); ~BattleGroundSA(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); //bool SetupBattleGround(); - /* Scorekeeping */ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - private: }; #endif diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index ec19308e71f..5edae297872 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "BattleGround.h" #include "BattleGroundWS.h" #include "Creature.h" @@ -29,7 +28,6 @@ #include "Player.h" #include "World.h" #include "WorldPacket.h" - // these variables aren't used outside of this file, so declare them only here enum BG_WSG_Rewards { @@ -38,42 +36,34 @@ enum BG_WSG_Rewards BG_WSG_MAP_COMPLETE, BG_WSG_REWARD_NUM }; - uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { {20,40,40}, // normal honor {60,40,80} // holiday }; - uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { {0,35,0}, // normal honor {0,45,0} // holiday }; - BattleGroundWS::BattleGroundWS() { m_BgObjects.resize(BG_WS_OBJECT_MAX); m_BgCreatures.resize(BG_CREATURES_MAX_WS); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; } - BattleGroundWS::~BattleGroundWS() { } - void BattleGroundWS::Update(uint32 diff) { BattleGround::Update(diff); - if (GetStatus() == STATUS_IN_PROGRESS) { if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff; - if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0) { m_FlagsTimer[BG_TEAM_ALLIANCE] = 0; @@ -83,7 +73,6 @@ void BattleGroundWS::Update(uint32 diff) if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) { m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff; - if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0) { m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0; @@ -94,7 +83,6 @@ void BattleGroundWS::Update(uint32 diff) if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { m_FlagsTimer[BG_TEAM_HORDE] -= diff; - if (m_FlagsTimer[BG_TEAM_HORDE] < 0) { m_FlagsTimer[BG_TEAM_HORDE] = 0; @@ -104,7 +92,6 @@ void BattleGroundWS::Update(uint32 diff) if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) { m_FlagsDropTimer[BG_TEAM_HORDE] -= diff; - if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0) { m_FlagsDropTimer[BG_TEAM_HORDE] = 0; @@ -145,7 +132,6 @@ void BattleGroundWS::Update(uint32 diff) } } } - void BattleGroundWS::StartingEventCloseDoors() { for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) @@ -156,32 +142,26 @@ void BattleGroundWS::StartingEventCloseDoors() for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); } - void BattleGroundWS::StartingEventOpenDoors() { for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i) DoorOpen(i); for(uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i) DoorOpen(i); - SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); - for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } - void BattleGroundWS::AddPlayer(Player *plr) { BattleGround::AddPlayer(plr); //create score and add it to map, default values are set in constructor BattleGroundWGScore* sc = new BattleGroundWGScore; - m_PlayerScores[plr->GetGUID()] = sc; } - void BattleGroundWS::RespawnFlag(uint32 Team, bool captured) { if (Team == ALLIANCE) @@ -194,7 +174,6 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured) sLog.outDebug("Respawn Horde flag"); m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; } - if (captured) { //when map_update will be allowed for battlegrounds this code will be useless @@ -205,12 +184,10 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured) } m_BothFlagsKept = false; } - void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) { if (GetStatus() != STATUS_IN_PROGRESS) return; - RespawnFlag(team,false); if (team == ALLIANCE) { @@ -222,26 +199,20 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); } - PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); - GameObject *obj = HashMapHolder::Find(GetDroppedFlagGUID(team)); if (obj) obj->Delete(); else sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team))); - SetDroppedFlagGUID(0,team); m_BothFlagsKept = false; } - void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) { if (GetStatus() != STATUS_IN_PROGRESS) return; - uint32 winner = 0; - Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (Source->GetTeam() == ALLIANCE) { @@ -281,33 +252,26 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) } //for flag capture is reward 2 honorable kills RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam()); - SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME); SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); - if (Source->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); else SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source); - UpdateFlagState(Source->GetTeam(), 1); // flag state none UpdateTeamScore(Source->GetTeam()); // only flag capture should be updated UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures - if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; - if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE) winner = HORDE; - if (winner) { UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); - RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner); EndBattleGround(winner); } @@ -316,7 +280,6 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; } } - void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) { if (GetStatus() != STATUS_IN_PROGRESS) @@ -345,9 +308,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) } return; } - bool set = false; - if (Source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) @@ -382,12 +343,10 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) set = true; } } - if (set) { Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); UpdateFlagState(Source->GetTeam(), 1); - if (Source->GetTeam() == ALLIANCE) { SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source); @@ -398,19 +357,15 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } - m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; } } - void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) return; - int32 message_id = 0; ChatMsg type; - //alliance flag picked up from base if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) @@ -428,7 +383,6 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target if(m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) m_BothFlagsKept = true; } - //horde flag picked up from base if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) @@ -446,7 +400,6 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target if(m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) m_BothFlagsKept = true; } - //Alliance flag on ground(not in base) (returned or picked up again from ground!) if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { @@ -480,7 +433,6 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target //called in HandleGameObjectUseOpcode: //target_obj->Delete(); } - //Horde flag on ground(not in base) (returned or picked up again) if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { @@ -514,14 +466,11 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target //called in HandleGameObjectUseOpcode: //target_obj->Delete(); } - if (!message_id) return; - SendMessageToAll(message_id, type, Source); Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } - void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) { // sometimes flag aura not removed :( @@ -548,7 +497,6 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) this->EventPlayerDroppedFlag(plr); } } - void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value) { if (team == ALLIANCE) @@ -556,7 +504,6 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value) else UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); } - void BattleGroundWS::UpdateTeamScore(uint32 team) { if (team == ALLIANCE) @@ -564,13 +511,11 @@ void BattleGroundWS::UpdateTeamScore(uint32 team) else UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team)); } - void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) return; - //uint32 SpellId = 0; //uint64 buff_guid = 0; switch(Trigger) @@ -613,11 +558,9 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger) Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } - //if (buff_guid) // HandleTriggerBuff(buff_guid,Source); } - bool BattleGroundWS::SetupBattleGround() { // flags @@ -647,31 +590,25 @@ bool BattleGroundWS::SetupBattleGround() sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!"); return false; } - WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!"); return false; } - sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!"); return false; } - sLog.outDebug("BatteGroundWS: BG objects and spirit guides spawned"); - return true; } - void BattleGroundWS::Reset() { //call parent's class reset BattleGround::Reset(); - m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; m_FlagKeepers[BG_TEAM_HORDE] = 0; m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; @@ -684,7 +621,6 @@ void BattleGroundWS::Reset() m_ReputationCapture = (isBGWeekend) ? 45 : 35; m_HonorWinKills = (isBGWeekend) ? 3 : 1; m_HonorEndKills = (isBGWeekend) ? 4 : 2; - /* Spirit nodes is static at this BG and then not required deleting at BG reset. if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) DelCreature(WS_SPIRIT_MAIN_ALLIANCE); @@ -692,7 +628,6 @@ void BattleGroundWS::Reset() DelCreature(WS_SPIRIT_MAIN_HORDE); */ } - void BattleGroundWS::EndBattleGround(uint32 winner) { //win reward @@ -703,27 +638,20 @@ void BattleGroundWS::EndBattleGround(uint32 winner) //complete map_end rewards (even if no team wins) RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE); - BattleGround::EndBattleGround(winner); } - void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; - EventPlayerDroppedFlag(player); - BattleGround::HandleKillPlayer(player, killer); } - void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found return; - switch(type) { case SCORE_FLAG_CAPTURES: // flags captured @@ -737,7 +665,6 @@ void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value break; } } - WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player) { //if status in progress, it returns main graveyards with spiritguides @@ -760,37 +687,30 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player) return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); } } - void BattleGroundWS::FillInitialWorldStates(WorldPacket& data) { data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); - if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); else data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1); else data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0); - data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); else data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); - if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); else data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1); - } diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index 16631afecdc..0b616af24b1 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -17,12 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUNDWS_H #define __BATTLEGROUNDWS_H - #include "BattleGround.h" - enum BG_WS_TimerOrScore { BG_WS_MAX_TEAM_SCORE = 3, @@ -31,7 +28,6 @@ enum BG_WS_TimerOrScore BG_WS_SPELL_FORCE_TIME = 600000, BG_WS_SPELL_BRUTAL_TIME = 900000 }; - enum BG_WS_Sound { BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, @@ -42,7 +38,6 @@ enum BG_WS_Sound BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP = 8174, BG_WS_SOUND_FLAGS_RESPAWNED = 8232 }; - enum BG_WS_SpellId { BG_WS_SPELL_WARSONG_FLAG = 23333, @@ -52,7 +47,6 @@ enum BG_WS_SpellId BG_WS_SPELL_FOCUSED_ASSAULT = 46392, BG_WS_SPELL_BRUTAL_ASSAULT = 46393 }; - enum BG_WS_WorldStates { BG_WS_FLAG_UNK_ALLIANCE = 1545, @@ -64,7 +58,6 @@ enum BG_WS_WorldStates BG_WS_FLAG_STATE_HORDE = 2338, BG_WS_FLAG_STATE_ALLIANCE = 2339 }; - enum BG_WS_ObjectTypes { BG_WS_OBJECT_DOOR_A_1 = 0, @@ -87,7 +80,6 @@ enum BG_WS_ObjectTypes BG_WS_OBJECT_BERSERKBUFF_2 = 17, BG_WS_OBJECT_MAX = 18 }; - enum BG_WS_ObjectEntry { BG_OBJECT_DOOR_A_1_WS_ENTRY = 179918, @@ -105,7 +97,6 @@ enum BG_WS_ObjectEntry BG_OBJECT_A_FLAG_GROUND_WS_ENTRY = 179785, BG_OBJECT_H_FLAG_GROUND_WS_ENTRY = 179786 }; - enum BG_WS_FlagState { BG_WS_FLAG_STATE_ON_BASE = 0, @@ -113,7 +104,6 @@ enum BG_WS_FlagState BG_WS_FLAG_STATE_ON_PLAYER = 2, BG_WS_FLAG_STATE_ON_GROUND = 3 }; - enum BG_WS_Graveyards { WS_GRAVEYARD_FLAGROOM_ALLIANCE = 769, @@ -121,21 +111,17 @@ enum BG_WS_Graveyards WS_GRAVEYARD_MAIN_ALLIANCE = 771, WS_GRAVEYARD_MAIN_HORDE = 772 }; - enum BG_WS_CreatureTypes { WS_SPIRIT_MAIN_ALLIANCE = 0, WS_SPIRIT_MAIN_HORDE = 1, - BG_CREATURES_MAX_WS = 2 }; - enum BG_WS_CarrierDebuffs { WS_SPELL_FOCUSED_ASSAULT = 46392, WS_SPELL_BRUTAL_ASSAULT = 46393 }; - class BattleGroundWGScore : public BattleGroundScore { public: @@ -144,22 +130,18 @@ class BattleGroundWGScore : public BattleGroundScore uint32 FlagCaptures; uint32 FlagReturns; }; - class BattleGroundWS : public BattleGround { friend class BattleGroundMgr; - public: /* Construction */ BattleGroundWS(); ~BattleGroundWS(); void Update(uint32 diff); - /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - /* BG Flags */ uint64 GetAllianceFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; } uint64 GetHordeFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_HORDE]; } @@ -174,12 +156,10 @@ class BattleGroundWS : public BattleGround void RemoveTimedAura(uint32 aura); bool IsBrutalTimerDone; bool IsForceTimerDone; - /* Battleground Events */ virtual void EventPlayerDroppedFlag(Player *Source); virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); virtual void EventPlayerCapturedFlag(Player *Source); - void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); void HandleKillPlayer(Player *player, Player *killer); @@ -187,14 +167,12 @@ class BattleGroundWS : public BattleGround virtual void Reset(); void EndBattleGround(uint32 winner); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - void UpdateFlagState(uint32 team, uint32 value); void UpdateTeamScore(uint32 team); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} virtual void FillInitialWorldStates(WorldPacket& data); - /* Scorekeeping */ uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; } void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } @@ -206,7 +184,6 @@ class BattleGroundWS : public BattleGround uint8 m_FlagState[2]; // for checking flag state int32 m_FlagsTimer[2]; int32 m_FlagsDropTimer[2]; - uint32 m_ReputationCapture; uint32 m_HonorWinKills; uint32 m_HonorEndKills; diff --git a/src/game/Calendar.h b/src/game/Calendar.h index 7a86afa7db7..41f75c7aa28 100644 --- a/src/game/Calendar.h +++ b/src/game/Calendar.h @@ -15,12 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef MANGOS_CALENDAR_H #define MANGOS_CALENDAR_H - class Calendar { - }; #endif diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 93d3b7eae26..747f2e9f309 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -15,36 +15,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "WorldPacket.h" #include "WorldSession.h" - #include "InstanceSaveMgr.h" #include "Log.h" #include "Opcodes.h" #include "Player.h" - void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty - time_t cur_time = time(NULL); - WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); - // TODO: calendar invite event output data << (uint32) 0; //invite node count // TODO: calendar event output data << (uint32) 0; //event count - data << (uint32) 0; //wtf?? data << (uint32) secsToTimeBitFields(cur_time); // current time - uint32 counter = 0; size_t p_counter = data.wpos(); data << uint32(counter); // instance save count - for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) { for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) @@ -61,7 +52,6 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) } } data.put(p_counter,counter); - data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00) data << (uint32) 0; // unk counter 4 data << (uint32) 0; // unk counter 5 @@ -69,14 +59,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) //data.hexlike(); SendPacket(&data); } - void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_EVENT"); recv_data.hexlike(); recv_data.read_skip(); // unk } - void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GUILD_FILTER"); @@ -85,24 +73,20 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) recv_data.read_skip(); // unk2 recv_data.read_skip(); // unk3 } - void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_ARENA_TEAM"); recv_data.hexlike(); recv_data.read_skip(); // unk } - void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_ADD_EVENT"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //std::string unk1, unk2; //recv_data >> (std::string)unk1; //recv_data >> (std::string)unk2; - //uint8 unk3, unk4; //uint32 unk5, unk6, unk7, unk8, unk9, count = 0; //recv_data >> (uint8)unk3; @@ -128,13 +112,11 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) // } //} } - void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_UPDATE_EVENT"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> std::string @@ -147,110 +129,88 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) //recv_data >> uint32 //recv_data >> uint32 } - void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_REMOVE_EVENT"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint32 - } - void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_COPY_EVENT"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint32 - } - void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_INVITE"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> std::string //recv_data >> uint8 //recv_data >> uint8 - } - void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_RSVP"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint32 - } - void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data.readPackGUID(guid) //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint64 } - void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_STATUS"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data.readPackGUID(guid) //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint32 } - void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data.readPackGUID(guid) //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint32 } - void WorldSession::HandleCalendarComplain(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_COMPLAIN"); recv_data.hexlike(); recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam - //recv_data >> uint64 //recv_data >> uint64 //recv_data >> uint64 } - void WorldSession::HandleCalendarGetNumPending(WorldPacket & /*recv_data*/) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty - WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); data << uint32(0); // 0 - no pending invites, 1 - some pending invites SendPacket(&data); diff --git a/src/game/Cell.h b/src/game/Cell.h index 9baf4104080..7145df0aacc 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -17,20 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CELL_H #define TRINITY_CELL_H - #include - #include "GameSystem/TypeContainer.h" #include "GameSystem/TypeContainerVisitor.h" - #include "GridDefines.h" - class Map; class WorldObject; - enum District { UPPER_DISTRICT = 1, @@ -44,15 +38,12 @@ enum District LOWER_RIGHT_DISTRICT = (LOWER_DISTRICT | RIGHT_DISTRICT), ALL_DISTRICT = (UPPER_DISTRICT | LOWER_DISTRICT | LEFT_DISTRICT | RIGHT_DISTRICT | CENTER_DISTRICT) }; - template struct CellLock; - struct TRINITY_DLL_DECL CellArea { CellArea() : right_offset(0), left_offset(0), upper_offset(0), lower_offset(0) {} CellArea(int right, int left, int upper, int lower) : right_offset(right), left_offset(left), upper_offset(upper), lower_offset(lower) {} bool operator!() const { return !right_offset && !left_offset && !upper_offset && !lower_offset; } - void ResizeBorders(CellPair& begin_cell, CellPair& end_cell) const { begin_cell << left_offset; @@ -60,20 +51,17 @@ struct TRINITY_DLL_DECL CellArea end_cell >> right_offset; end_cell += upper_offset; } - int right_offset; int left_offset; int upper_offset; int lower_offset; }; - struct TRINITY_DLL_DECL Cell { Cell() { data.All = 0; } Cell(const Cell &cell) { data.All = cell.data.All; } explicit Cell(CellPair const& p); - void operator|=(Cell &cell) { data.Part.reserved = 0; @@ -81,14 +69,12 @@ struct TRINITY_DLL_DECL Cell uint32 x, y, old_x, old_y; Compute(x, y); cell.Compute(old_x, old_y); - if( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1) { data.Part.reserved = ALL_DISTRICT; cell.data.Part.reserved = ALL_DISTRICT; return; } - if( x < old_x ) { data.Part.reserved |= LEFT_DISTRICT; @@ -110,45 +96,38 @@ struct TRINITY_DLL_DECL Cell cell.data.Part.reserved |= UPPER_DISTRICT; } } - void Compute(uint32 &x, uint32 &y) const { x = data.Part.grid_x*MAX_NUMBER_OF_CELLS + data.Part.cell_x; y = data.Part.grid_y*MAX_NUMBER_OF_CELLS + data.Part.cell_y; } - bool DiffCell(const Cell &cell) const { return( data.Part.cell_x != cell.data.Part.cell_x || data.Part.cell_y != cell.data.Part.cell_y ); } - bool DiffGrid(const Cell &cell) const { return( data.Part.grid_x != cell.data.Part.grid_x || data.Part.grid_y != cell.data.Part.grid_y ); } - uint32 CellX() const { return data.Part.cell_x; } uint32 CellY() const { return data.Part.cell_y; } uint32 GridX() const { return data.Part.grid_x; } uint32 GridY() const { return data.Part.grid_y; } bool NoCreate() const { return data.Part.nocreate; } void SetNoCreate() { data.Part.nocreate = 1; } - CellPair cellPair() const { return CellPair( data.Part.grid_x*MAX_NUMBER_OF_CELLS+data.Part.cell_x, data.Part.grid_y*MAX_NUMBER_OF_CELLS+data.Part.cell_y); } - Cell& operator=(const Cell &cell) { this->data.All = cell.data.All; return *this; } - bool operator==(const Cell &cell) const { return (data.All == cell.data.All); } bool operator!=(const Cell &cell) const { return !operator==(cell); } union @@ -164,17 +143,13 @@ struct TRINITY_DLL_DECL Cell } Part; uint32 All; } data; - template void Visit(const CellLock &, TypeContainerVisitor &visitor, Map &) const; template void Visit(const CellLock &, TypeContainerVisitor &visitor, Map &m, const WorldObject &obj, float radius) const; template void Visit(const CellLock &, TypeContainerVisitor &visitor, Map &, float radius, float x_off, float y_off) const; - static CellArea CalculateCellArea(const WorldObject &obj, float radius); - private: template void VisitCircle(const CellLock &, TypeContainerVisitor &, Map &, const CellPair& , const CellPair& ) const; }; - template struct TRINITY_DLL_DECL CellLock { diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h index ff2b0343c69..659ffd48eb6 100644 --- a/src/game/CellImpl.h +++ b/src/game/CellImpl.h @@ -17,16 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CELLIMPL_H #define TRINITY_CELLIMPL_H - #include - #include "Cell.h" #include "Map.h" #include "Object.h" - inline Cell::Cell(CellPair const& p) { data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS; @@ -36,7 +32,6 @@ inline Cell::Cell(CellPair const& p) data.Part.nocreate = 0; data.Part.reserved = 0; } - template inline void Cell::Visit(const CellLock &l, TypeContainerVisitor &visitor, Map &m) const @@ -44,19 +39,16 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi const CellPair &standing_cell = l.i_cellPair; if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; - uint16 district = (District)this->data.Part.reserved; if(district == CENTER_DISTRICT) { m.Visit(l, visitor); return; } - // set up the cell range based on the district // the overloaded operators handle range checking CellPair begin_cell = standing_cell; CellPair end_cell = standing_cell; - switch( district ) { case ALL_DISTRICT: @@ -117,7 +109,6 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi break; } } - // loop the cell range for(uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++) { @@ -131,7 +122,6 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi } } } - template inline void Cell::Visit(const CellLock &l, TypeContainerVisitor &visitor, Map &m, float radius, float x_off, float y_off) const @@ -139,9 +129,7 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi const CellPair &standing_cell = l.i_cellPair; if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; - int left = 0, right = 0, upper = 0, lower = 0; - // Origin = (CENTER_GRID_CELL_OFFSET, CENTER_GRID_CELL_OFFSET) if(CENTER_GRID_CELL_OFFSET - x_off < radius) ++right; @@ -151,21 +139,17 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi ++upper; if(CENTER_GRID_CELL_OFFSET + y_off < radius) ++lower; - if(!left && !right && !upper && !lower) { m.Visit(l, visitor); return; } - CellPair begin_cell = standing_cell; CellPair end_cell = standing_cell; - begin_cell << left; //note: need change << if left > 1 begin_cell -= lower; end_cell >> right; end_cell += upper; - // loop the cell range for(uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++) { @@ -179,20 +163,16 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi } } } - inline int CellHelper(const float radius) { if(radius < 1.0f) return 0; - return (int)ceilf(radius/SIZE_OF_GRID_CELL); } - inline CellArea Cell::CalculateCellArea(const WorldObject &obj, float radius) { if(radius <= 0.0f) return CellArea(); - //we should increase search radius by object's radius, otherwise //we could have problems with huge creatures, which won't attack nearest players etc radius += obj.GetObjectSize(); @@ -200,23 +180,18 @@ inline CellArea Cell::CalculateCellArea(const WorldObject &obj, float radius) //TODO: add more correct/generic method for this task const float x_offset = (obj.GetPositionX() - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; const float y_offset = (obj.GetPositionY() - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; - const float x_val = floor(x_offset + CENTER_GRID_CELL_ID + 0.5f); const float y_val = floor(y_offset + CENTER_GRID_CELL_ID + 0.5f); - const float x_off = (x_offset - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; const float y_off = (y_offset - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; - const float tmp_diff = radius - CENTER_GRID_CELL_OFFSET; //lets calculate upper/lower/right/left corners for cell search int right = CellHelper(tmp_diff + x_off); int left = CellHelper(tmp_diff - x_off); int upper = CellHelper(tmp_diff + y_off); int lower = CellHelper(tmp_diff - y_off); - return CellArea(right, left, upper, lower); } - template inline void Cell::Visit(const CellLock &l, TypeContainerVisitor &visitor, Map &m, const WorldObject &obj, float radius) const @@ -224,7 +199,6 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi const CellPair &standing_cell = l.i_cellPair; if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; - //no jokes here... Actually placing ASSERT() here was good idea, but //we had some problems with DynamicObjects, which pass radius = 0.0f (DB issue?) //maybe it is better to just return when radius <= 0.0f? @@ -236,7 +210,6 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi //lets limit the upper value for search radius if(radius > 333.0f) radius = 333.0f; - //lets calculate object coord offsets from cell borders. CellArea area = Cell::CalculateCellArea(obj, radius); //if radius fits inside standing cell @@ -245,10 +218,8 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi m.Visit(l, visitor); return; } - CellPair begin_cell = standing_cell; CellPair end_cell = standing_cell; - area.ResizeBorders(begin_cell, end_cell); //visit all cells, found in CalculateCellArea() //if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle @@ -259,11 +230,9 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi VisitCircle(l, visitor, m, begin_cell, end_cell); return; } - //ALWAYS visit standing cell first!!! Since we deal with small radiuses //it is very essential to call visitor for standing cell firstly... m.Visit(l, visitor); - // loop the cell range for(uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++) { @@ -281,7 +250,6 @@ Cell::Visit(const CellLock &l, TypeContainerVisitor &vi } } } - template inline void Cell::VisitCircle(const CellLock &l, TypeContainerVisitor &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const @@ -291,7 +259,6 @@ Cell::VisitCircle(const CellLock &l, TypeContainerVisitor &l, TypeContainerVisitor &l, TypeContainerVisitordata.Part.nocreate; CellLock lock_left(r_zone_left, cell_pair_left); m.Visit(lock_left, visitor); - //right trapezoid cell visit CellPair cell_pair_right(x_end + step, y); Cell r_zone_right(cell_pair_right); diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index 72e35a6e777..5ff403b9484 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -17,12 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Channel.h" #include "ObjectMgr.h" #include "SocialMgr.h" #include "World.h" - Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0) { @@ -33,20 +31,16 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) { channel_id = ch->ChannelID; // built-in channel m_announce = false; // no join/leave announces - m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels - if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel m_flags |= CHANNEL_FLAG_TRADE; - if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels m_flags |= CHANNEL_FLAG_CITY; - if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel m_flags |= CHANNEL_FLAG_LFG; else // for all other channels m_flags |= CHANNEL_FLAG_NOT_LFG; - m_IsSaved = false; + m_IsSaved = false; } else // it's custom channel { @@ -62,9 +56,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) m_moderate = fields[3].GetBool(); m_password = fields[4].GetString(); const char* db_BannedList = fields[5].GetString(); - m_IsSaved = true; - if(db_BannedList) { Tokens tokens = StrSplit(db_BannedList, " "); @@ -87,11 +79,10 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) { sLog.outDebug("New Channel(%s) saved", name.c_str()); m_IsSaved = true; - } + } } } } - void Channel::Join(uint64 p, const char *pass) { WorldPacket data; @@ -104,23 +95,19 @@ void Channel::Join(uint64 p, const char *pass) } return; } - if(IsBanned(p)) { MakeBanned(&data); SendToOne(&data, p); return; } - if(m_password.length() > 0 && strcmp(pass, m_password.c_str())) { MakeWrongPassword(&data); SendToOne(&data, p); return; } - Player *plr = objmgr.GetPlayer(p); - if(plr) { if(HasFlag(CHANNEL_FLAG_LFG) && @@ -131,36 +118,28 @@ void Channel::Join(uint64 p, const char *pass) SendToOne(&data, p); return; } - if(plr->GetGuildId() && (GetFlags() == 0x38)) return; - plr->JoinedChannel(this); } - if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) )) { MakeJoined(&data, p); SendToAll(&data); } - data.clear(); - PlayerInfo pinfo; pinfo.player = p; pinfo.flags = MEMBER_FLAG_NONE; players[p] = pinfo; - MakeYouJoined(&data); SendToOne(&data, p); - JoinNotify(p); - // if no owner first logged will become if(!IsConstant() && !m_ownerGUID) { SetOwner(p, (players.size() > 1 ? true : false)); - players[p].SetModerator(true); + players[p].SetModerator(true); } /* else if(!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() )) @@ -169,7 +148,6 @@ void Channel::Join(uint64 p, const char *pass) players[p].SetModerator(true); }*/ } - void Channel::Leave(uint64 p, bool send) { if(!IsOn(p)) @@ -184,7 +162,6 @@ void Channel::Leave(uint64 p, bool send) else { Player *plr = objmgr.GetPlayer(p); - if(send) { WorldPacket data; @@ -194,9 +171,7 @@ void Channel::Leave(uint64 p, bool send) plr->LeftChannel(this); data.clear(); } - bool changeowner = players[p].IsOwner(); - players.erase(p); if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) )) { @@ -204,9 +179,7 @@ void Channel::Leave(uint64 p, bool send) MakeLeft(&data, p); SendToAll(&data); } - LeaveNotify(p); - if(changeowner) { uint64 newowner = !players.empty() ? players.begin()->second.player : 0; @@ -215,14 +188,12 @@ void Channel::Leave(uint64 p, bool send) } } } - void Channel::KickOrBan(uint64 good, const char *badname, bool ban) { AccountTypes sec = SEC_PLAYER; Player *gplr = objmgr.GetPlayer(good); if(gplr) sec = gplr->GetSession()->GetSecurity(); - if(!IsOn(good)) { WorldPacket data; @@ -253,9 +224,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) else { bool changeowner = (m_ownerGUID == bad->GetGUID()); - WorldPacket data; - if(ban && !IsBanned(bad->GetGUID())) { banned.insert(bad->GetGUID()); @@ -274,17 +243,14 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) BannedList saved", m_name.c_str()); - } + } } - } else MakePlayerKicked(&data, bad->GetGUID(), good); - SendToAll(&data); players.erase(bad->GetGUID()); bad->LeftChannel(this); - if(changeowner) { uint64 newowner = !players.empty() ? good : false; @@ -294,14 +260,12 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) } } } - void Channel::UnBan(uint64 good, const char *badname) { uint32 sec = 0; Player *gplr = objmgr.GetPlayer(good); if(gplr) sec = gplr->GetSession()->GetSecurity(); - if(!IsOn(good)) { WorldPacket data; @@ -326,7 +290,6 @@ void Channel::UnBan(uint64 good, const char *badname) else { banned.erase(bad->GetGUID()); - WorldPacket data; MakePlayerUnbanned(&data, bad->GetGUID(), good); SendToAll(&data); @@ -344,19 +307,17 @@ void Channel::UnBan(uint64 good, const char *badname) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) BannedList saved", m_name.c_str()); - } + } } } } } - void Channel::Password(uint64 p, const char *pass) { uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -372,7 +333,6 @@ void Channel::Password(uint64 p, const char *pass) else { m_password = pass; - WorldPacket data; MakePasswordChanged(&data, p); SendToAll(&data); @@ -383,19 +343,16 @@ void Channel::Password(uint64 p, const char *pass) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) password saved", m_name.c_str()); - } + } } } } - void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) { Player *plr = objmgr.GetPlayer(p); if (!plr) return; - uint32 sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -418,11 +375,9 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) SendToOne(&data, p); return; } - PlayerInfo inf = players[newp->GetGUID()]; if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod) return; - if(!IsOn(newp->GetGUID())) { WorldPacket data; @@ -430,7 +385,6 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) SendToOne(&data, p); return; } - // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team if( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && @@ -441,7 +395,6 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) SendToOne(&data, p); return; } - if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p) { WorldPacket data; @@ -449,22 +402,18 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) SendToOne(&data, p); return; } - if(mod) SetModerator(newp->GetGUID(), set); else SetMute(newp->GetGUID(), set); } } - void Channel::SetOwner(uint64 p, const char *newname) { Player *plr = objmgr.GetPlayer(p); if (!plr) return; - uint32 sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -472,7 +421,6 @@ void Channel::SetOwner(uint64 p, const char *newname) SendToOne(&data, p); return; } - if(sec < SEC_GAMEMASTER && p != m_ownerGUID) { WorldPacket data; @@ -480,7 +428,6 @@ void Channel::SetOwner(uint64 p, const char *newname) SendToOne(&data, p); return; } - Player *newp = objmgr.GetPlayer(newname); if(newp == NULL || !IsOn(newp->GetGUID())) { @@ -489,7 +436,6 @@ void Channel::SetOwner(uint64 p, const char *newname) SendToOne(&data, p); return; } - if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; @@ -497,11 +443,9 @@ void Channel::SetOwner(uint64 p, const char *newname) SendToOne(&data, p); return; } - players[newp->GetGUID()].SetModerator(true); SetOwner(newp->GetGUID()); } - void Channel::SendWhoOwner(uint64 p) { if(!IsOn(p)) @@ -517,11 +461,9 @@ void Channel::SendWhoOwner(uint64 p) SendToOne(&data, p); } } - void Channel::List(Player* player) { uint64 p = player->GetGUID(); - if(!IsOn(p)) { WorldPacket data; @@ -534,17 +476,13 @@ void Channel::List(Player* player) data << uint8(1); // channel type? data << GetName(); // channel name data << uint8(GetFlags()); // channel flags? - size_t pos = data.wpos(); data << uint32(0); // size of list, placeholder - uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); - uint32 count = 0; for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { Player *plr = objmgr.GetPlayer(i->first); - // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) && @@ -555,20 +493,16 @@ void Channel::List(Player* player) ++count; } } - data.put(pos,count); - SendToOne(&data, p); } } - void Channel::Announce(uint64 p) { uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -584,7 +518,6 @@ void Channel::Announce(uint64 p) else { m_announce = !m_announce; - WorldPacket data; if(m_announce) MakeAnnouncementsOn(&data, p); @@ -598,19 +531,16 @@ void Channel::Announce(uint64 p) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) announce saved", m_name.c_str()); - } + } } - } } - void Channel::Moderate(uint64 p) { uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -626,7 +556,6 @@ void Channel::Moderate(uint64 p) else { m_moderate = !m_moderate; - WorldPacket data; if(m_moderate) MakeModerationOn(&data, p); @@ -640,23 +569,20 @@ void Channel::Moderate(uint64 p) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) moderate saved", m_name.c_str()); - } + } } } } - void Channel::Say(uint64 p, const char *what, uint32 lang) { if(!what) return; if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) lang = LANG_UNIVERSAL; - uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); - if(!IsOn(p)) { WorldPacket data; @@ -678,7 +604,6 @@ void Channel::Say(uint64 p, const char *what, uint32 lang) else { uint32 messageLength = strlen(what) + 1; - WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1); data << (uint8)CHAT_MSG_CHANNEL; data << (uint32)lang; @@ -689,11 +614,9 @@ void Channel::Say(uint64 p, const char *what, uint32 lang) data << messageLength; data << what; data << uint8(plr ? plr->chatTag() : 0); - SendToAll(&data, !players[p].IsModerator() ? p : false); } } - void Channel::Invite(uint64 p, const char *newname) { if(!IsOn(p)) @@ -703,7 +626,6 @@ void Channel::Invite(uint64 p, const char *newname) SendToOne(&data, p); return; } - Player *newp = objmgr.GetPlayer(newname); if(!newp) { @@ -712,11 +634,9 @@ void Channel::Invite(uint64 p, const char *newname) SendToOne(&data, p); return; } - Player *plr = objmgr.GetPlayer(p); if (!plr) return; - if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; @@ -724,7 +644,6 @@ void Channel::Invite(uint64 p, const char *newname) SendToOne(&data, p); return; } - if(IsOn(newp->GetGUID())) { WorldPacket data; @@ -732,7 +651,6 @@ void Channel::Invite(uint64 p, const char *newname) SendToOne(&data, p); return; } - WorldPacket data; if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p))) { @@ -743,7 +661,6 @@ void Channel::Invite(uint64 p, const char *newname) MakePlayerInvited(&data, newp->GetName()); SendToOne(&data, p); } - void Channel::SetOwner(uint64 guid, bool exclaim) { if(m_ownerGUID) @@ -753,18 +670,15 @@ void Channel::SetOwner(uint64 guid, bool exclaim) if(p_itr != players.end()) p_itr->second.SetOwner(false); } - m_ownerGUID = guid; if(m_ownerGUID) { uint8 oldFlag = GetPlayerFlags(m_ownerGUID); players[m_ownerGUID].SetModerator(true); players[m_ownerGUID].SetOwner(true); - WorldPacket data; MakeModeChange(&data, m_ownerGUID, oldFlag); SendToAll(&data); - if(exclaim) { MakeOwnerChanged(&data, m_ownerGUID); @@ -777,12 +691,10 @@ void Channel::SetOwner(uint64 guid, bool exclaim) if(CharacterDatabase.PExecute( ss.str( ).c_str( ) )) { sLog.outDebug("Channel(%s) owner saved", m_name.c_str()); - } + } }*/ - } } - void Channel::SendToAll(WorldPacket *data, uint64 p) { for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) @@ -795,7 +707,6 @@ void Channel::SendToAll(WorldPacket *data, uint64 p) } } } - void Channel::SendToAllButOne(WorldPacket *data, uint64 who) { for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) @@ -808,24 +719,18 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who) } } } - void Channel::SendToOne(WorldPacket *data, uint64 who) { Player *plr = objmgr.GetPlayer(who); if(plr) plr->GetSession()->SendPacket(data); } - void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/) { - } - void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/) { - } - // done void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type) { @@ -833,21 +738,18 @@ void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type) *data << uint8(notify_type); *data << m_name; } - // done 0x00 void Channel::MakeJoined(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_JOINED_NOTICE); *data << uint64(guid); } - // done 0x01 void Channel::MakeLeft(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_LEFT_NOTICE); *data << uint64(guid); } - // done 0x02 void Channel::MakeYouJoined(WorldPacket *data) { @@ -856,7 +758,6 @@ void Channel::MakeYouJoined(WorldPacket *data) *data << uint32(GetChannelId()); *data << uint32(0); } - // done 0x03 void Channel::MakeYouLeft(WorldPacket *data) { @@ -864,64 +765,53 @@ void Channel::MakeYouLeft(WorldPacket *data) *data << uint32(GetChannelId()); *data << uint8(0); // can be 0x00 and 0x01 } - // done 0x04 void Channel::MakeWrongPassword(WorldPacket *data) { MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE); } - // done 0x05 void Channel::MakeNotMember(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE); } - // done 0x06 void Channel::MakeNotModerator(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE); } - // done 0x07 void Channel::MakePasswordChanged(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE); *data << uint64(guid); } - // done 0x08 void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE); *data << uint64(guid); } - // done 0x09 void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE); *data << name; } - // done 0x0A void Channel::MakeNotOwner(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE); } - // done 0x0B void Channel::MakeChannelOwner(WorldPacket *data) { std::string name = ""; - if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty()) name = "PLAYER_NOT_FOUND"; - MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE); *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name); } - // done 0x0C void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags) { @@ -930,41 +820,35 @@ void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags) *data << uint8(oldflags); *data << uint8(GetPlayerFlags(guid)); } - // done 0x0D void Channel::MakeAnnouncementsOn(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE); *data << uint64(guid); } - // done 0x0E void Channel::MakeAnnouncementsOff(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE); *data << uint64(guid); } - // done 0x0F void Channel::MakeModerationOn(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE); *data << uint64(guid); } - // done 0x10 void Channel::MakeModerationOff(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE); *data << uint64(guid); } - // done 0x11 void Channel::MakeMuted(WorldPacket *data) { MakeNotifyPacket(data, CHAT_MUTED_NOTICE); } - // done 0x12 void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good) { @@ -972,13 +856,11 @@ void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good) *data << uint64(bad); *data << uint64(good); } - // done 0x13 void Channel::MakeBanned(WorldPacket *data) { MakeNotifyPacket(data, CHAT_BANNED_NOTICE); } - // done 0x14 void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good) { @@ -986,7 +868,6 @@ void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good) *data << uint64(bad); *data << uint64(good); } - // done 0x15 void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good) { @@ -994,107 +875,90 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good) *data << uint64(bad); *data << uint64(good); } - // done 0x16 void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE); *data << uint64(guid); } - // done 0x17 void Channel::MakePlayerAlreadyMember(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE); *data << uint64(guid); } - // done 0x18 void Channel::MakeInvite(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_INVITE_NOTICE); *data << uint64(guid); } - // done 0x19 void Channel::MakeInviteWrongFaction(WorldPacket *data) { MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE); } - // done 0x1A void Channel::MakeWrongFaction(WorldPacket *data) { MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE); } - // done 0x1B void Channel::MakeInvalidName(WorldPacket *data) { MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE); } - // done 0x1C void Channel::MakeNotModerated(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE); } - // done 0x1D void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE); *data << name; } - // done 0x1E void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE); *data << uint64(guid); } - // done 0x1F void Channel::MakeThrottled(WorldPacket *data) { MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE); } - // done 0x20 void Channel::MakeNotInArea(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE); } - // done 0x21 void Channel::MakeNotInLfg(WorldPacket *data) { MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE); } - // done 0x22 void Channel::MakeVoiceOn(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE); *data << uint64(guid); } - // done 0x23 void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE); *data << uint64(guid); } - void Channel::JoinNotify(uint64 guid) { WorldPacket data; - if(IsConstant()) data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1); else data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1); - data << uint64(guid); data << uint8(GetPlayerFlags(guid)); data << uint8(GetFlags()); @@ -1102,7 +966,6 @@ void Channel::JoinNotify(uint64 guid) data << GetName(); SendToAll(&data); } - void Channel::LeaveNotify(uint64 guid) { WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1); diff --git a/src/game/Channel.h b/src/game/Channel.h index 69a1e2f66f6..b97acd52360 100644 --- a/src/game/Channel.h +++ b/src/game/Channel.h @@ -17,20 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _CHANNEL_H #define _CHANNEL_H - #include #include #include - #include "Common.h" - #include "Opcodes.h" #include "Player.h" #include "WorldPacket.h" - enum ChatNotify { CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel."; @@ -72,7 +67,6 @@ enum ChatNotify CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s."; CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s."; }; - enum ChannelFlags { CHANNEL_FLAG_NONE = 0x00, @@ -90,7 +84,6 @@ enum ChannelFlags // GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08 // LookingForGroup 0x50 = 0x40 | 0x10 }; - enum ChannelDBCFlags { CHANNEL_DBC_FLAG_NONE = 0x00000, @@ -104,7 +97,6 @@ enum ChannelDBCFlags CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup }; - enum ChannelMemberFlags { MEMBER_FLAG_NONE = 0x00, @@ -117,14 +109,12 @@ enum ChannelMemberFlags // 0x40 // 0x80 }; - class Channel { struct PlayerInfo { uint64 player; uint8 flags; - bool HasFlag(uint8 flag) { return flags & flag; } void SetFlag(uint8 flag) { if(!HasFlag(flag)) flags |= flag; } bool IsOwner() { return flags & MEMBER_FLAG_OWNER; } @@ -146,7 +136,6 @@ class Channel else flags &= ~MEMBER_FLAG_MUTED; } }; - typedef std::map PlayerList; PlayerList players; typedef std::set BannedList; @@ -159,7 +148,6 @@ class Channel uint32 m_channelId; uint64 m_ownerGUID; bool m_IsSaved; - private: // initial packet data (notify type and channel name) void MakeNotifyPacket(WorldPacket *data, uint8 notify_type); @@ -200,49 +188,40 @@ class Channel void MakeNotInLfg(WorldPacket *data); //? 0x21 void MakeVoiceOn(WorldPacket *data, uint64 guid); //+ 0x22 void MakeVoiceOff(WorldPacket *data, uint64 guid); //+ 0x23 - void SendToAll(WorldPacket *data, uint64 p = 0); void SendToAllButOne(WorldPacket *data, uint64 who); void SendToOne(WorldPacket *data, uint64 who); - bool IsOn(uint64 who) const { return players.find(who) != players.end(); } bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); } - uint8 GetPlayerFlags(uint64 p) const { PlayerList::const_iterator p_itr = players.find(p); if(p_itr == players.end()) return 0; - return p_itr->second.flags; } - void SetModerator(uint64 p, bool set) { if(players[p].IsModerator() != set) { uint8 oldFlag = GetPlayerFlags(p); players[p].SetModerator(set); - WorldPacket data; MakeModeChange(&data, p, oldFlag); SendToAll(&data); } } - void SetMute(uint64 p, bool set) { if(players[p].IsMuted() != set) { uint8 oldFlag = GetPlayerFlags(p); players[p].SetMuted(set); - WorldPacket data; MakeModeChange(&data, p, oldFlag); SendToAll(&data); } } - public: uint32 m_Team; Channel(const std::string& name, uint32 channel_id, uint32 Team = 0); @@ -257,7 +236,6 @@ class Channel uint32 GetNumPlayers() const { return players.size(); } uint8 GetFlags() const { return m_flags; } bool HasFlag(uint8 flag) { return m_flags & flag; } - void Join(uint64 p, const char *pass); void Leave(uint64 p, bool send = true); void KickOrBan(uint64 good, const char *badname, bool ban); diff --git a/src/game/ChannelHandler.cpp b/src/game/ChannelHandler.cpp index abf73e0e274..d50c579cd9b 100644 --- a/src/game/ChannelHandler.cpp +++ b/src/game/ChannelHandler.cpp @@ -18,26 +18,19 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Policies/SingletonImp.h" - #include "ObjectMgr.h" // for normalizePlayerName #include "ChannelMgr.h" - void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); - uint32 channel_id; uint8 unknown1, unknown2; std::string channelname, pass; - recvPacket >> channel_id >> unknown1 >> unknown2; recvPacket >> channelname; - if(channelname.empty()) return; - recvPacket >> pass; if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { @@ -46,20 +39,16 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) chn->Join(_player->GetGUID(), pass.c_str()); } } - void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); - uint32 unk; std::string channelname; recvPacket >> unk; // channel id? recvPacket >> channelname; - if(channelname.empty()) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { if(Channel *chn = cMgr->GetChannel(channelname, _player)) @@ -67,50 +56,40 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) cMgr->LeftChannel(channelname); } } - void WorldSession::HandleChannelList(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->List(_player); } - void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, pass; recvPacket >> channelname; - recvPacket >> pass; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Password(_player->GetGUID(), pass.c_str()); } - void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, newp; recvPacket >> channelname; - recvPacket >> newp; - if(!normalizePlayerName(newp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->SetOwner(_player->GetGUID(), newp.c_str()); } - void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); @@ -121,144 +100,110 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->SendWhoOwner(_player->GetGUID()); } - void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->SetModerator(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->UnsetModerator(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelMute(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->SetMute(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); - std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->UnsetMute(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Invite(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelKick(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Kick(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelBan(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Ban(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); - std::string channelname, otp; recvPacket >> channelname; - recvPacket >> otp; - if(!normalizePlayerName(otp)) return; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->UnBan(_player->GetGUID(), otp.c_str()); } - void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); @@ -269,7 +214,6 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Announce(_player->GetGUID()); } - void WorldSession::HandleChannelModerate(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); @@ -280,7 +224,6 @@ void WorldSession::HandleChannelModerate(WorldPacket& recvPacket) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->Moderate(_player->GetGUID()); } - void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); @@ -291,7 +234,6 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) if(Channel *chn = cMgr->GetChannel(channelname, _player)) chn->List(_player); } - void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); @@ -310,7 +252,6 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) } } } - void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); diff --git a/src/game/ChannelMgr.cpp b/src/game/ChannelMgr.cpp index 09d172155cc..8994d84b23f 100644 --- a/src/game/ChannelMgr.cpp +++ b/src/game/ChannelMgr.cpp @@ -15,35 +15,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "ChannelMgr.h" #include "Policies/SingletonImp.h" #include "World.h" - INSTANTIATE_SINGLETON_1( AllianceChannelMgr ); INSTANTIATE_SINGLETON_1( HordeChannelMgr ); - ChannelMgr* channelMgr(uint32 team) { if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) return &MaNGOS::Singleton::Instance(); // cross-faction - if(team == ALLIANCE) return &MaNGOS::Singleton::Instance(); if(team == HORDE) return &MaNGOS::Singleton::Instance(); - return NULL; } - ChannelMgr::~ChannelMgr() { for(ChannelMap::iterator itr = channels.begin();itr!=channels.end(); ++itr) delete itr->second; - channels.clear(); } - Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) { if (channels.find(name) == channels.end()) @@ -51,14 +43,11 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) Channel *nchan = new Channel(name,channel_id, team); channels[name] = nchan; } - return channels[name]; } - Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt) { ChannelMap::const_iterator i = channels.find(name); - if(i == channels.end()) { if(pkt) @@ -67,29 +56,23 @@ Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt) MakeNotOnPacket(&data,name); p->GetSession()->SendPacket(&data); } - return NULL; } else return i->second; } - void ChannelMgr::LeftChannel(std::string name) { ChannelMap::const_iterator i = channels.find(name); - if(i == channels.end()) return; - Channel* channel = i->second; - if(channel->GetNumPlayers() == 0 && !channel->IsConstant()) { channels.erase(name); delete channel; } } - void ChannelMgr::MakeNotOnPacket(WorldPacket *data, std::string name) { data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size diff --git a/src/game/ChannelMgr.h b/src/game/ChannelMgr.h index f65a8520648..5bf07d609b9 100644 --- a/src/game/ChannelMgr.h +++ b/src/game/ChannelMgr.h @@ -19,19 +19,14 @@ */ #ifndef MANGOSSERVER_CHANNELMGR_H #define MANGOSSERVER_CHANNELMGR_H - #include "Common.h" #include "Channel.h" #include "Policies/Singleton.h" - #include #include - #include "Policies/Singleton.h" - #include "Channel.h" #include "World.h" - class ChannelMgr { public: @@ -39,7 +34,6 @@ class ChannelMgr typedef std::map ChannelMap; ChannelMgr() {team = 0;} ~ChannelMgr(); - Channel *GetJoinChannel(std::string name, uint32 channel_id); Channel *GetChannel(std::string name, Player *p, bool pkt = true); void LeftChannel(std::string name); @@ -47,11 +41,8 @@ class ChannelMgr ChannelMap channels; void MakeNotOnPacket(WorldPacket *data, std::string name); }; - class AllianceChannelMgr : public ChannelMgr {}; class HordeChannelMgr : public ChannelMgr {}; - ChannelMgr* channelMgr(uint32 team); - #endif diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index e1e6eae86a3..e348d3b6f55 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" @@ -28,7 +27,6 @@ #include "Auth/md5.h" #include "Database/DatabaseEnv.h" #include "Database/DatabaseImpl.h" - #include "ArenaTeam.h" #include "Chat.h" #include "Group.h" @@ -43,7 +41,6 @@ #include "UpdateMask.h" #include "Util.h" #include "ScriptCalls.h" - class LoginQueryHolder : public SqlQueryHolder { private: @@ -56,13 +53,10 @@ class LoginQueryHolder : public SqlQueryHolder uint32 GetAccountId() const { return m_accountId; } bool Initialize(); }; - bool LoginQueryHolder::Initialize() { SetSize(MAX_PLAYER_LOGIN_QUERY); - bool res = true; - // NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure. // !!! NOTE: including unused `zone`,`online` res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points, instance_id, speccount, activespec FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); @@ -92,10 +86,8 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 FROM character_glyphs WHERE guid='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT spell, spec FROM character_talent WHERE guid='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT type, time, data FROM character_account_data WHERE guid='%u'", GUID_LOPART(m_guid)); - return res; } - // don't call WorldSession directly // it may get deleted before the query callbacks get executed // instead pass an account id to this handler @@ -124,15 +116,11 @@ class CharacterHandler session->HandlePlayerLogin((LoginQueryHolder*)holder); } } chrHandler; - void WorldSession::HandleCharEnum(QueryResult * result) { WorldPacket data(SMSG_CHAR_ENUM, 100); // we guess size - uint8 num = 0; - data << num; - if( result ) { do @@ -143,15 +131,11 @@ void WorldSession::HandleCharEnum(QueryResult * result) ++num; } while( result->NextRow() ); - delete result; } - data.put(0, num); - SendPacket( &data ); } - void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) { /// get all the data necessary for loading all characters (along with their pets) on the account @@ -181,32 +165,25 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) "WHERE characters.account = '%u' ORDER BY characters.guid", PET_SAVE_AS_CURRENT,GetAccountId()); } - void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { std::string name; uint8 race_,class_; - recv_data >> name; - recv_data >> race_; recv_data >> class_; - WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases - if(GetSecurity() == SEC_PLAYER) { if(uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED)) { bool disabled = false; - uint32 team = Player::TeamForRace(race_); switch(team) { case ALLIANCE: disabled = mask & (1<<0); break; case HORDE: disabled = mask & (1<<1); break; } - if(disabled) { data << (uint8)CHAR_CREATE_DISABLED; @@ -215,10 +192,8 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) } } } - ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); - if( !classEntry || !raceEntry ) { data << (uint8)CHAR_CREATE_FAILED; @@ -226,7 +201,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) sLog.outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_); return; } - // prevent character creating Expansion race without Expansion account if (raceEntry->addon > Expansion()) { @@ -235,7 +209,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - // prevent character creating Expansion class without Expansion account if (classEntry->addon > Expansion()) { @@ -244,7 +217,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - // prevent character creating with invalid name if (!normalizePlayerName(name)) { @@ -253,7 +225,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) sLog.outError("Account:[%d] but tried to Create character with empty [name] ",GetAccountId()); return; } - // check name limitations uint8 res = ObjectMgr::CheckPlayerName(name,true); if (res != CHAR_NAME_SUCCESS) @@ -262,28 +233,24 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(name)) { data << (uint8)CHAR_NAME_RESERVED; SendPacket( &data ); return; } - if (objmgr.GetPlayerGUIDByName(name)) { data << (uint8)CHAR_CREATE_NAME_IN_USE; SendPacket( &data ); return; } - QueryResult *resultacct = loginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId()); if (resultacct) { Field *fields=resultacct->Fetch(); uint32 acctcharcount = fields[0].GetUInt32(); delete resultacct; - if (acctcharcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_ACCOUNT)) { data << (uint8)CHAR_CREATE_ACCOUNT_LIMIT; @@ -291,7 +258,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } } - QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId()); uint8 charcount = 0; if ( result ) @@ -299,7 +265,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) Field *fields=result->Fetch(); charcount = fields[0].GetUInt8(); delete result; - if (charcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_REALM)) { data << (uint8)CHAR_CREATE_SERVER_LIMIT; @@ -307,7 +272,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } } - // speedup check for heroic class disabled case uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM); if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) @@ -316,7 +280,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - // speedup check for heroic class disabled case uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING); if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) @@ -325,15 +288,11 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS); - bool have_same_race = false; - // if 0 then allowed creating without any characters bool have_req_level_for_heroic = (req_level_for_heroic==0); - if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) { QueryResult *result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s", @@ -341,10 +300,8 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if(result2) { uint32 team_= Player::TeamForRace(race_); - Field* field = result2->Fetch(); uint8 acc_race = field[1].GetUInt32(); - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt32(); @@ -352,7 +309,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { if(heroic_free_slots > 0) --heroic_free_slots; - if(heroic_free_slots==0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; @@ -360,7 +316,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } } - if(!have_req_level_for_heroic) { uint32 acc_level = field[0].GetUInt32(); @@ -368,7 +323,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) have_req_level_for_heroic = true; } } - // need to check team only for first character // TODO: what to if account already has characters of both races? if (!AllowTwoSideAccounts) @@ -376,7 +330,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) uint32 acc_team=0; if(acc_race > 0) acc_team = Player::TeamForRace(acc_race); - if(acc_team != team_) { data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION; @@ -385,20 +338,16 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } } - // search same race for cinematic or same class if need // TODO: check if cinematic already shown? (already logged in?; cinematic field) while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT) { if(!result2->NextRow()) break; - field = result2->Fetch(); acc_race = field[1].GetUInt32(); - if(!have_same_race) have_same_race = race_ == acc_race; - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt32(); @@ -406,7 +355,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { if(heroic_free_slots > 0) --heroic_free_slots; - if(heroic_free_slots==0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; @@ -414,7 +362,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } } - if(!have_req_level_for_heroic) { uint32 acc_level = field[0].GetUInt32(); @@ -426,14 +373,12 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) delete result2; } } - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; SendPacket( &data ); return; } - // extract other data required for player creating uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId; recv_data >> gender; @@ -443,58 +388,44 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) recv_data >> hairColor; recv_data >> facialHair; recv_data >> outfitId; - if(recv_data.rpos() < recv_data.wpos()) { uint8 unk; recv_data >> unk; sLog.outDebug("Character creation %s (account %u) has unhandled tail data: [%u]", name.c_str(), GetAccountId(), unk); } - Player * pNewChar = new Player(this); if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId )) { // Player not create (race/class problem?) delete pNewChar; - data << (uint8)CHAR_CREATE_ERROR; SendPacket( &data ); - return; } - if ((have_same_race && skipCinematics == 1) || skipCinematics == 2) pNewChar->setCinematic(1); // not show intro - // Player created, save it now pNewChar->SaveToDB(); charcount+=1; - loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID); loginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID); - delete pNewChar; // created only to call SaveToDB() - data << (uint8)CHAR_CREATE_SUCCESS; SendPacket( &data ); - std::string IP_str = GetRemoteAddress(); sLog.outDetail("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); } - void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) { uint64 guid; recv_data >> guid; - // can't delete loaded character if(objmgr.GetPlayer(guid)) return; - uint32 accountId = 0; std::string name; - // is guild leader if(objmgr.GetGuildByLeader(guid)) { @@ -503,7 +434,6 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - // is arena team captain if(objmgr.GetArenaTeamByCaptain(guid)) { @@ -512,7 +442,6 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) SendPacket( &data ); return; } - QueryResult *result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid)); if(result) { @@ -521,28 +450,22 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) name = fields[1].GetCppString(); delete result; } - // prevent deleting other players' characters using cheating tools if(accountId != GetAccountId()) return; - std::string IP_str = GetRemoteAddress(); sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); - if(sLog.IsOutCharDump()) // optimize GetPlayerDump call { std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid)); sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str()); } - Player::DeleteFromDB(guid, GetAccountId()); - WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_SUCCESS; SendPacket( &data ); } - void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) { if(PlayerLoading() || GetPlayer() != NULL) @@ -550,14 +473,10 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId()); return; } - m_playerLoading = true; uint64 playerGuid = 0; - DEBUG_LOG( "WORLD: Recvd Player Logon Message" ); - recv_data >> playerGuid; - LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid); if(!holder->Initialize()) { @@ -565,18 +484,14 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) m_playerLoading = false; return; } - CharacterDatabase.DelayQueryHolder(&chrHandler, &CharacterHandler::HandlePlayerLoginCallback, holder); } - void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) { uint64 playerGuid = holder->GetGuid(); - Player* pCurrChar = new Player(this); // for send server info and strings (config) ChatHandler chH = ChatHandler(pCurrChar); - // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder)) { @@ -586,13 +501,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) m_playerLoading = false; return; } - pCurrChar->GetMotionMaster()->Initialize(); - SetPlayer(pCurrChar); - pCurrChar->SendDungeonDifficulty(false); - WorldPacket data( SMSG_LOGIN_VERIFY_WORLD, 20 ); data << pCurrChar->GetMapId(); data << pCurrChar->GetPositionX(); @@ -600,25 +511,20 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data << pCurrChar->GetPositionZ(); data << pCurrChar->GetOrientation(); SendPacket(&data); - // load player specific part before send times LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA),PER_CHARACTER_CACHE_MASK); SendAccountDataTimes(); - data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 data << uint8(2); // unknown value data << uint8(0); // enable(1)/disable(0) voice chat interface in client SendPacket(&data); - // Send MOTD { data.Initialize(SMSG_MOTD, 50); // new in 2.0.1 data << (uint32)0; - uint32 linecount=0; std::string str_motd = sWorld.GetMotd(); std::string::size_type pos, nextpos; - pos = 0; while ( (nextpos= str_motd.find('@',pos)) != std::string::npos ) { @@ -629,33 +535,25 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) } pos = nextpos+1; } - if (posGetGUIDLow()); QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); - if(resultGuild) { Field *fields = resultGuild->Fetch(); @@ -668,7 +566,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->SetInGuild(0); pCurrChar->SetRank(0); } - if(pCurrChar->GetGuildId() != 0) { Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId()); @@ -680,7 +577,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data << guild->GetMOTD(); SendPacket(&data); DEBUG_LOG( "WORLD: Sent guild-motd (SMSG_GUILD_EVENT)" ); - data.Initialize(SMSG_GUILD_EVENT, (5+10)); // we guess size data<<(uint8)GE_SIGNED_ON; data<<(uint8)1; @@ -688,7 +584,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data<GetGUID(); guild->BroadcastPacket(&data); DEBUG_LOG( "WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)" ); - // Increment online members of the guild guild->IncOnlineMemberCount(); } @@ -699,30 +594,24 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->SetInGuild(0); } } - if(!pCurrChar->isAlive()) pCurrChar->SendCorpseReclaimDelay(true); - pCurrChar->SendInitialPacketsBeforeAddToMap(); - //Show cinematic at the first time that player login if( !pCurrChar->getCinematic() ) { pCurrChar->setCinematic(1); - if(ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass())) { if (cEntry->CinematicSequence) pCurrChar->SendCinematicStart(cEntry->CinematicSequence); else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); - // send new char string if not empty if (!sWorld.GetNewCharString().empty()) chH.PSendSysMessage(sWorld.GetNewCharString().c_str()); } } - if (!pCurrChar->GetMap()->Add(pCurrChar)) { AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); @@ -731,29 +620,22 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) else pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); } - ObjectAccessor::Instance().AddObject(pCurrChar); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); - pCurrChar->SendInitialPacketsAfterAddToMap(); - CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow()); loginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = '%u'", GetAccountId()); pCurrChar->SetInGameTime( getMSTime() ); - // announce group about member online (must be after add to player list to receive announce to self) if(Group *group = pCurrChar->GetGroup()) { //pCurrChar->groupInfo.group->SendInit(this); // useless group->SendUpdate(); } - // friend status sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true); - // Place character in world (and load zone) before some object loading pCurrChar->LoadCorpse(); - // setting Ghost+speed if dead if (pCurrChar->m_deathState != ALIVE) { @@ -761,78 +643,57 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if(pCurrChar->getRace() == RACE_NIGHTELF) pCurrChar->CastSpell(pCurrChar, SPELL_ID_NE_GHOST, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, SPELL_ID_GHOST, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) - pCurrChar->SetMovement(MOVE_WATER_WALK); } - pCurrChar->ContinueTaxiFlight(); - // reset for all pets before pet loading if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) Pet::resetTalentsForAllPetsOf(pCurrChar); - // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned) pCurrChar->LoadPet(); - // Set FFA PvP for non GM in non-rest mode if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) ) pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) pCurrChar->SetContestedPvP(); - // Apply at_login requests if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS)) { pCurrChar->resetSpells(); SendNotification(LANG_RESET_SPELLS); } - if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS)) { pCurrChar->resetTalents(true); pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state SendNotification(LANG_RESET_TALENTS); } - // show time before shutdown if shutdown planned. if(sWorld.IsShutdowning()) sWorld.ShutdownMsg(true,pCurrChar); - if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS)) pCurrChar->SetTaxiCheater(true); - if(pCurrChar->isGameMaster()) SendNotification(LANG_GM_ON); - std::string IP_str = GetRemoteAddress(); sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)", GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow()); - if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); - m_playerLoading = false; - //Hook for OnLogin Event Script->OnLogin(pCurrChar); - delete holder; } - void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) { DEBUG_LOG( "WORLD: Received CMSG_SET_FACTION_ATWAR" ); - uint32 repListID; uint8 flag; - recv_data >> repListID; recv_data >> flag; - GetPlayer()->GetReputationMgr().SetAtWar(repListID,flag); } - //I think this function is never used :/ I dunno, but i guess this opcode not exists void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ ) { @@ -840,12 +701,9 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ ) /* uint32 FactionID; uint32 Standing; - recv_data >> FactionID; recv_data >> Standing; - std::list::iterator itr; - for(itr = GetPlayer()->factions.begin(); itr != GetPlayer()->factions.end(); ++itr) { if(itr->ReputationListID == FactionID) @@ -858,19 +716,15 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ ) */ GetPlayer()->GetReputationMgr().SendStates(); } - void WorldSession::HandleMeetingStoneInfo( WorldPacket & /*recv_data*/ ) { DEBUG_LOG( "WORLD: Received CMSG_MEETING_STONE_INFO" ); - SendLfgUpdate(0, 0, 0); } - void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) { uint32 iFlag; recv_data >> iFlag; - uint32 wInt = (iFlag / 32); if (wInt >= 8) { @@ -878,26 +732,21 @@ void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) return; } uint32 rInt = (iFlag % 32); - uint32 tutflag = GetTutorialInt( wInt ); tutflag |= (1 << rInt); SetTutorialInt( wInt, tutflag ); - //sLog.outDebug("Received Tutorial Flag Set {%u}.", iFlag); } - void WorldSession::HandleTutorialClear( WorldPacket & /*recv_data*/ ) { for (int i = 0; i < 8; ++i) SetTutorialInt( i, 0xFFFFFFFF ); } - void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ ) { for (int i = 0; i < 8; ++i) SetTutorialInt( i, 0x00000000 ); } - void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) { DEBUG_LOG("WORLD: Received CMSG_SET_WATCHED_FACTION"); @@ -905,37 +754,30 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) recv_data >> fact; GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact); } - void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) { DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_INACTIVE"); uint32 replistid; uint8 inactive; recv_data >> replistid >> inactive; - _player->GetReputationMgr().SetInactive(replistid, inactive); } - void WorldSession::HandleShowingHelmOpcode( WorldPacket & /*recv_data*/ ) { DEBUG_LOG("CMSG_SHOWING_HELM for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } - void WorldSession::HandleShowingCloakOpcode( WorldPacket & /*recv_data*/ ) { DEBUG_LOG("CMSG_SHOWING_CLOAK for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); } - void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) { uint64 guid; std::string newname; - recv_data >> guid; recv_data >> newname; - // prevent character rename to invalid name if (!normalizePlayerName(newname)) { @@ -944,7 +786,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) SendPacket( &data ); return; } - uint8 res = ObjectMgr::CheckPlayerName(newname,true); if (res != CHAR_NAME_SUCCESS) { @@ -953,7 +794,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) SendPacket( &data ); return; } - // check name limitations if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(newname)) { @@ -962,10 +802,8 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) SendPacket( &data ); return; } - std::string escaped_newname = newname; CharacterDatabase.escape_string(escaped_newname); - // make sure that the character belongs to the current account, that rename at login is enabled // and that there is no character with the desired new name CharacterDatabase.AsyncPQuery(&WorldSession::HandleChangePlayerNameOpcodeCallBack, @@ -974,7 +812,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) GUID_LOPART(guid), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str() ); } - void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uint32 accountId, std::string newname) { WorldSession * session = sWorld.FindSession(accountId); @@ -983,7 +820,6 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uin if(result) delete result; return; } - if (!result) { WorldPacket data(SMSG_CHAR_RENAME, 1); @@ -991,31 +827,23 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uin session->SendPacket( &data ); return; } - uint32 guidLow = result->Fetch()[0].GetUInt32(); uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); std::string oldname = result->Fetch()[1].GetCppString(); - delete result; - CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_RENAME), guidLow); CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", guidLow); - sLog.outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", session->GetAccountId(), session->GetRemoteAddress().c_str(), oldname.c_str(), guidLow, newname.c_str()); - WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newname.size()+1)); data << uint8(RESPONSE_SUCCESS); data << uint64(guid); data << newname; session->SendPacket(&data); } - void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) { uint64 guid; - recv_data >> guid; - // not accept declined names for unsupported languages std::string name; if(!objmgr.GetPlayerNameByGUID(guid, name)) @@ -1026,7 +854,6 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); return; } - std::wstring wname; if(!Utf8toWStr(name, wname)) { @@ -1036,7 +863,6 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); return; } - if(!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using { WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); @@ -1045,12 +871,9 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); return; } - std::string name2; DeclinedName declinedname; - recv_data >> name2; - if(name2 != name) // character have different name { WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); @@ -1059,7 +882,6 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); return; } - for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) { recv_data >> declinedname.name[i]; @@ -1072,7 +894,6 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) return; } } - if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname)) { WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); @@ -1081,41 +902,30 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); return; } - for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) CharacterDatabase.escape_string(declinedname.name[i]); - CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(guid)); CharacterDatabase.PExecute("INSERT INTO character_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%s','%s','%s','%s','%s')", GUID_LOPART(guid), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); CharacterDatabase.CommitTransaction(); - WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); data << uint32(0); // OK data << uint64(guid); SendPacket(&data); } - void WorldSession::HandleAlterAppearance( WorldPacket & recv_data ) { sLog.outDebug("CMSG_ALTER_APPEARANCE"); - uint32 Hair, Color, FacialHair; recv_data >> Hair >> Color >> FacialHair; - BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair); - if(!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender()) return; - BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair); - if(!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender()) return; - uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id); - // 0 - ok // 1,3 - not enough money // 2 - you have to seat on barber chair @@ -1132,30 +942,23 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data ) data << uint32(0); // ok SendPacket(&data); } - _player->ModifyMoney(-int32(Cost)); // it isn't free _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, Cost); - _player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id)); _player->SetByteValue(PLAYER_BYTES, 3, uint8(Color)); _player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id)); - _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1); - _player->SetStandState(0); // stand up } - void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data ) { uint32 slot; recv_data >> slot; - if(slot >= MAX_GLYPH_SLOT_INDEX) { sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); return; } - if(uint32 glyph = _player->GetGlyph(slot)) { if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) @@ -1166,18 +969,14 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data ) } } } - void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { uint64 guid; std::string newname; - recv_data >> guid; recv_data >> newname; - uint8 gender, skin, face, hairStyle, hairColor, facialHair; recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face; - QueryResult *result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid)); if (!result) { @@ -1186,11 +985,9 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) SendPacket( &data ); return; } - Field *fields = result->Fetch(); uint32 at_loginFlags = fields[0].GetUInt32(); delete result; - if (!(at_loginFlags & AT_LOGIN_CUSTOMIZE)) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); @@ -1198,7 +995,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) SendPacket( &data ); return; } - // prevent character rename to invalid name if (!normalizePlayerName(newname)) { @@ -1207,7 +1003,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) SendPacket( &data ); return; } - uint8 res = ObjectMgr::CheckPlayerName(newname,true); if (res != CHAR_NAME_SUCCESS) { @@ -1216,7 +1011,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) SendPacket( &data ); return; } - // check name limitations if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(newname)) { @@ -1225,7 +1019,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) SendPacket( &data ); return; } - // character with this name already exist if (uint64 newguid = objmgr.GetPlayerGUIDByName(newname)) { @@ -1237,7 +1030,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) return; } } - CharacterDatabase.escape_string(newname); if(QueryResult *result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid))) { @@ -1248,7 +1040,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_CUSTOMIZE), GUID_LOPART(guid)); CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", GUID_LOPART(guid)); - WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newname.size()+1)+6); data << uint8(RESPONSE_SUCCESS); data << uint64(guid); @@ -1261,90 +1052,66 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) data << uint8(facialHair); SendPacket(&data); } - void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data) { sLog.outDebug("CMSG_EQUIPMENT_SET_SAVE"); - uint64 setGuid; if(!recv_data.readPackGUID(setGuid)) return; - uint32 index; recv_data >> index; if(index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount return; - std::string name; recv_data >> name; - std::string iconName; recv_data >> iconName; - EquipmentSet eqSet; - eqSet.Guid = setGuid; eqSet.Name = name; eqSet.IconName = iconName; eqSet.state = EQUIPMENT_SET_NEW; - for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { uint64 itemGuid; if(!recv_data.readPackGUID(itemGuid)) return; - Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if(!item && itemGuid) // cheating check 1 return; - if(item && item->GetGUID() != itemGuid) // cheating check 2 return; - eqSet.Items[i] = GUID_LOPART(itemGuid); } - _player->SetEquipmentSet(index, eqSet); } - void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data) { sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE"); - uint64 setGuid; if(!recv_data.readPackGUID(setGuid)) return; - _player->DeleteEquipmentSet(setGuid); } - void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) { sLog.outDebug("CMSG_EQUIPMENT_SET_USE"); recv_data.hexlike(); - for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { uint64 itemGuid; if(!recv_data.readPackGUID(itemGuid)) return; - uint8 srcbag, srcslot; recv_data >> srcbag >> srcslot; - sLog.outDebug("Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); - Item *item = _player->GetItemByGuid(itemGuid); - uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8); - if(!item) { Item *uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if(!uItem) continue; - ItemPosCountVec sDest; uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sDest, uItem, false ); if(msg == EQUIP_ERR_OK) @@ -1354,61 +1121,48 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) } else _player->SendEquipError(msg, uItem, NULL); - continue; } - if(item->GetPos() == dstpos) continue; - _player->SwapItem(item->GetPos(), dstpos); } - WorldPacket data(SMSG_EQUIPMENT_SET_USE_RESULT, 1); data << uint8(0); // 4 - equipment swap failed - inventory is full SendPacket(&data); } - void WorldSession::HandleOnPVPKill(Player *killed) { Script->OnPVPKill(GetPlayer(), killed); } - bool WorldSession::HandleOnPlayerChat(const char *text) { return Script->OnPlayerChat(GetPlayer(), text); } - uint32 WorldSession::HandleOnGetXP(uint32 amount) { return Script->OnGetXP(GetPlayer(), amount); } - int32 WorldSession::HandleOnGetMoney(int32 amount) { return Script->OnGetMoney(GetPlayer(), amount); } - void WorldSession::HandleOnAreaChange(AreaTableEntry const *pArea) { Script->OnAreaChange(GetPlayer(), pArea); } - bool WorldSession::HandleOnItemClick(Item *pItem) { return Script->OnItemClick(GetPlayer(), pItem); } - bool WorldSession::HandleOnItemOpen(Item *pItem) { return Script->OnItemOpen(GetPlayer(), pItem); } - bool WorldSession::HandleOnGoClick(GameObject *pGameObject) { return Script->OnGoClick(GetPlayer(), pGameObject); } - void WorldSession::HandleOnCreatureKill(Creature *pCreature) { Script->OnCreatureKill(GetPlayer(), pCreature); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 32233aae5a9..bb8d71e4a3c 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -17,14 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectMgr.h" #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Database/DatabaseEnv.h" - #include "AccountMgr.h" #include "CellImpl.h" #include "Chat.h" @@ -36,7 +34,6 @@ #include "UpdateMask.h" #include "SpellMgr.h" #include "ScriptCalls.h" - // Supported shift-links (client generated and server side) // |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r // - client, item icon shift click, not used in server currently @@ -59,9 +56,7 @@ // |color|Htaxinode:id|h[name]|h|r // |color|Htele:id|h[name]|h|r // |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click - bool ChatHandler::load_command_table = true; - ChatCommand * ChatHandler::getCommandTable() { static ChatCommand accountSetCommandTable[] = @@ -71,7 +66,6 @@ ChatCommand * ChatHandler::getCommandTable() { "password", SEC_CONSOLE, true, &ChatHandler::HandleAccountSetPasswordCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand accountCommandTable[] = { { "addon", SEC_PLAYER, false, &ChatHandler::HandleAccountAddonCommand, "", NULL }, @@ -84,7 +78,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_PLAYER, false, &ChatHandler::HandleAccountCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand banCommandTable[] = { { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanAccountCommand, "", NULL }, @@ -92,7 +85,6 @@ ChatCommand * ChatHandler::getCommandTable() { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand baninfoCommandTable[] = { { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoAccountCommand, "", NULL }, @@ -100,7 +92,6 @@ ChatCommand * ChatHandler::getCommandTable() { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand banlistCommandTable[] = { { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListAccountCommand, "", NULL }, @@ -108,7 +99,6 @@ ChatCommand * ChatHandler::getCommandTable() { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand castCommandTable[] = { { "back", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastBackCommand, "", NULL }, @@ -118,7 +108,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand characterCommandTable[] = { { "customize", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterCustomizeCommand, "", NULL }, @@ -128,7 +117,6 @@ ChatCommand * ChatHandler::getCommandTable() { "reputation", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterReputationCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand debugPlayCommandTable[] = { { "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", NULL }, @@ -136,7 +124,6 @@ ChatCommand * ChatHandler::getCommandTable() { "sound", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlaySoundCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand debugSendCommandTable[] = { { "buyerror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendBuyErrorCommand, "", NULL }, @@ -153,7 +140,6 @@ ChatCommand * ChatHandler::getCommandTable() { "spellfail", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendSpellFailCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand debugCommandTable[] = { { "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL }, @@ -179,7 +165,6 @@ ChatCommand * ChatHandler::getCommandTable() { "itemexpire", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugItemExpireCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand eventCommandTable[] = { { "activelist", SEC_GAMEMASTER, true, &ChatHandler::HandleEventActiveListCommand, "", NULL }, @@ -188,7 +173,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_GAMEMASTER, true, &ChatHandler::HandleEventInfoCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand gmCommandTable[] = { { "chat", SEC_MODERATOR, false, &ChatHandler::HandleGMChatCommand, "", NULL }, @@ -199,7 +183,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_MODERATOR, false, &ChatHandler::HandleGMCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand goCommandTable[] = { { "creature", SEC_MODERATOR, false, &ChatHandler::HandleGoCreatureCommand, "", NULL }, @@ -212,12 +195,9 @@ ChatCommand * ChatHandler::getCommandTable() { "xy", SEC_MODERATOR, false, &ChatHandler::HandleGoXYCommand, "", NULL }, { "xyz", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, { "", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, - { "ticket", SEC_MODERATOR, false, &ChatHandler::HandleGoTicketCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand gobjectCommandTable[] = { { "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL }, @@ -232,7 +212,6 @@ ChatCommand * ChatHandler::getCommandTable() { "turn", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectTurnCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand groupCommandTable[] = { { "leader", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, @@ -240,7 +219,6 @@ ChatCommand * ChatHandler::getCommandTable() { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand guildCommandTable[] = { { "create", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildCreateCommand, "", NULL }, @@ -250,7 +228,6 @@ ChatCommand * ChatHandler::getCommandTable() { "rank", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildRankCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand honorCommandTable[] = { { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddCommand, "", NULL }, @@ -258,7 +235,6 @@ ChatCommand * ChatHandler::getCommandTable() { "update", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorUpdateCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand instanceCommandTable[] = { { "listbinds", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceListBindsCommand, "", NULL }, @@ -267,7 +243,6 @@ ChatCommand * ChatHandler::getCommandTable() { "savedata", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand learnCommandTable[] = { { "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllCommand, "", NULL }, @@ -283,7 +258,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand listCommandTable[] = { { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL }, @@ -292,7 +266,6 @@ ChatCommand * ChatHandler::getCommandTable() { "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand lookupPlayerCommandTable[] = { { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, @@ -300,7 +273,6 @@ ChatCommand * ChatHandler::getCommandTable() { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand lookupCommandTable[] = { { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, @@ -319,7 +291,6 @@ ChatCommand * ChatHandler::getCommandTable() { "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand modifyCommandTable[] = { { "hp", SEC_MODERATOR, false, &ChatHandler::HandleModifyHPCommand, "", NULL }, @@ -350,7 +321,6 @@ ChatCommand * ChatHandler::getCommandTable() { "gender", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyGenderCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand npcCommandTable[] = { { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddCommand, "", NULL }, @@ -382,16 +352,13 @@ ChatCommand * ChatHandler::getCommandTable() { "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL }, { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, { "setlink", SEC_MODERATOR, false, &ChatHandler::HandleNpcSetLinkCommand, "", NULL }, - //{ TODO: fix or remove this commands { "addweapon", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAddWeaponCommand, "", NULL }, { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcNameCommand, "", NULL }, { "subname", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSubNameCommand, "", NULL }, //} - { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand petCommandTable[] = { { "create", SEC_GAMEMASTER, false, &ChatHandler::HandleCreatePetCommand, "", NULL }, @@ -400,14 +367,12 @@ ChatCommand * ChatHandler::getCommandTable() { "tp", SEC_GAMEMASTER, false, &ChatHandler::HandlePetTpCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand pdumpCommandTable[] = { { "load", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpLoadCommand, "", NULL }, { "write", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpWriteCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand questCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestAdd, "", NULL }, @@ -415,7 +380,6 @@ ChatCommand * ChatHandler::getCommandTable() { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestRemove, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand reloadCommandTable[] = { { "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllCommand, "", NULL }, @@ -429,9 +393,7 @@ ChatCommand * ChatHandler::getCommandTable() { "all_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllQuestCommand, "", NULL }, { "all_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllScriptsCommand, "", NULL }, { "all_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, - { "config", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConfigCommand, "", NULL }, - { "access_requirement", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAccessRequirementCommand, "", NULL }, { "achievement_criteria_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementCriteriaDataCommand, "", NULL }, { "achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementRewardCommand, "", NULL }, @@ -507,10 +469,8 @@ ChatCommand * ChatHandler::getCommandTable() { "auctions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAuctionsCommand, "", NULL }, { "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL }, { "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand resetCommandTable[] = { { "achievements", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAchievementsCommand, "", NULL }, @@ -522,7 +482,6 @@ ChatCommand * ChatHandler::getCommandTable() { "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAllCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand sendCommandTable[] = { { "items", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendItemsCommand, "", NULL }, @@ -531,35 +490,30 @@ ChatCommand * ChatHandler::getCommandTable() { "money", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMoneyCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverIdleRestartCommandTable[] = { { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleRestartCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverIdleShutdownCommandTable[] = { { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleShutDownCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverRestartCommandTable[] = { { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerRestartCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverShutdownCommandTable[] = { { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverSetCommandTable[] = { { "difftime", SEC_CONSOLE, true, &ChatHandler::HandleServerSetDiffTimeCommand, "", NULL }, @@ -569,7 +523,6 @@ ChatCommand * ChatHandler::getCommandTable() { "closed", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetClosedCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverCommandTable[] = { { "corpses", SEC_GAMEMASTER, true, &ChatHandler::HandleServerCorpsesCommand, "", NULL }, @@ -584,7 +537,6 @@ ChatCommand * ChatHandler::getCommandTable() { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand teleCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleTeleAddCommand, "", NULL }, @@ -594,7 +546,6 @@ ChatCommand * ChatHandler::getCommandTable() { "", SEC_MODERATOR, false, &ChatHandler::HandleTeleCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand unbanCommandTable[] = { { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL }, @@ -602,7 +553,6 @@ ChatCommand * ChatHandler::getCommandTable() { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand wpCommandTable[] = { { "show", SEC_GAMEMASTER, false, &ChatHandler::HandleWpShowCommand, "", NULL }, @@ -613,7 +563,6 @@ ChatCommand * ChatHandler::getCommandTable() { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand ticketCommandTable[] = { { "list", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListCommand, "", NULL }, @@ -628,7 +577,6 @@ ChatCommand * ChatHandler::getCommandTable() { "comment", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCommentCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand commandTable[] = { { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, @@ -654,12 +602,10 @@ ChatCommand * ChatHandler::getCommandTable() { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, - { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, { "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL }, { "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, - { "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL }, { "unaura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnAuraCommand, "", NULL }, { "nameannounce", SEC_MODERATOR, false, &ChatHandler::HandleNameAnnounceCommand, "", NULL }, @@ -720,24 +666,19 @@ ChatCommand * ChatHandler::getCommandTable() { "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, { "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", NULL }, { "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL }, - { "freeze", SEC_ADMINISTRATOR, false, &ChatHandler::HandleFreezeCommand, "", NULL }, { "unfreeze", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnFreezeCommand, "", NULL }, { "listfreeze", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListFreezeCommand, "", NULL }, - { "possess", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePossessCommand, "", NULL }, { "unpossess", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnPossessCommand, "", NULL }, { "bindsight", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBindSightCommand, "", NULL }, { "unbindsight", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnbindSightCommand, "", NULL }, { "playall", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlayAllCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } }; - if (load_command_table) { load_command_table = false; - QueryResult *result = WorldDatabase.Query("SELECT name,security,help FROM command"); if (result) { @@ -745,77 +686,61 @@ ChatCommand * ChatHandler::getCommandTable() { Field *fields = result->Fetch(); std::string name = fields[0].GetCppString(); - SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetCppString(), name); - } while(result->NextRow()); delete result; } } - return commandTable; } - const char *ChatHandler::GetTrinityString(int32 entry) const { return m_session->GetTrinityString(entry); } - bool ChatHandler::isAvailable(ChatCommand const& cmd) const { // check security level only for simple command (without child commands) return m_session->GetSecurity() >= cmd.SecurityLevel; } - bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) { WorldSession* target_session = NULL; uint32 target_account = 0; - if (target) target_session = target->GetSession(); else if (guid) target_account = objmgr.GetPlayerAccountIdByGUID(guid); - if (!target_session && !target_account) { SendSysMessage(LANG_PLAYER_NOT_FOUND); SetSentErrorMessage(true); return true; } - return HasLowerSecurityAccount(target_session,target_account,strong); } - bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong) { uint32 target_sec; - // allow everything from console and RA console if (!m_session) return false; - // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY)) return false; - if (target) target_sec = target->GetSecurity(); else if (target_account) target_sec = accmgr.GetSecurity(target_account); else return true; // caller must report error for (target==NULL && target_account==0) - if (m_session->GetSecurity() < target_sec || (strong && m_session->GetSecurity() <= target_sec)) { SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SetSentErrorMessage(true); return true; } - return false; } - bool ChatHandler::hasStringAbbr(const char* name, const char* part) { // non "" command @@ -824,7 +749,6 @@ bool ChatHandler::hasStringAbbr(const char* name, const char* part) // "" part from non-"" command if (!*part) return false; - for (;;) { if (!*part) @@ -837,54 +761,42 @@ bool ChatHandler::hasStringAbbr(const char* name, const char* part) } } // allow with any for "" - return true; } - void ChatHandler::SendSysMessage(const char *str) { WorldPacket data; - // need copy to prevent corruption by strtok call in LineFromMessage original string char* buf = strdup(str); char* pos = buf; - while(char* line = LineFromMessage(pos)) { FillSystemMessageData(&data, line); m_session->SendPacket(&data); } - free(buf); } - void ChatHandler::SendGlobalSysMessage(const char *str) { // Chat output WorldPacket data; - // need copy to prevent corruption by strtok call in LineFromMessage original string char* buf = strdup(str); char* pos = buf; - while(char* line = LineFromMessage(pos)) { FillSystemMessageData(&data, line); sWorld.SendGlobalMessage(&data); } - free(buf); } - void ChatHandler::SendGlobalGMSysMessage(const char *str) { // Chat output WorldPacket data; - // need copy to prevent corruption by strtok call in LineFromMessage original string char* buf = strdup(str); char* pos = buf; - while(char* line = LineFromMessage(pos)) { FillSystemMessageData(&data, line); @@ -892,12 +804,10 @@ void ChatHandler::SendGlobalGMSysMessage(const char *str) } free(buf); } - void ChatHandler::SendSysMessage(int32 entry) { SendSysMessage(GetTrinityString(entry)); } - void ChatHandler::PSendSysMessage(int32 entry, ...) { const char *format = GetTrinityString(entry); @@ -908,7 +818,6 @@ void ChatHandler::PSendSysMessage(int32 entry, ...) va_end(ap); SendSysMessage(str); } - void ChatHandler::PSendSysMessage(const char *format, ...) { va_list ap; @@ -918,25 +827,20 @@ void ChatHandler::PSendSysMessage(const char *format, ...) va_end(ap); SendSysMessage(str); } - bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd) { char const* oldtext = text; std::string cmd = ""; - while (*text != ' ' && *text != '\0') { cmd += *text; ++text; } - while (*text == ' ') ++text; - for (uint32 i = 0; table[i].Name != NULL; ++i) { if (!hasStringAbbr(table[i].Name, cmd.c_str())) continue; - // select subcommand from child commands list if (table[i].ChildCommands != NULL) { @@ -946,17 +850,13 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co SendSysMessage(LANG_NO_SUBCMD); else SendSysMessage(LANG_CMD_SYNTAX); - ShowHelpForCommand(table[i].ChildCommands,text); } - return true; } - // must be available and have handler if (!table[i].Handler || !isAvailable(table[i])) continue; - SetSentErrorMessage(false); // table[i].Name == "" is special case: send original command to handler if ((this->*(table[i].Handler))(strlen(table[i].Name)!=0 ? text : oldtext)) @@ -982,31 +882,24 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co else SendSysMessage(LANG_CMD_SYNTAX); } - return true; } - return false; } - bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand) { std::string cmd = ""; - while (*text != ' ' && *text != '\0') { cmd += *text; ++text; } - while (*text == ' ') ++text; - for (uint32 i = 0; table[i].Name != NULL; i++) { // for data fill use full explicit command names if (table[i].Name != cmd) continue; - // select subcommand from child commands list (including "") if (table[i].ChildCommands != NULL) { @@ -1014,7 +907,6 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, return true; else if (*text) return false; - // fail with "" subcommands, then use normal level up command instead } // expected subcommand by full name DB content @@ -1023,15 +915,12 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.",text,fullcommand.c_str()); return false; } - if (table[i].SecurityLevel != security) sLog.outDetail("Table `command` overwrite for command '%s' default security (%u) by %u",fullcommand.c_str(),table[i].SecurityLevel,security); - table[i].SecurityLevel = security; table[i].Help = help; return true; } - // in case "" command let process by caller if (!cmd.empty()) { @@ -1040,40 +929,31 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, else sLog.outErrorDb("Table `command` have not existed subcommand '%s' in command '%s', skip.",cmd.c_str(),fullcommand.c_str()); } - return false; } - int ChatHandler::ParseCommands(const char* text) { ASSERT(text); ASSERT(*text); - std::string fullcmd = text; - if (m_session && !m_session->HandleOnPlayerChat(text)) return 0; - /// chat case (.command or !command format) if (m_session) { if (text[0] != '!' && text[0] != '.') return 0; } - /// ignore single . and ! in line if (strlen(text) < 2) return 0; // original `text` can't be used. It content destroyed in command code processing. - /// ignore messages staring from many dots. if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!')) return 0; - /// skip first . or ! (in console allowed use command with . and ! and without its) if (text[0] == '!' || text[0] == '.') ++text; - if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) { if (m_session && m_session->GetSecurity() == SEC_PLAYER) @@ -1082,11 +962,9 @@ int ChatHandler::ParseCommands(const char* text) } return 1; } - bool ChatHandler::isValidChatMessage(const char* message) { /* - valid examples: |cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r |cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r @@ -1096,34 +974,26 @@ valid examples: |cffffd000|Henchant:3919|h[Engineering: Rough Dynamite]|h|r |cffffff00|Hachievement:546:0000000000000001:0:0:0:-1:0:0:0:0|h[Safe Deposit]|h|r |cff66bbff|Hglyph:21:762|h[Glyph of Bladestorm]|h|r - | will be escaped to || */ - if (strlen(message) > 255) return false; - const char validSequence[6] = "cHhhr"; const char* validSequenceIterator = validSequence; - // more simple checks if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) < 3) { const std::string validCommands = "cHhr|"; - while(*message) { // find next pipe command message = strchr(message, '|'); - if (!message) return true; - ++message; char commandChar = *message; if (validCommands.find(commandChar) == std::string::npos) return false; - ++message; // validate sequence if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) == 2) @@ -1141,17 +1011,13 @@ valid examples: } return true; } - std::istringstream reader(message); char buffer[256]; - uint32 color; - ItemPrototype const* linkedItem; Quest const* linkedQuest; SpellEntry const *linkedSpell; AchievementEntry const* linkedAchievement; - while(!reader.eof()) { if (validSequence == validSequenceIterator) @@ -1160,7 +1026,6 @@ valid examples: linkedQuest = NULL; linkedSpell = NULL; linkedAchievement = NULL; - reader.ignore(255, '|'); } else if (reader.get() != '|') @@ -1170,7 +1035,6 @@ valid examples: #endif return false; } - // pipe has always to be followed by at least one char if (reader.peek() == '\0') { @@ -1179,14 +1043,11 @@ valid examples: #endif return false; } - // no further pipe commands if (reader.eof()) break; - char commandChar; reader >> commandChar; - // | in normal messages is escaped by || if (commandChar != '|') { @@ -1213,7 +1074,6 @@ valid examples: #endif return false; } - switch (commandChar) { case 'c': @@ -1230,7 +1090,6 @@ valid examples: #endif return false; } - color <<= 4; // check for hex char if (c >= '0' && c <='9') @@ -1252,12 +1111,10 @@ valid examples: case 'H': // read chars up to colon = link type reader.getline(buffer, 256, ':'); - if (strcmp(buffer, "item") == 0) { // read item entry reader.getline(buffer, 256, ':'); - linkedItem= objmgr.GetItemPrototype(atoi(buffer)); if (!linkedItem) { @@ -1266,7 +1123,6 @@ valid examples: #endif return false; } - if (color != ItemQualityColors[linkedItem->Quality]) { #ifdef MANGOS_DEBUG @@ -1275,9 +1131,7 @@ valid examples: #endif return false; } - char c = reader.peek(); - // ignore enchants etc. while((c >='0' && c <='9') || c==':') { @@ -1298,9 +1152,7 @@ valid examples: questid += c-'0'; c = reader.peek(); } - linkedQuest = objmgr.GetQuestTemplate(questid); - if (!linkedQuest) { #ifdef MANOGS_DEBUG @@ -1320,13 +1172,11 @@ valid examples: { if (color != CHAT_LINK_COLOR_TRADE) return false; - // read spell entry reader.getline(buffer, 256, ':'); linkedSpell = sSpellStore.LookupEntry(atoi(buffer)); if (!linkedSpell) return false; - char c = reader.peek(); // base64 encoded stuff while(c !='|' && c!='\0') @@ -1340,17 +1190,14 @@ valid examples: // talent links are always supposed to be blue if (color != CHAT_LINK_COLOR_TALENT) return false; - // read talent entry reader.getline(buffer, 256, ':'); TalentEntry const *talentInfo = sTalentStore.LookupEntry(atoi(buffer)); if (!talentInfo) return false; - linkedSpell = sSpellStore.LookupEntry(talentInfo->RankID[0]); if (!linkedSpell) return false; - char c = reader.peek(); // skillpoints? whatever, drop it while(c !='|' && c!='\0') @@ -1363,7 +1210,6 @@ valid examples: { if (color != CHAT_LINK_COLOR_SPELL) return false; - uint32 spellid = 0; // read spell entry char c = reader.peek(); @@ -1382,7 +1228,6 @@ valid examples: { if (color != CHAT_LINK_COLOR_ENCHANT) return false; - uint32 spellid = 0; // read spell entry char c = reader.peek(); @@ -1404,10 +1249,8 @@ valid examples: reader.getline(buffer, 256, ':'); uint32 achievementId = atoi(buffer); linkedAchievement = sAchievementStore.LookupEntry(achievementId); - if (!linkedAchievement) return false; - char c = reader.peek(); // skip progress while(c !='|' && c!='\0') @@ -1420,7 +1263,6 @@ valid examples: { if (color != CHAT_LINK_COLOR_GLYPH) return false; - // first id is slot, drop it reader.getline(buffer, 256, ':'); uint32 glyphId = 0; @@ -1435,9 +1277,7 @@ valid examples: GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId); if (!glyph) return false; - linkedSpell = sSpellStore.LookupEntry(glyph->SpellId); - if (!linkedSpell) return false; } @@ -1462,7 +1302,6 @@ valid examples: return false; } reader.getline(buffer, 256, ']'); - // verify the link name if (linkedSpell) { @@ -1475,20 +1314,16 @@ valid examples: { return false; } - SkillLineAbilityEntry const *skillInfo = bounds.first->second; - if (!skillInfo) { return false; } - SkillLineEntry const *skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); if (!skillLine) { return false; } - for (uint8 i=0; iname[i]); @@ -1518,7 +1353,6 @@ valid examples: if (linkedQuest->GetTitle() != buffer) { QuestLocale const *ql = objmgr.GetQuestLocale(linkedQuest->GetQuestId()); - if (!ql) { #ifdef MANOGS_DEBUG @@ -1526,7 +1360,6 @@ valid examples: #endif return false; } - bool foundName = false; for (uint8 i=0; iTitle.size(); i++) { @@ -1550,7 +1383,6 @@ valid examples: if (strcmp(linkedItem->Name1, buffer) != 0) { ItemLocale const *il = objmgr.GetItemLocale(linkedItem->ItemId); - if (!il) { #ifdef MANGOS_DEBUG @@ -1558,7 +1390,6 @@ valid examples: #endif return false; } - bool foundName = false; for (uint8 i=0; iName.size(); ++i) { @@ -1608,7 +1439,6 @@ valid examples: return false; } } - // check if every opened sequence was also closed properly #ifdef MANGOS_DEBUG if (validSequence != validSequenceIterator) @@ -1616,7 +1446,6 @@ valid examples: #endif return validSequence == validSequenceIterator; } - bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd) { std::string list; @@ -1625,25 +1454,19 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, ch // must be available (ignore handler existence for show command with possibe avalable subcomands if (!isAvailable(table[i])) continue; - /// for empty subcmd show all available if (*subcmd && !hasStringAbbr(table[i].Name, subcmd)) continue; - if (m_session) list += "\n "; else list += "\n\r "; - list += table[i].Name; - if (table[i].ChildCommands) list += " ..."; } - if (list.empty()) return false; - if (table==getCommandTable()) { SendSysMessage(LANG_AVIABLE_CMD); @@ -1651,10 +1474,8 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, ch } else PSendSysMessage(LANG_SUBCMDS_LIST,cmd,list.c_str()); - return true; } - bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) { if (*cmd) @@ -1664,26 +1485,20 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) // must be available (ignore handler existence for show command with possibe avalable subcomands if (!isAvailable(table[i])) continue; - if (!hasStringAbbr(table[i].Name, cmd)) continue; - // have subcommand char const* subcmd = (*cmd) ? strtok(NULL, " ") : ""; - if (table[i].ChildCommands && subcmd && *subcmd) { if (ShowHelpForCommand(table[i].ChildCommands, subcmd)) return true; } - if (!table[i].Help.empty()) SendSysMessage(table[i].Help.c_str()); - if (table[i].ChildCommands) if (ShowHelpForSubCommands(table[i].ChildCommands,table[i].Name,subcmd ? subcmd : "")) return true; - return !table[i].Help.empty(); } } @@ -1694,36 +1509,28 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) // must be available (ignore handler existence for show command with possibe avalable subcomands if (!isAvailable(table[i])) continue; - if (strlen(table[i].Name)) continue; - if (!table[i].Help.empty()) SendSysMessage(table[i].Help.c_str()); - if (table[i].ChildCommands) if (ShowHelpForSubCommands(table[i].ChildCommands,"","")) return true; - return !table[i].Help.empty(); } } - return ShowHelpForSubCommands(table,"",cmd); } - //Note: target_guid used only in CHAT_MSG_WHISPER_INFORM mode (in this case channelName ignored) void ChatHandler::FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker) { uint32 messageLength = (message ? strlen(message) : 0) + 1; - data->Initialize(SMSG_MESSAGECHAT, 100); // guess size *data << uint8(type); if ((type != CHAT_MSG_CHANNEL && type != CHAT_MSG_WHISPER) || language == LANG_ADDON) *data << uint32(language); else *data << uint32(LANG_UNIVERSAL); - switch(type) { case CHAT_MSG_SAY: @@ -1773,16 +1580,13 @@ void ChatHandler::FillMessageData(WorldPacket *data, WorldSession* session, uint target_guid = 0; // only for CHAT_MSG_WHISPER_INFORM used original value target_guid break; } - *data << uint64(target_guid); // there 0 for BG messages *data << uint32(0); // can be chat msg group or something - if (type == CHAT_MSG_CHANNEL) { ASSERT(channelName); *data << channelName; } - *data << uint64(target_guid); *data << uint32(messageLength); *data << message; @@ -1791,153 +1595,116 @@ void ChatHandler::FillMessageData(WorldPacket *data, WorldSession* session, uint else *data << uint8(0); } - Player * ChatHandler::getSelectedPlayer() { if (!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetSelection(); - if (guid == 0) return m_session->GetPlayer(); - return objmgr.GetPlayer(guid); } - Unit* ChatHandler::getSelectedUnit() { if (!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetSelection(); - if (guid == 0) return m_session->GetPlayer(); - return ObjectAccessor::GetUnit(*m_session->GetPlayer(),guid); } - WorldObject *ChatHandler::getSelectedObject() { if (!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetSelection(); - if (guid == 0) return GetNearbyGameObject(); - return ObjectAccessor::GetUnit(*m_session->GetPlayer(),guid); } - Creature* ChatHandler::getSelectedCreature() { if (!m_session) return NULL; - return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(),m_session->GetPlayer()->GetSelection()); } - char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1) { // skip empty if (!text) return NULL; - // skip spaces while(*text==' '||*text=='\t'||*text=='\b') ++text; - if (!*text) return NULL; - // return non link case if (text[0]!='|') return strtok(text, " "); - // [name] Shift-click form |color|linkType:key|h[name]|h|r // or // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r - char* check = strtok(text, "|"); // skip color if (!check) return NULL; // end of data - char* cLinkType = strtok(NULL, ":"); // linktype if (!cLinkType) return NULL; // end of data - if (strcmp(cLinkType,linkType) != 0) { strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function SendSysMessage(LANG_WRONG_LINK_TYPE); return NULL; } - char* cKeys = strtok(NULL, "|"); // extract keys and values char* cKeysTail = strtok(NULL, ""); - char* cKey = strtok(cKeys, ":|"); // extract key if (something1) *something1 = strtok(NULL, ":|"); // extract something - strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function return cKey; } - char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1) { // skip empty if (!text) return NULL; - // skip spaces while(*text==' '||*text=='\t'||*text=='\b') ++text; - if (!*text) return NULL; - // return non link case if (text[0]!='|') return strtok(text, " "); - // [name] Shift-click form |color|linkType:key|h[name]|h|r // or // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r // or // [name] Shift-click form |linkType:key|h[name]|h|r - char* tail; - if (text[1]=='c') { char* check = strtok(text, "|"); // skip color if (!check) return NULL; // end of data - tail = strtok(NULL, ""); // tail } else tail = text+1; // skip first | - char* cLinkType = strtok(tail, ":"); // linktype if (!cLinkType) return NULL; // end of data - for (int i = 0; linkTypes[i]; ++i) { if (strcmp(cLinkType,linkTypes[i]) == 0) { char* cKeys = strtok(NULL, "|"); // extract keys and values char* cKeysTail = strtok(NULL, ""); - char* cKey = strtok(cKeys, ":|"); // extract key if (something1) *something1 = strtok(NULL, ":|"); // extract something - strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function if (found_idx) @@ -1945,12 +1712,10 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, return cKey; } } - strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function SendSysMessage(LANG_WRONG_LINK_TYPE); return NULL; } - char const *fmtstring(char const *format, ...) { va_list argptr; @@ -1960,34 +1725,25 @@ char const *fmtstring(char const *format, ...) static int index = 0; char *buf; int len; - va_start(argptr, format); vsnprintf(temp_buffer,MAX_FMT_STRING, format, argptr); va_end(argptr); - len = strlen(temp_buffer); - if (len >= MAX_FMT_STRING) return "ERROR"; - if (len + index >= MAX_FMT_STRING-1) { index = 0; } - buf = &string[index]; memcpy(buf, temp_buffer, len+1); - index += len + 1; - return buf; } - GameObject* ChatHandler::GetNearbyGameObject() { if (!m_session) return NULL; - Player* pl = m_session->GetPlayer(); GameObject* obj = NULL; Trinity::NearestGameObjectCheck check(*pl); @@ -1995,34 +1751,26 @@ GameObject* ChatHandler::GetNearbyGameObject() pl->VisitNearbyGridObject(999, searcher); return obj; } - GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry) { if (!m_session) return NULL; - Player* pl = m_session->GetPlayer(); - GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); - if (!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object { // search near player then CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*pl,lowguid); MaNGOS::GameObjectSearcher checker(pl,obj,go_check); - TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *pl->GetMap()); } - return obj; } - enum SpellLinkType { SPELL_LINK_SPELL = 0, @@ -2031,7 +1779,6 @@ enum SpellLinkType SPELL_LINK_TRADE = 3, SPELL_LINK_GLYPH = 4 }; - static char const* const spellKeys[] = { "Hspell", // normal spell @@ -2041,7 +1788,6 @@ static char const* const spellKeys[] = "Hglyph", // glyph 0 }; - uint32 ChatHandler::extractSpellIdFromLink(char* text) { // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r @@ -2054,9 +1800,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) char* idS = extractKeyFromLink(text,spellKeys,&type,¶m1_str); if (!idS) return 0; - uint32 id = (uint32)atol(idS); - switch(type) { case SPELL_LINK_SPELL: @@ -2067,14 +1811,11 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); if (!talentEntry) return 0; - int32 rank = param1_str ? (uint32)atol(param1_str) : 0; if (rank >= MAX_TALENT_RANK) return 0; - if (rank < 0) rank = 0; - return talentEntry->RankID[rank]; } case SPELL_LINK_ENCHANT: @@ -2083,41 +1824,33 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) case SPELL_LINK_GLYPH: { uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0; - GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id); if (!glyphPropEntry) return 0; - return glyphPropEntry->SpellId; } } - // unknown type? return 0; } - GameTele const* ChatHandler::extractGameTeleFromLink(char* text) { // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r char* cId = extractKeyFromLink(text,"Htele"); if (!cId) return false; - // id case (explicit or from shift link) if (cId[0] >= '0' || cId[0] >= '9') if (uint32 id = atoi(cId)) return objmgr.GetGameTele(id); - return objmgr.GetGameTele(cId); } - enum GuidLinkType { SPELL_LINK_PLAYER = 0, // must be first for selection in not link case SPELL_LINK_CREATURE = 1, SPELL_LINK_GAMEOBJECT = 2 }; - static char const* const guidKeys[] = { "Hplayer", @@ -2125,18 +1858,15 @@ static char const* const guidKeys[] = "Hgameobject", 0 }; - uint64 ChatHandler::extractGuidFromLink(char* text) { int type = 0; - // |color|Hcreature:creature_guid|h[name]|h|r // |color|Hgameobject:go_guid|h[name]|h|r // |color|Hplayer:name|h[name]|h|r char* idS = extractKeyFromLink(text,guidKeys,&type); if (!idS) return 0; - switch(type) { case SPELL_LINK_PLAYER: @@ -2144,19 +1874,15 @@ uint64 ChatHandler::extractGuidFromLink(char* text) std::string name = idS; if (!normalizePlayerName(name)) return 0; - if (Player* player = objmgr.GetPlayer(name.c_str())) return player->GetGUID(); - if (uint64 guid = objmgr.GetPlayerGUIDByName(name)) return guid; - return 0; } case SPELL_LINK_CREATURE: { uint32 lowguid = (uint32)atol(idS); - if (CreatureData const* data = objmgr.GetCreatureData(lowguid)) return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT); else @@ -2165,32 +1891,26 @@ uint64 ChatHandler::extractGuidFromLink(char* text) case SPELL_LINK_GAMEOBJECT: { uint32 lowguid = (uint32)atol(idS); - if (GameObjectData const* data = objmgr.GetGOData(lowguid)) return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT); else return 0; } } - // unknown type? return 0; } - std::string ChatHandler::extractPlayerNameFromLink(char* text) { // |color|Hplayer:name|h[name]|h|r char* name_str = extractKeyFromLink(text,"Hplayer"); if (!name_str) return ""; - std::string name = name_str; if (!normalizePlayerName(name)) return ""; - return name; } - bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/,std::string* player_name /*= NULL*/) { if (args && *args) @@ -2202,20 +1922,15 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe SetSentErrorMessage(true); return false; } - Player* pl = objmgr.GetPlayer(name.c_str()); - // if allowed player pointer if (player) *player = pl; - // if need guid value from DB (in name case for check player existence) uint64 guid = !pl && (player_guid || player_name) ? objmgr.GetPlayerGUIDByName(name) : 0; - // if allowed player guid (if no then only online players allowed) if (player_guid) *player_guid = pl ? pl->GetGUID() : guid; - if (player_name) *player_name = pl || guid ? name : ""; } @@ -2228,11 +1943,9 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe // if allowed player guid (if no then only online players allowed) if (player_guid) *player_guid = pl ? pl->GetGUID() : 0; - if (player_name) *player_name = pl ? pl->GetName() : ""; } - // some from req. data must be provided (note: name is empty if player not exist) if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty())) { @@ -2240,33 +1953,26 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe SetSentErrorMessage(true); return false; } - return true; } - void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2) { char* p1 = strtok(args, " "); char* p2 = strtok(NULL, " "); - if (!p2) { p2 = p1; p1 = NULL; } - if (arg1) *arg1 = p1; - if (arg2) *arg2 = p2; } - char* ChatHandler::extractQuotedArg(char* args) { if (!*args) return NULL; - if (*args=='"') return strtok(args+1, "\""); else @@ -2277,55 +1983,45 @@ char* ChatHandler::extractQuotedArg(char* args) return strtok(NULL, "\""); } } - bool ChatHandler::needReportToTarget(Player* chr) const { Player* pl = m_session->GetPlayer(); return pl != chr && pl->IsVisibleGloballyFor(chr); } - LocaleConstant ChatHandler::GetSessionDbcLocale() const { return m_session->GetSessionDbcLocale(); } - int ChatHandler::GetSessionDbLocaleIndex() const { return m_session->GetSessionDbLocaleIndex(); } - const char *CliHandler::GetMangosString(int32 entry) const { return objmgr.GetTrinityStringForDBCLocale(entry); } - bool CliHandler::isAvailable(ChatCommand const& cmd) const { // skip non-console commands in console case return cmd.AllowConsole; } - void CliHandler::SendSysMessage(const char *str) { m_print(str); m_print("\r\n"); } - std::string CliHandler::GetNameLink() const { return GetTrinityString(LANG_CONSOLE_COMMAND); } - bool CliHandler::needReportToTarget(Player* /*chr*/) const { return true; } - bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline) { plr = NULL; guid = 0; - if (cname) { std::string name = cname; @@ -2337,13 +2033,11 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, G SetSentErrorMessage(true); return false; } - plr = objmgr.GetPlayer(name.c_str()); if (offline) guid = objmgr.GetPlayerGUIDByName(name.c_str()); } } - if (plr) { group = plr->GetGroup(); @@ -2356,21 +2050,17 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, G plr = getSelectedPlayer(); else plr = m_session->GetPlayer(); - if (!guid || !offline) guid = plr->GetGUID(); group = plr->GetGroup(); } - return true; } - LocaleConstant CliHandler::GetSessionDbcLocale() const { return sWorld.GetDefaultDbcLocale(); } - int CliHandler::GetSessionDbLocaleIndex() const { return objmgr.GetDBCLocaleIndex(); -} \ No newline at end of file +} diff --git a/src/game/Chat.h b/src/game/Chat.h index 1518cb6d45e..35e39ad8b08 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -17,19 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITYCORE_CHAT_H #define TRINITYCORE_CHAT_H - #include "SharedDefines.h" - class ChatHandler; class WorldSession; class Creature; class Player; class Unit; struct GameTele; - class ChatCommand { public: @@ -40,66 +36,50 @@ class ChatCommand std::string Help; ChatCommand * ChildCommands; }; - class TRINITY_DLL_SPEC ChatHandler { public: explicit ChatHandler(WorldSession* session) : m_session(session) {} explicit ChatHandler(Player* player) : m_session(player->GetSession()) {} ~ChatHandler() {} - static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); - void FillMessageData( WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char* message) { FillMessageData( data, m_session, type, language, NULL, target_guid, message, NULL); } - void FillSystemMessageData( WorldPacket *data, const char* message ) { FillMessageData( data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message ); } - static char* LineFromMessage(char*& pos) { char* start = strtok(pos,"\n"); pos = NULL; return start; } - // function with different implementation for chat/console virtual const char *GetMangosString(int32 entry) const; virtual void SendSysMessage( const char *str); - void SendSysMessage( int32 entry); void PSendSysMessage( const char *format, ...) ATTR_PRINTF(2,3); void PSendSysMessage( int32 entry, ... ); std::string PGetParseString(int32 entry, ...); - int ParseCommands(const char* text); - static ChatCommand* getCommandTable(); - bool isValidChatMessage(const char* msg); void SendGlobalSysMessage(const char *str); protected: explicit ChatHandler() : m_session(NULL) {} // for CLI subclass - bool hasStringAbbr(const char* name, const char* part); - // function with different implementation for chat/console virtual bool isAvailable(ChatCommand const& cmd) const; virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); } virtual bool needReportToTarget(Player* chr) const; virtual LocaleConstant GetSessionDbcLocale() const; virtual int GetSessionDbLocaleIndex() const; - bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false); bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false); - void SendGlobalGMSysMessage(const char *str); - static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand ); bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand); bool ShowHelpForCommand(ChatCommand *table, const char* cmd); bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); - bool HandleAccountCommand(const char* args); bool HandleAccountAddonCommand(const char* args); bool HandleAccountCreateCommand(const char* args); @@ -110,13 +90,11 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleAccountSetAddonCommand(const char* args); bool HandleAccountSetGmLevelCommand(const char* args); bool HandleAccountSetPasswordCommand(const char* args); - bool HandleAHBotOptionsCommand(const char * args); bool HandleNameAnnounceCommand(const char* args); bool HandleGMNameAnnounceCommand(const char* args); bool HandleGMAnnounceCommand(const char* args); bool HandleGMNotifyCommand(const char* args); - bool HandleBanAccountCommand(const char* args); bool HandleBanCharacterCommand(const char* args); bool HandleBanIPCommand(const char* args); @@ -126,19 +104,16 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleBanListAccountCommand(const char* args); bool HandleBanListCharacterCommand(const char* args); bool HandleBanListIPCommand(const char* args); - bool HandleCastCommand(const char *args); bool HandleCastBackCommand(const char *args); bool HandleCastDistCommand(const char *args); bool HandleCastSelfCommand(const char *args); bool HandleCastTargetCommand(const char *args); - bool HandleCharacterCustomizeCommand(const char * args); bool HandleCharacterDeleteCommand(const char* args); bool HandleCharacterLevelCommand(const char* args); bool HandleCharacterRenameCommand(const char * args); bool HandleCharacterReputationCommand(const char* args); - bool HandleDebugAnimCommand(const char* args); bool HandleDebugArenaCommand(const char * args); bool HandleDebugBattlegroundCommand(const char * args); @@ -156,7 +131,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleDebugSpellCheckCommand(const char* args); bool HandleDebugUpdateCommand(const char* args); bool HandleDebugUpdateWorldStateCommand(const char* args); - bool HandleDebugSet32Bit(const char* args); bool HandleDebugThreatList(const char * args); bool HandleDebugHostilRefList(const char * args); @@ -164,11 +138,9 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleUnPossessCommand(const char* args); bool HandleBindSightCommand(const char* args); bool HandleUnbindSightCommand(const char* args); - bool HandleDebugPlayCinematicCommand(const char* args); bool HandleDebugPlayMovieCommand(const char* args); bool HandleDebugPlaySoundCommand(const char* args); - bool HandleDebugSendBuyErrorCommand(const char* args); bool HandleDebugSendChannelNotifyCommand(const char* args); bool HandleDebugSendChatMsgCommand(const char* args); @@ -181,12 +153,10 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleDebugSendSellErrorCommand(const char* args); bool HandleDebugSendSetPhaseShiftCommand(const char * args); bool HandleDebugSendSpellFailCommand(const char* args); - bool HandleEventActiveListCommand(const char* args); bool HandleEventStartCommand(const char* args); bool HandleEventStopCommand(const char* args); bool HandleEventInfoCommand(const char* args); - bool HandleGameObjectAddCommand(const char* args); bool HandleGameObjectDeleteCommand(const char* args); bool HandleGameObjectMoveCommand(const char* args); @@ -195,14 +165,12 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleGameObjectStateCommand(const char* args); bool HandleGameObjectTargetCommand(const char* args); bool HandleGameObjectTurnCommand(const char* args); - bool HandleGMCommand(const char* args); bool HandleGMChatCommand(const char* args); bool HandleGMFlyCommand(const char* args); bool HandleGMListFullCommand(const char* args); bool HandleGMListIngameCommand(const char* args); bool HandleGMVisibleCommand(const char* args); - bool HandleGoCommand(const char* args); bool HandleGoCreatureCommand(const char* args); bool HandleGoGraveyardCommand(const char* args); @@ -213,24 +181,19 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleGoXYCommand(const char* args); bool HandleGoXYZCommand(const char* args); bool HandleGoZoneXYCommand(const char* args); - bool HandleGoTicketCommand(const char* args); - bool HandleGuildCreateCommand(const char* args); bool HandleGuildInviteCommand(const char* args); bool HandleGuildUninviteCommand(const char* args); bool HandleGuildRankCommand(const char* args); bool HandleGuildDeleteCommand(const char* args); - bool HandleHonorAddCommand(const char* args); bool HandleHonorAddKillCommand(const char* args); bool HandleHonorUpdateCommand(const char* args); - bool HandleInstanceListBindsCommand(const char* args); bool HandleInstanceUnbindCommand(const char* args); bool HandleInstanceStatsCommand(const char* args); bool HandleInstanceSaveDataCommand(const char * args); - bool HandleLearnCommand(const char* args); bool HandleLearnAllCommand(const char* args); bool HandleLearnAllGMCommand(const char* args); @@ -242,12 +205,10 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleLearnAllMyPetTalentsCommand(const char* args); bool HandleLearnAllMySpellsCommand(const char* args); bool HandleLearnAllMyTalentsCommand(const char* args); - bool HandleListAurasCommand(const char * args); bool HandleListCreatureCommand(const char* args); bool HandleListItemCommand(const char* args); bool HandleListObjectCommand(const char* args); - bool HandleLookupAreaCommand(const char* args); bool HandleLookupCreatureCommand(const char* args); bool HandleLookupEventCommand(const char* args); @@ -264,7 +225,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleLookupTaxiNodeCommand(const char * args); bool HandleLookupTeleCommand(const char * args); bool HandleLookupMapCommand(const char* args); - bool HandleModifyKnownTitlesCommand(const char* args); bool HandleModifyHPCommand(const char* args); bool HandleModifyManaCommand(const char* args); @@ -288,7 +248,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleModifyArenaCommand(const char* args); bool HandleModifyPhaseCommand(const char* args); bool HandleModifyGenderCommand(const char* args); - //-----------------------Npc Commands----------------------- bool HandleNpcAddCommand(const char* args); bool HandleNpcAddMoveCommand(const char* args); @@ -318,20 +277,16 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleNpcYellCommand(const char* args); bool HandleNpcAddFormationCommand(const char* args); bool HandleNpcSetLinkCommand(const char* args); - //TODO: NpcCommands that needs to be fixed : bool HandleNpcAddWeaponCommand(const char* args); bool HandleNpcNameCommand(const char* args); bool HandleNpcSubNameCommand(const char* args); //---------------------------------------------------------- - bool HandlePDumpLoadCommand(const char *args); bool HandlePDumpWriteCommand(const char *args); - bool HandleQuestAdd(const char * args); bool HandleQuestRemove(const char * args); bool HandleQuestComplete(const char * args); - bool HandleReloadAllCommand(const char* args); bool HandleReloadAllAchievementCommand(const char* args); bool HandleReloadAllAreaCommand(const char* args); @@ -343,9 +298,7 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleReloadAllEventAICommand(const char* args); bool HandleReloadAllSpellCommand(const char* args); bool HandleReloadAllLocalesCommand(const char* args); - bool HandleReloadConfigCommand(const char* args); - bool HandleReloadAccessRequirementCommand(const char* args); bool HandleReloadAchievementCriteriaDataCommand(const char* args); bool HandleReloadAchievementRewardCommand(const char* args); @@ -420,7 +373,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleReloadSpellDisabledCommand(const char* args); bool HandleReloadAuctionsCommand(const char* args); bool HandleReloadWpScriptsCommand(const char* args); - bool HandleResetAchievementsCommand(const char * args); bool HandleResetAllCommand(const char * args); bool HandleResetHonorCommand(const char * args); @@ -428,12 +380,10 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleResetSpellsCommand(const char * args); bool HandleResetStatsCommand(const char * args); bool HandleResetTalentsCommand(const char * args); - bool HandleSendItemsCommand(const char* args); bool HandleSendMailCommand(const char* args); bool HandleSendMessageCommand(const char * args); bool HandleSendMoneyCommand(const char* args); - bool HandleServerCorpsesCommand(const char* args); bool HandleServerExitCommand(const char* args); bool HandleServerIdleRestartCommand(const char* args); @@ -447,20 +397,16 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleServerShutDownCommand(const char* args); bool HandleServerShutDownCancelCommand(const char* args); bool HandleServerSetClosedCommand(const char* args); - bool HandleServerSetLogFileLevelCommand(const char* args); bool HandleServerSetDiffTimeCommand(const char* args); - bool HandleTeleCommand(const char * args); bool HandleTeleAddCommand(const char * args); bool HandleTeleDelCommand(const char * args); bool HandleTeleGroupCommand(const char* args); bool HandleTeleNameCommand(const char* args); - bool HandleUnBanAccountCommand(const char* args); bool HandleUnBanCharacterCommand(const char* args); bool HandleUnBanIPCommand(const char* args); - bool HandleWpAddCommand(const char* args); bool HandleWpLoadPathCommand(const char* args); bool HandleWpUnLoadPathCommand(const char* args); @@ -468,13 +414,11 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleWpEventCommand(const char* args); bool HandleWpShowCommand(const char* args); bool HandleReloadAllPaths(const char *args); - bool HandleHelpCommand(const char* args); bool HandleCommandsCommand(const char* args); bool HandleStartCommand(const char* args); bool HandleDismountCommand(const char* args); bool HandleSaveCommand(const char* args); - bool HandleNamegoCommand(const char* args); bool HandleGonameCommand(const char* args); bool HandleGroupgoCommand(const char* args); @@ -485,9 +429,7 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleTaxiCheatCommand(const char* args); bool HandleWhispersCommand(const char* args); bool HandleModifyDrunkCommand(const char* args); - bool HandleLoadScriptsCommand(const char* args); - bool HandleGUIDCommand(const char* args); bool HandleItemMoveCommand(const char* args); bool HandleDeMorphCommand(const char* args); @@ -498,7 +440,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleFreezeCommand(const char *args); bool HandleUnFreezeCommand(const char *args); bool HandleListFreezeCommand(const char* args); - bool HandleCooldownCommand(const char* args); bool HandleUnLearnCommand(const char* args); bool HandleGetDistanceCommand(const char* args); @@ -525,15 +466,12 @@ class TRINITY_DLL_SPEC ChatHandler bool HandlePetUnlearnCommand(const char* args); bool HandlePetLearnCommand(const char* args); bool HandleCreatePetCommand(const char* args); - bool HandleGroupLeaderCommand(const char* args); bool HandleGroupDisbandCommand(const char* args); bool HandleGroupRemoveCommand(const char* args); - bool HandleBankCommand(const char* args); bool HandleChangeWeather(const char* args); bool HandleKickPlayerCommand(const char * args); - // GM ticket command handlers bool HandleGMTicketListCommand(const char* args); bool HandleGMTicketListOnlineCommand(const char* args); @@ -546,44 +484,33 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleGMTicketCommentCommand(const char* args); bool HandleGMTicketDeleteByIdCommand(const char* args); bool HandleGMTicketReloadCommand(const char*); - bool HandleMaxSkillCommand(const char* args); bool HandleSetSkillCommand(const char* args); bool HandleRespawnCommand(const char* args); bool HandleComeToMeCommand(const char *args); bool HandleCombatStopCommand(const char *args); - /*bool HandleCharDeleteCommand(const char *args); bool HandleSendMessageCommand(const char * args);*/ - bool HandleFlushArenaPointsCommand(const char *args); bool HandlePlayAllCommand(const char* args); bool HandleRepairitemsCommand(const char* args); - bool HandleTempGameObjectCommand(const char* args); bool HandleTempAddSpwCommand(const char* args); - //! Development Commands - /*bool HandleQuestAdd(const char * args); bool HandleQuestRemove(const char * args); bool HandleQuestComplete(const char * args);*/ - //bool HandleSet32Bit(const char* args); bool HandleSaveAllCommand(const char* args); - Player* getSelectedPlayer(); Creature* getSelectedCreature(); Unit* getSelectedUnit(); WorldObject* getSelectedObject(); - char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL); char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL); - // if args have single value then it return in arg2 and arg1 == NULL void extractOptFirstArg(char* args, char** arg1, char** arg2); char* extractQuotedArg(char* args); - uint32 extractSpellIdFromLink(char* text); uint64 extractGuidFromLink(char* text); GameTele const* extractGameTeleFromLink(char* text); @@ -591,13 +518,10 @@ class TRINITY_DLL_SPEC ChatHandler std::string extractPlayerNameFromLink(char* text); // select by arg (name/link) or in-game selection online/offline player bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL); - std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; } std::string GetNameLink(Player* chr) const { return playerLink(chr->GetName()); } - GameObject* GetNearbyGameObject(); GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry); - // Utility methods for commands bool LookupPlayerSearchCommand(QueryResult* result, int32 limit); bool HandleBanListHelper(QueryResult* result); @@ -606,22 +530,18 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleUnBanHelper(BanMode mode,char const* args); void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id); - void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: WorldSession * m_session; // != NULL for chat command call and NULL for CLI command - // common global flag static bool load_command_table; bool sentErrorMessage; }; - class CliHandler : public ChatHandler { public: typedef void Print(char const*); explicit CliHandler(Print* zprint) : m_print(zprint) {} - // overwrite functions const char *GetTrinityString(int32 entry) const; bool isAvailable(ChatCommand const& cmd) const; @@ -630,12 +550,9 @@ class CliHandler : public ChatHandler bool needReportToTarget(Player* chr) const; LocaleConstant GetSessionDbcLocale() const; int GetSessionDbLocaleIndex() const; - private: Print* m_print; }; - char const *fmtstring( char const *format, ... ); - #endif diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index e5aaab05c9d..11b57618d21 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" @@ -25,7 +24,6 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "Database/DatabaseEnv.h" - #include "CellImpl.h" #include "Chat.h" #include "ChannelMgr.h" @@ -39,7 +37,6 @@ #include "ScriptCalls.h" #include "SpellAuras.h" #include "Util.h" - bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang) { if (lang != LANG_ADDON) @@ -47,7 +44,6 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg // strip invisible characters for non-addon messages if(sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING)) stripLineInvisibleChars(msg); - if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR && !ChatHandler(this).isValidChatMessage(msg.c_str())) { @@ -58,26 +54,20 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg return false; } } - return true; } - void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { uint32 type; uint32 lang; - recv_data >> type; recv_data >> lang; - if(type >= MAX_CHAT_MSG_TYPE) { sLog.outError("CHAT: Wrong message type received: %u", type); return; } - //sLog.outDebug("CHAT: packet received. type %u, lang %u", type, lang ); - // prevent talking at unknown language (cheating) LanguageDesc const* langDesc = GetLanguageDescByID(lang); if(!langDesc) @@ -104,24 +94,20 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) return; } } - if(lang == LANG_ADDON) { if(sWorld.getConfig(CONFIG_CHATLOG_ADDON)) { std::string msg = ""; recv_data >> msg; - if(msg.empty()) { sLog.outDebug("Player %s send empty addon msg", GetPlayer()->GetName()); return; } - sLog.outChat("[ADDON] Player %s sends: %s", GetPlayer()->GetName(), msg.c_str()); } - // Disabled addon channel? if(!sWorld.getConfig(CONFIG_ADDON_CHANNEL)) return; @@ -157,33 +143,27 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) break; } } - // but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used) Unit::AuraEffectList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE); if(!ModLangAuras.empty()) lang = ModLangAuras.front()->GetMiscValue(); } - if (!_player->CanSpeak()) { std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); return; } - if (type != CHAT_MSG_AFK && type != CHAT_MSG_DND) GetPlayer()->UpdateSpeakTime(); } - if (GetPlayer()->HasAura(1852) && type != CHAT_MSG_WHISPER) { std::string msg=""; recv_data >> msg; - SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName()); return; } - switch(type) { case CHAT_MSG_SAY: @@ -192,19 +172,14 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { std::string msg = ""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - if(type == CHAT_MSG_SAY) GetPlayer()->Say(msg, lang); else if(type == CHAT_MSG_EMOTE) @@ -212,19 +187,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) else if(type == CHAT_MSG_YELL) GetPlayer()->Yell(msg, lang); } break; - case CHAT_MSG_WHISPER: { std::string to, msg; recv_data >> to; recv_data >> msg; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - if(!normalizePlayerName(to)) { WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1)); @@ -232,7 +203,6 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) SendPacket(&data); break; } - Player *player = objmgr.GetPlayer(to.c_str()); uint32 tSecurity = GetSecurity(); uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER; @@ -243,7 +213,6 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) SendPacket(&data); return; } - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER ) { uint32 sidea = GetPlayer()->GetTeam(); @@ -256,43 +225,33 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) return; } } - if (GetPlayer()->HasAura(1852) && !player->isGameMaster()) { SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName()); return; } - GetPlayer()->Whisper(msg, lang,player->GetGUID()); } break; - case CHAT_MSG_PARTY: { std::string msg = ""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - // if player is in battleground, he cannot say to battleground members by /p Group *group = GetPlayer()->GetOriginalGroup(); // so if player hasn't OriginalGroup and his player->GetGroup() is BG raid, then return if( !group && (!(group = GetPlayer()->GetGroup()) || group->isBGGroup()) ) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_PARTY, lang, NULL, 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID())); - if(sWorld.getConfig(CONFIG_CHATLOG_PARTY)) sLog.outChat("[PARTY] Player %s tells group with leader %s: %s", GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str()); @@ -302,25 +261,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { std::string msg = ""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - if (GetPlayer()->GetGuildId()) { Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if (guild) guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); - if(lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHATLOG_GUILD)) { sLog.outChat("[GUILD] Player %s tells guild %s: %s", @@ -332,32 +285,25 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str()); } } - break; } case CHAT_MSG_OFFICER: { std::string msg = ""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - if (GetPlayer()->GetGuildId()) { Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if (guild) guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); - if(sWorld.getConfig(CONFIG_CHATLOG_GUILD)) sLog.outChat("[OFFICER] Player %s tells guild %s officers: %s", GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str()); @@ -368,29 +314,22 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { std::string msg=""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - // if player is in battleground, he cannot say to battleground members by /ra Group *group = GetPlayer()->GetOriginalGroup(); // so if player hasn't OriginalGroup and his player->GetGroup() is BG raid or his group isn't raid, then return if ((!group && !(group = GetPlayer()->GetGroup())) || group->isBGGroup() || !group->isRaidGroup()) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID, lang, "", 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false); - if(sWorld.getConfig(CONFIG_CHATLOG_RAID)) sLog.outChat("[RAID] Player %s tells raid with leader %s: %s", GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str()); @@ -399,28 +338,21 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { std::string msg=""; recv_data >> msg; - if(msg.empty()) break; - if (ChatHandler(this).ParseCommands(msg.c_str()) > 0) break; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - // if player is in battleground, he cannot say to battleground members by /ra Group *group = GetPlayer()->GetOriginalGroup(); if( !group && !(group = GetPlayer()->GetGroup()) || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(GetPlayer()->GetGUID())) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_LEADER, lang, "", 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false); - if(sWorld.getConfig(CONFIG_CHATLOG_RAID)) sLog.outChat("[RAID] Leader player %s tells raid: %s", GetPlayer()->GetName(), msg.c_str()); @@ -429,97 +361,74 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) { std::string msg=""; recv_data >> msg; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - Group *group = GetPlayer()->GetGroup(); if(!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup()) return; - WorldPacket data; //in battleground, raid warning is sent only to players in battleground - code is ok ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_WARNING, lang, "", 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false); - if(sWorld.getConfig(CONFIG_CHATLOG_RAID)) sLog.outChat("[RAID] Leader player %s warns raid with: %s", GetPlayer()->GetName(), msg.c_str()); } break; - case CHAT_MSG_BATTLEGROUND: { std::string msg=""; recv_data >> msg; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - //battleground raid is always in Player->GetGroup(), never in GetOriginalGroup() Group *group = GetPlayer()->GetGroup(); if(!group || !group->isBGGroup()) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND, lang, "", 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false); - if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND)) sLog.outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s", GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str()); } break; - case CHAT_MSG_BATTLEGROUND_LEADER: { std::string msg=""; recv_data >> msg; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - //battleground raid is always in Player->GetGroup(), never in GetOriginalGroup() Group *group = GetPlayer()->GetGroup(); if(!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID())) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND_LEADER, lang, "", 0, msg.c_str(),NULL); group->BroadcastPacket(&data, false); - if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND)) sLog.outChat("[RAID] Leader player %s tells battleground: %s", GetPlayer()->GetName(), msg.c_str()); } break; - case CHAT_MSG_CHANNEL: { std::string channel = "", msg = ""; recv_data >> channel; - recv_data >> msg; - if (!processChatmessageFurtherAfterSecurityChecks(msg, lang)) return; - if(msg.empty()) break; - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { Channel *chn = cMgr->GetChannel(channel,_player); if(chn) { chn->Say(_player->GetGUID(),msg.c_str(),lang); - if((chn->HasFlag(CHANNEL_FLAG_TRADE) || chn->HasFlag(CHANNEL_FLAG_GENERAL) || chn->HasFlag(CHANNEL_FLAG_CITY) || @@ -533,12 +442,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) } } } break; - case CHAT_MSG_AFK: { std::string msg; recv_data >> msg; - if((msg.empty() || !_player->isAFK()) && !_player->isInCombat() ) { if(!_player->isAFK()) @@ -552,12 +459,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) _player->ToggleDND(); } } break; - case CHAT_MSG_DND: { std::string msg; recv_data >> msg; - if(msg.empty() || !_player->isDND()) { if(!_player->isDND()) @@ -571,23 +476,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) _player->ToggleAFK(); } } break; - default: sLog.outError("CHAT: unknown message type %u, lang: %u", type, lang); break; } } - void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data ) { if(!GetPlayer()->isAlive()) return; - uint32 emote; recv_data >> emote; GetPlayer()->HandleEmoteCommand(emote); } - namespace MaNGOS { class EmoteChatBuilder @@ -595,12 +496,10 @@ namespace MaNGOS public: EmoteChatBuilder(Player const& pl, uint32 text_emote, uint32 emote_num, Unit const* target) : i_player(pl), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {} - void operator()(WorldPacket& data, int32 loc_idx) { char const* nam = i_target ? i_target->GetNameForLocaleIdx(loc_idx) : NULL; uint32 namlen = (nam ? strlen(nam) : 0) + 1; - data.Initialize(SMSG_TEXT_EMOTE, (20+namlen)); data << i_player.GetGUID(); data << (uint32)i_text_emote; @@ -611,7 +510,6 @@ namespace MaNGOS else data << (uint8)0x00; } - private: Player const& i_player; uint32 i_text_emote; @@ -619,32 +517,25 @@ namespace MaNGOS Unit const* i_target; }; } // namespace MaNGOS - void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data ) { if(!GetPlayer()->isAlive()) return; - if (!GetPlayer()->CanSpeak()) { std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); return; } - uint32 text_emote, emoteNum; uint64 guid; - recv_data >> text_emote; recv_data >> emoteNum; recv_data >> guid; - EmotesTextEntry const *em = sEmotesTextStore.LookupEntry(text_emote); if (!em) return; - uint32 emote_anim = em->textid; - switch(emote_anim) { case EMOTE_STATE_SLEEP: @@ -656,47 +547,36 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data ) GetPlayer()->HandleEmoteCommand(emote_anim); break; } - Unit* unit = ObjectAccessor::GetUnit(*_player, guid); - CellPair p = MaNGOS::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); - Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::EmoteChatBuilder emote_builder(*GetPlayer(), text_emote, emoteNum, unit); MaNGOS::LocalizedPacketDo emote_do(emote_builder); MaNGOS::PlayerDistWorker > emote_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),emote_do); TypeContainerVisitor >, WorldTypeMapContainer > message(emote_worker); CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); - GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit); - //Send scripted event call if (unit && unit->GetTypeId()==TYPEID_UNIT && ((Creature*)unit)->AI()) ((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(),text_emote); } - void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data ) { uint64 iguid; uint8 unk; //sLog.outDebug("WORLD: Received CMSG_CHAT_IGNORED"); - recv_data >> iguid; recv_data >> unk; // probably related to spam reporting - Player *player = objmgr.GetPlayer(iguid); if(!player || !player->GetSession()) return; - WorldPacket data; ChatHandler::FillMessageData(&data, this, CHAT_MSG_IGNORED, LANG_UNIVERSAL, NULL, GetPlayer()->GetGUID(), GetPlayer()->GetName(),NULL); player->GetSession()->SendPacket(&data); } - void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); diff --git a/src/game/CombatAI.cpp b/src/game/CombatAI.cpp index b18e6dd7532..00d06b9ec33 100644 --- a/src/game/CombatAI.cpp +++ b/src/game/CombatAI.cpp @@ -17,64 +17,51 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "CombatAI.h" #include "SpellMgr.h" - int AggressorAI::Permissible(const Creature *creature) { // have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight if( !creature->isCivilian() && !creature->IsNeutralToAll() ) return PERMIT_BASE_PROACTIVE; - return PERMIT_BASE_NO; } - void AggressorAI::UpdateAI(const uint32 /*diff*/) { if(!UpdateVictim()) return; - DoMeleeAttackIfReady(); } - // some day we will delete these useless things int CombatAI::Permissible(const Creature *creature) { return PERMIT_BASE_NO; } - int ArchorAI::Permissible(const Creature *creature) { return PERMIT_BASE_NO; } - int TurretAI::Permissible(const Creature *creature) { return PERMIT_BASE_NO; } - void CombatAI::InitializeAI() { for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) if(me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i])) spells.push_back(me->m_spells[i]); - CreatureAI::InitializeAI(); } - void CombatAI::Reset() { events.Reset(); } - void CombatAI::JustDied(Unit *killer) { for(SpellVct::iterator i = spells.begin(); i != spells.end(); ++i) if(AISpellInfo[*i].condition == AICOND_DIE) me->CastSpell(killer, *i, true); } - void CombatAI::EnterCombat(Unit *who) { for(SpellVct::iterator i = spells.begin(); i != spells.end(); ++i) @@ -85,17 +72,13 @@ void CombatAI::EnterCombat(Unit *who) events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown); } } - void CombatAI::UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - events.Update(diff); - if(me->hasUnitState(UNIT_STAT_CASTING)) return; - if(uint32 spellId = events.ExecuteEvent()) { DoCast(spellId); @@ -105,15 +88,12 @@ void CombatAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } - ///////////////// //CasterAI ///////////////// - void CasterAI::InitializeAI() { CombatAI::InitializeAI(); - float m_attackDist = 30.0f; for(SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr) if (AISpellInfo[*itr].condition == AICOND_COMBAT && m_attackDist > GetAISpellInfo(*itr)->maxRange) @@ -121,12 +101,10 @@ void CasterAI::InitializeAI() if (m_attackDist == 30.0f) m_attackDist = MELEE_RANGE; } - void CasterAI::EnterCombat(Unit *who) { if (spells.empty()) return; - uint32 spell = rand()%spells.size(); uint32 count = 0; for(SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count) @@ -145,17 +123,13 @@ void CasterAI::EnterCombat(Unit *who) } } } - void CasterAI::UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - events.Update(diff); - if(me->hasUnitState(UNIT_STAT_CASTING)) return; - if(uint32 spellId = events.ExecuteEvent()) { DoCast(spellId); @@ -164,11 +138,9 @@ void CasterAI::UpdateAI(const uint32 diff) } } - ////////////// //ArchorAI ////////////// - ArchorAI::ArchorAI(Creature *c) : CreatureAI(c) { ASSERT(me->m_spells[0]); @@ -178,12 +150,10 @@ ArchorAI::ArchorAI(Creature *c) : CreatureAI(c) me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false); me->m_SightDistance = me->m_CombatDistance; } - void ArchorAI::AttackStart(Unit *who) { if(!who) return; - if(me->IsWithinCombatRange(who, m_minRange)) { if(me->Attack(who, true) && !who->IsFlying()) @@ -194,27 +164,22 @@ void ArchorAI::AttackStart(Unit *who) if(me->Attack(who, false) && !who->IsFlying()) me->GetMotionMaster()->MoveChase(who, me->m_CombatDistance); } - if(who->IsFlying()) me->GetMotionMaster()->MoveIdle(); } - void ArchorAI::UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - if(!me->IsWithinCombatRange(me->getVictim(), m_minRange)) DoSpellAttackIfReady(me->m_spells[0]); else DoMeleeAttackIfReady(); } - ////////////// //TurretAI ////////////// - TurretAI::TurretAI(Creature *c) : CreatureAI(c) { ASSERT(me->m_spells[0]); @@ -222,7 +187,6 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c) me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false); me->m_SightDistance = me->m_CombatDistance; } - bool TurretAI::CanAIAttack(const Unit *who) const { // TODO: use one function to replace it @@ -231,20 +195,16 @@ bool TurretAI::CanAIAttack(const Unit *who) const return false; return true; } - void TurretAI::AttackStart(Unit *who) { if(who) me->Attack(who, false); } - void TurretAI::UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; - DoSpellAttackIfReady(me->m_spells[0]); - //if(!DoSpellAttackIfReady(me->m_spells[0])) //if(HostilReference *ref = me->getThreatManager().getCurrentVictim()) //ref->removeReference(); diff --git a/src/game/CombatAI.h b/src/game/CombatAI.h index 5ded95601ae..d63ee424bf5 100644 --- a/src/game/CombatAI.h +++ b/src/game/CombatAI.h @@ -17,31 +17,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_COMBATAI_H #define TRINITY_COMBATAI_H - #include "CreatureAI.h" #include "CreatureAIImpl.h" - class Creature; - class TRINITY_DLL_DECL AggressorAI : public CreatureAI { public: explicit AggressorAI(Creature *c) : CreatureAI(c) {} - void UpdateAI(const uint32); static int Permissible(const Creature *); }; - typedef std::vector SpellVct; - class TRINITY_DLL_SPEC CombatAI : public CreatureAI { public: explicit CombatAI(Creature *c) : CreatureAI(c) {} - void InitializeAI(); void Reset(); void EnterCombat(Unit* who); @@ -52,7 +44,6 @@ class TRINITY_DLL_SPEC CombatAI : public CreatureAI EventMap events; SpellVct spells; }; - class TRINITY_DLL_SPEC CasterAI : public CombatAI { public: @@ -64,19 +55,16 @@ class TRINITY_DLL_SPEC CasterAI : public CombatAI private: float m_attackDist; }; - struct TRINITY_DLL_SPEC ArchorAI : public CreatureAI { public: explicit ArchorAI(Creature *c); void AttackStart(Unit *who); void UpdateAI(const uint32 diff); - static int Permissible(const Creature *); protected: float m_minRange; }; - struct TRINITY_DLL_SPEC TurretAI : public CreatureAI { public: @@ -84,10 +72,8 @@ struct TRINITY_DLL_SPEC TurretAI : public CreatureAI bool CanAIAttack(const Unit *who) const; void AttackStart(Unit *who); void UpdateAI(const uint32 diff); - static int Permissible(const Creature *); protected: float m_minRange; }; - #endif diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp index 095986303f8..80ca6ba3532 100644 --- a/src/game/CombatHandler.cpp +++ b/src/game/CombatHandler.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "Log.h" #include "WorldPacket.h" @@ -25,61 +24,47 @@ #include "ObjectAccessor.h" #include "CreatureAI.h" #include "ObjectDefines.h" - void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) { uint64 guid; recv_data >> guid; - DEBUG_LOG( "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid) ); - Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid); - if(!pEnemy) { if(!IS_UNIT_GUID(guid)) sLog.outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); else sLog.outError( "WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid)); - // stop attack state at client SendAttackStop(NULL); return; } - if(!_player->canAttack(pEnemy)) { sLog.outError( "WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid)); - // stop attack state at client SendAttackStop(pEnemy); return; } - _player->Attack(pEnemy,true); } - void WorldSession::HandleAttackStopOpcode( WorldPacket & /*recv_data*/ ) { GetPlayer()->AttackStop(); } - void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data ) { uint32 sheathed; recv_data >> sheathed; - //sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed ); - if(sheathed >= MAX_SHEATH_STATE) { sLog.outError("Unknown sheath state %u ??",sheathed); return; } - GetPlayer()->SetSheath(SheathState(sheathed)); } - void WorldSession::SendAttackStop(Unit const* enemy) { WorldPacket data( SMSG_ATTACKSTOP, (4+20) ); // we guess size diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 23477c6e62f..76531d35f01 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -17,19 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Creature.h" #include "MapManager.h" #include "Opcodes.h" #include "ConfusedMovementGenerator.h" #include "DestinationHolderImp.h" #include "VMapFactory.h" - #ifdef MAP_BASED_RAND_GEN #define rand_norm() unit.rand_norm() #define urand(a,b) unit.urand(a,b) #endif - template void ConfusedMovementGenerator::Initialize(T &unit) @@ -39,35 +36,26 @@ ConfusedMovementGenerator::Initialize(T &unit) x = unit.GetPositionX(); y = unit.GetPositionY(); z = unit.GetPositionZ(); - Map const* map = unit.GetBaseMap(); - i_nextMove = 1; - bool is_water_ok, is_land_ok; _InitSpecific(unit, is_water_ok, is_land_ok); - VMAP::IVMapManager *vMaps = VMAP::VMapFactory::createOrGetVMapManager(); - for(unsigned int idx=0; idx < MAX_CONF_WAYPOINTS+1; ++idx) { const float wanderX=wander_distance*rand_norm() - wander_distance/2; const float wanderY=wander_distance*rand_norm() - wander_distance/2; - - const bool isInLoS = vMaps->isInLineOfSight(unit.GetMapId(), x, y, z + 2.0f, i_waypoints[idx][0], i_waypoints[idx][1], z + 2.0f); + const bool isInLoS = vMaps->isInLineOfSight(unit.GetMapId(), x, y, z + 2.0f, i_waypoints[idx][0], i_waypoints[idx][1], z + 2.0f); if (!isInLoS) { - i_waypoints[idx][0] = x; + i_waypoints[idx][0] = x; i_waypoints[idx][1] = y; } - i_waypoints[idx][0] = x + wanderX; i_waypoints[idx][1] = y + wanderY; - // prevent invalid coordinates generation Trinity::NormalizeMapCoord(i_waypoints[idx][0]); Trinity::NormalizeMapCoord(i_waypoints[idx][1]); - bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z); // if generated wrong path just ignore if ((is_water && !is_water_ok) || (!is_water && !is_land_ok)) @@ -75,11 +63,9 @@ ConfusedMovementGenerator::Initialize(T &unit) i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; } - unit.UpdateGroundPositionZ(i_waypoints[idx][0],i_waypoints[idx][1],z); i_waypoints[idx][2] = z; } - unit.SetUInt64Value(UNIT_FIELD_TARGET, 0); unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); unit.CastStop(); @@ -87,7 +73,6 @@ ConfusedMovementGenerator::Initialize(T &unit) unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); unit.addUnitState(UNIT_STAT_CONFUSED); } - template<> void ConfusedMovementGenerator::_InitSpecific(Creature &creature, bool &is_water_ok, bool &is_land_ok) @@ -95,7 +80,6 @@ ConfusedMovementGenerator::_InitSpecific(Creature &creature, bool &is_ is_water_ok = creature.canSwim(); is_land_ok = creature.canWalk(); } - template<> void ConfusedMovementGenerator::_InitSpecific(Player &, bool &is_water_ok, bool &is_land_ok) @@ -103,7 +87,6 @@ ConfusedMovementGenerator::_InitSpecific(Player &, bool &is_water_ok, bo is_water_ok = true; is_land_ok = true; } - template void ConfusedMovementGenerator::Reset(T &unit) @@ -113,17 +96,14 @@ ConfusedMovementGenerator::Reset(T &unit) i_destinationHolder.ResetUpdate(); unit.StopMoving(); } - template bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) { if(!&unit) return true; - if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) return true; - if( i_nextMoveTime.Passed() ) { // currently moving, update location @@ -134,7 +114,6 @@ ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) { // arrived, stop and wait a bit unit.clearUnitState(UNIT_STAT_MOVE); - i_nextMove = urand(1,MAX_CONF_WAYPOINTS); i_nextMoveTime.Reset(urand(0, 1500-1)); // TODO: check the minimum reset time, should be probably higher } @@ -157,7 +136,6 @@ ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) } return true; } - template void ConfusedMovementGenerator::Finalize(T &unit) @@ -167,7 +145,6 @@ ConfusedMovementGenerator::Finalize(T &unit) if(unit.GetTypeId() == TYPEID_UNIT && unit.getVictim()) unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID()); } - template void ConfusedMovementGenerator::Initialize(Player &player); template void ConfusedMovementGenerator::Initialize(Creature &creature); template void ConfusedMovementGenerator::Finalize(Player &player); diff --git a/src/game/ConfusedMovementGenerator.h b/src/game/ConfusedMovementGenerator.h index ad47b13cb39..0675ea49e4c 100644 --- a/src/game/ConfusedMovementGenerator.h +++ b/src/game/ConfusedMovementGenerator.h @@ -17,35 +17,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CONFUSEDGENERATOR_H #define TRINITY_CONFUSEDGENERATOR_H - #include "MovementGenerator.h" #include "DestinationHolder.h" #include "Traveller.h" - #define MAX_CONF_WAYPOINTS 24 - template class TRINITY_DLL_SPEC ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator > { public: explicit ConfusedMovementGenerator() : i_nextMoveTime(0) {} - void Initialize(T &); void Finalize(T &); void Reset(T &); bool Update(T &, const uint32 &); - bool GetDestination(float &x, float &y, float &z) const { if(i_destinationHolder.HasArrived()) return false; i_destinationHolder.GetDestination(x,y,z); return true; } - MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; } private: void _InitSpecific(T &, bool &, bool &); diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 16e52ef46aa..350e314152d 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "Corpse.h" #include "Player.h" @@ -27,87 +26,65 @@ #include "Opcodes.h" #include "GossipDef.h" #include "World.h" - Corpse::Corpse(CorpseType type) : WorldObject() , m_type(type) { m_objectType |= TYPEMASK_CORPSE; m_objectTypeId = TYPEID_CORPSE; - m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION); - m_valuesCount = CORPSE_END; - m_time = time(NULL); - lootForBody = false; - if(type != CORPSE_BONES) m_isWorldObject = true; } - Corpse::~Corpse() { } - void Corpse::AddToWorld() { ///- Register the corpse for guid lookup if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this); - Object::AddToWorld(); } - void Corpse::RemoveFromWorld() { ///- Remove the corpse from the accessor if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this); - Object::RemoveFromWorld(); } - bool Corpse::Create( uint32 guidlow, Map *map ) { SetMap(map); Object::_Create(guidlow, 0, HIGHGUID_CORPSE); return true; } - bool Corpse::Create( uint32 guidlow, Player *owner) { ASSERT(owner); - Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation()); - if(!IsPositionValid()) { sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY()); return false; } - //we need to assign owner's map for corpse //in other way we will get a crash in Corpse::SaveToDB() SetMap(owner->GetMap()); - WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); - SetFloatValue( OBJECT_FIELD_SCALE_X, 1 ); SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() ); - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); - return true; } - void Corpse::SaveToDB() { // prevent DB data inconsistence problems and duplicates CharacterDatabase.BeginTransaction(); DeleteFromDB(); - std::ostringstream ss; ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES (" << GetGUIDLow() << ", " @@ -128,21 +105,17 @@ void Corpse::SaveToDB() CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.CommitTransaction(); } - void Corpse::DeleteBonesFromWorld() { assert(GetType() == CORPSE_BONES); Corpse* corpse = ObjectAccessor::GetCorpse(*this, GetGUID()); - if (!corpse) { sLog.outError("Bones %u not found in world.", GetGUIDLow()); return; } - AddObjectToRemoveList(); } - void Corpse::DeleteFromDB() { if(GetType() == CORPSE_BONES) @@ -152,7 +125,6 @@ void Corpse::DeleteFromDB() // all corpses (not bones) CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID())); } - /* bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId) { @@ -160,29 +132,22 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId) if (!external) // 0 1 2 3 4 5 6 7 8 9 result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid); - if( !result ) { sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid); return false; } - Field *fields = result->Fetch(); - if(!LoadFromDB(guid, fields)) { if (!external) delete result; - return false; } - if (!external) delete result; - return true; }*/ - bool Corpse::LoadFromDB(uint32 guid, Field *fields) { // 0 1 2 3 4 5 6 7 8 9 @@ -192,52 +157,39 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) float positionZ = fields[2].GetFloat(); float ort = fields[3].GetFloat(); uint32 mapid = fields[4].GetUInt32(); - Object::_Create(guid, 0, HIGHGUID_CORPSE); - if(!LoadValues( fields[5].GetString() )) { sLog.outError("Corpse #%d have broken data in `data` field. Can't be loaded.",guid); return false; } - m_time = time_t(fields[6].GetUInt64()); m_type = CorpseType(fields[7].GetUInt32()); - if(m_type >= MAX_CORPSE_TYPE) { sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID())); return false; } - if(m_type != CORPSE_BONES) m_isWorldObject = true; - uint32 instanceid = fields[8].GetUInt32(); - uint32 phaseMask = fields[9].GetUInt32(); - // overwrite possible wrong/corrupted guid SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_CORPSE)); - // place SetLocationInstanceId(instanceid); SetLocationMapId(mapid); SetPhaseMask(phaseMask, false); Relocate(positionX, positionY, positionZ, ort); - if(!IsPositionValid()) { sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), GetPositionX(), GetPositionY()); return false; } - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); - return true; } - bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u->m_seer, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); diff --git a/src/game/Corpse.h b/src/game/Corpse.h index e0374a03470..ca9a16d8ced 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITYCORE_CORPSE_H #define TRINITYCORE_CORPSE_H - #include "Object.h" #include "Database/DatabaseEnv.h" #include "GridDefines.h" #include "LootMgr.h" - enum CorpseType { CORPSE_BONES = 0, @@ -33,10 +30,8 @@ enum CorpseType CORPSE_RESURRECTABLE_PVP = 2 }; #define MAX_CORPSE_TYPE 3 - // Value equal client resurrection dialog show radius. #define CORPSE_RECLAIM_RADIUS 39 - enum CorpseFlags { CORPSE_FLAG_NONE = 0x00, @@ -47,51 +42,38 @@ enum CorpseFlags CORPSE_FLAG_HIDE_CLOAK = 0x10, CORPSE_FLAG_LOOTABLE = 0x20 }; - class Corpse : public WorldObject { public: explicit Corpse( CorpseType type = CORPSE_BONES ); ~Corpse( ); - void AddToWorld(); void RemoveFromWorld(); - bool Create( uint32 guidlow, Map *map ); bool Create( uint32 guidlow, Player *owner ); - void SaveToDB(); //bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); bool LoadFromDB(uint32 guid, Field *fields); - void DeleteBonesFromWorld(); void DeleteFromDB(); - uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); } - time_t const& GetGhostTime() const { return m_time; } void ResetGhostTime() { m_time = time(NULL); } CorpseType GetType() const { return m_type; } - GridPair const& GetGrid() const { return m_grid; } void SetGrid(GridPair const& grid) { m_grid = grid; } - bool isVisibleForInState(Player const* u, bool inVisibleList) const; - Loot loot; // remove insignia ONLY at BG Player* lootRecipient; bool lootForBody; - void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } - GridReference &GetGridRef() { return m_gridRef; } private: GridReference m_gridRef; - CorpseType m_type; time_t m_time; GridPair m_grid; // gride for corpse position for fast search diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a3a2e5c1690..63c9d34d157 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "Database/DatabaseEnv.h" #include "WorldPacket.h" @@ -49,16 +48,13 @@ #include "Vehicle.h" // apply implementation of the singletons #include "Policies/SingletonImp.h" - TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const { TrainerSpellMap::const_iterator itr = spellList.find(spell_id); if (itr != spellList.end()) return &itr->second; - return NULL; } - bool VendorItemData::RemoveItem( uint32 item_id ) { for(VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i ) @@ -71,7 +67,6 @@ bool VendorItemData::RemoveItem( uint32 item_id ) } return false; } - size_t VendorItemData::FindItemSlot(uint32 item_id) const { for(size_t i = 0; i < m_items.size(); ++i ) @@ -79,7 +74,6 @@ size_t VendorItemData::FindItemSlot(uint32 item_id) const return i; return m_items.size(); } - VendorItem const* VendorItemData::FindItem(uint32 item_id) const { for(VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i ) @@ -87,20 +81,16 @@ VendorItem const* VendorItemData::FindItem(uint32 item_id) const return *i; return NULL; } - uint32 CreatureInfo::GetRandomValidModelId() const { uint8 c = 0; uint32 modelIDs[4]; - if (Modelid1) modelIDs[c++] = Modelid1; if (Modelid2) modelIDs[c++] = Modelid2; if (Modelid3) modelIDs[c++] = Modelid3; if (Modelid4) modelIDs[c++] = Modelid4; - return ((c>0) ? modelIDs[urand(0,c-1)] : 0); } - uint32 CreatureInfo::GetFirstValidModelId() const { if(Modelid1) return Modelid1; @@ -109,7 +99,6 @@ uint32 CreatureInfo::GetFirstValidModelId() const if(Modelid4) return Modelid4; return 0; } - bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { if(Unit* victim = Unit::GetUnit(m_owner, m_victim)) @@ -118,7 +107,6 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Creature* assistant = Unit::GetCreature(m_owner, *m_assistants.begin()); m_assistants.pop_front(); - if (assistant && assistant->CanAssistTo(&m_owner, victim)) { assistant->SetNoCallAssistance(true); @@ -130,7 +118,6 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) } return true; } - Creature::Creature() : Unit(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), @@ -145,34 +132,27 @@ m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL) { m_regenTimer = 200; m_valuesCount = UNIT_END; - for(uint8 i =0; iInstall(); } } - void Creature::RemoveFromWorld() { if(IsInWorld()) @@ -201,7 +180,6 @@ void Creature::RemoveFromWorld() ObjectAccessor::Instance().RemoveObject(this); } } - void Creature::DisappearAndDie() { DestroyForNearbyPlayers(); @@ -211,26 +189,21 @@ void Creature::DisappearAndDie() setDeathState(JUST_DIED); RemoveCorpse(); } - void Creature::SearchFormation() { if(isSummon()) return; - uint32 lowguid = GetDBTableGUIDLow(); if(!lowguid) return; - CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid); if(frmdata != CreatureGroupMap.end()) formation_mgr.AddCreatureToGroup(frmdata->second->leaderGUID, this); } - void Creature::RemoveCorpse() { if ((getDeathState()!=CORPSE && !m_isDeadByDefault) || (getDeathState()!=ALIVE && m_isDeadByDefault)) return; - m_deathTimer = 0; setDeathState(DEAD); ObjectAccessor::UpdateObjectVisibility(this); @@ -238,15 +211,12 @@ void Creature::RemoveCorpse() uint32 respawnDelay = m_respawnDelay; if (AI()) AI()->CorpseRemoved(respawnDelay); - m_respawnTime = time(NULL) + m_respawnDelay; - float x,y,z,o; GetRespawnCoord(x, y, z, &o); SetHomePosition(x,y,z,o); GetMap()->CreatureRelocation(this,x,y,z,o); } - /** * change the entry of creature until respawn */ @@ -258,7 +228,6 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) sLog.outErrorDb("Creature::UpdateEntry creature entry %u does not exist.", Entry); return false; } - // get heroic mode entry uint32 actualEntry = Entry; CreatureInfo const *cinfo = normalInfo; @@ -275,23 +244,18 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) } } } - SetEntry(Entry); // normal entry always m_creatureInfo = cinfo; // map mode related always - // equal to player Race field, but creature does not have race SetByteValue(UNIT_FIELD_BYTES_0, 0, 0); - // known valid are: CLASS_WARRIOR,CLASS_PALADIN,CLASS_ROGUE,CLASS_MAGE SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class)); - // Cancel load if no model defined if (!(cinfo->GetFirstValidModelId())) { sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry); return false; } - uint32 display_id = objmgr.ChooseDisplayId(0, GetCreatureInfo(), data); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (!minfo) // Cancel load if no model defined @@ -299,13 +263,10 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry); return false; } - display_id = minfo->modelid; // it can be different (for another gender) - SetDisplayId(display_id); SetNativeDisplayId(display_id); SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender); - // Load creature equipment if(!data || data->equipmentId == 0) { // use default from the template @@ -315,61 +276,44 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) { // override, -1 means no equipment LoadEquipment(data->equipmentId); } - SetName(normalInfo->Name); // at normal entry always - SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach ); - SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); - SetSpeed(MOVE_WALK, cinfo->speed ); SetSpeed(MOVE_RUN, cinfo->speed ); SetSpeed(MOVE_SWIM, cinfo->speed ); - SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale); - // checked at loading m_defaultMovementType = MovementGeneratorType(cinfo->MovementType); if(!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE) m_defaultMovementType = IDLE_MOTION_TYPE; - for(uint8 i=0; i < CREATURE_MAX_SPELLS; ++i) m_spells[i] = GetCreatureInfo()->spells[i]; - return true; } - bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) { if(!InitEntry(Entry,team,data)) return false; - m_regenHealth = GetCreatureInfo()->RegenHealth; - // creatures always have melee weapon ready if any SetSheath(SHEATH_STATE_MELEE); - SelectLevel(GetCreatureInfo()); if (team == HORDE) setFaction(GetCreatureInfo()->faction_H); else setFaction(GetCreatureInfo()->faction_A); - if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag | gameeventmgr.GetNPCFlag(this)); else SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); - SetAttackTime(BASE_ATTACK, GetCreatureInfo()->baseattacktime); SetAttackTime(OFF_ATTACK, GetCreatureInfo()->baseattacktime); SetAttackTime(RANGED_ATTACK,GetCreatureInfo()->rangeattacktime); - SetUInt32Value(UNIT_FIELD_FLAGS,GetCreatureInfo()->unit_flags); SetUInt32Value(UNIT_DYNAMIC_FLAGS,GetCreatureInfo()->dynamicflags); - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->dmgschool)); SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(GetCreatureInfo()->armor)); SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(GetCreatureInfo()->resistance1)); @@ -378,10 +322,8 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(GetCreatureInfo()->resistance4)); SetModifierValue(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(GetCreatureInfo()->resistance5)); SetModifierValue(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(GetCreatureInfo()->resistance6)); - SetCanModifyStats(true); UpdateAllStats(); - FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->faction_A); if (factionTemplate) // check and error show at loading templates { @@ -391,11 +333,9 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) (factionEntry->team == ALLIANCE || factionEntry->team == HORDE) ) SetPvP(true); } - // HACK: trigger creature is always not selectable if(isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if(isTotem() || isTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER) SetReactState(REACT_PASSIVE); @@ -403,26 +343,21 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetReactState(REACT_DEFENSIVE);*/ else SetReactState(REACT_AGGRESSIVE); - if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT) { ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } - if(GetCreatureInfo()->InhabitType & INHABIT_AIR) AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE + MOVEMENTFLAG_FLYING); - return true; } - void Creature::Update(uint32 diff) { if(m_GlobalCooldown <= diff) m_GlobalCooldown = 0; else m_GlobalCooldown -= diff; - switch( m_deathState ) { case JUST_ALIVED: @@ -459,7 +394,6 @@ void Creature::Update(uint32 diff) { if (m_isDeadByDefault) break; - if( m_deathTimer <= diff ) { RemoveCorpse(); @@ -469,7 +403,6 @@ void Creature::Update(uint32 diff) { // for delayed spells m_Events.Update( diff ); - m_deathTimer -= diff; if (m_groupLootTimer && lootingGroupLeaderGUID) { @@ -487,7 +420,6 @@ void Creature::Update(uint32 diff) } } } - break; } case ALIVE: @@ -504,14 +436,11 @@ void Creature::Update(uint32 diff) m_deathTimer -= diff; } } - Unit::Update( diff ); - // creature can be dead after Unit::Update call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) if(!isAlive()) break; - // if creature is charmed, switch to charmed AI if(NeedChangeAI) { @@ -519,7 +448,6 @@ void Creature::Update(uint32 diff) NeedChangeAI = false; IsAIEnabled = true; } - if(!IsInEvadeMode() && IsAIEnabled) { // do not allow the AI to be changed during update @@ -527,12 +455,10 @@ void Creature::Update(uint32 diff) i_AI->UpdateAI(diff); m_AI_locked = false; } - // creature can be dead after UpdateAI call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) if(!isAlive()) break; - if(m_regenTimer > 0) { if(diff >= m_regenTimer) @@ -540,20 +466,16 @@ void Creature::Update(uint32 diff) else m_regenTimer -= diff; } - if (m_regenTimer != 0) break; - bool bIsPolymorphed = IsPolymorphed(); bool bInCombat = isInCombat() && (!getVictim() || // if isInCombat() is true and this has no victim !getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player !getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()->isGameMaster()); // or the victim/owner/charmer is not a GameMaster - - /*if(m_regenTimer <= diff) + /*if(m_regenTimer <= diff) {*/ if(!bInCombat || bIsPolymorphed) // regenerate health if not in combat or if polymorphed RegenerateHealth(); - if(getPowerType() == POWER_ENERGY) { if(!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE) @@ -561,10 +483,9 @@ void Creature::Update(uint32 diff) } else RegenerateMana(); - /*if(!bIsPolymorphed) // only increase the timer if not polymorphed m_regenTimer += 2000 - diff; - } + } else if(!bIsPolymorphed) // if polymorphed, skip the timer m_regenTimer -= diff;*/ @@ -577,17 +498,13 @@ void Creature::Update(uint32 diff) break; } } - void Creature::RegenerateMana() { uint32 curValue = GetPower(POWER_MANA); uint32 maxValue = GetMaxPower(POWER_MANA); - if (curValue >= maxValue) return; - uint32 addvalue = 0; - // Combat and any controlled creature if (isInCombat() || GetCharmerOrOwnerGUID()) { @@ -595,35 +512,27 @@ void Creature::RegenerateMana() { float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA); float Spirit = GetStat(STAT_SPIRIT); - addvalue = uint32((Spirit/5.0f + 17.0f) * ManaIncreaseRate); } } else addvalue = maxValue/3; - ModifyPower(POWER_MANA, addvalue); } - void Creature::RegenerateHealth() { if (!isRegeneratingHealth()) return; - uint32 curValue = GetHealth(); uint32 maxValue = GetMaxHealth(); - if (curValue >= maxValue) return; - uint32 addvalue = 0; - // Not only pet, but any controlled creature if(GetCharmerOrOwnerGUID()) { float HealthIncreaseRate = sWorld.getRate(RATE_HEALTH); float Spirit = GetStat(STAT_SPIRIT); - if( GetPower(POWER_MANA) > 0 ) addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); else @@ -631,35 +540,27 @@ void Creature::RegenerateHealth() } else addvalue = maxValue/3; - ModifyHealth(addvalue); } - void Creature::DoFleeToGetAssistance() { if (!getVictim()) return; - if(HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; - float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); if (radius >0) { Creature* pCreature = NULL; - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius); MaNGOS::CreatureLastSearcher searcher(this, pCreature, u_check); - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius); - SetNoSearchAssistance(true); if(!pCreature) //SetFeared(true, getVictim()->GetGUID(), 0 ,sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY)); @@ -669,7 +570,6 @@ void Creature::DoFleeToGetAssistance() GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ()); } } - bool Creature::AIM_Initialize(CreatureAI* ai) { // make sure nothing can change the AI during AI update @@ -678,24 +578,20 @@ bool Creature::AIM_Initialize(CreatureAI* ai) sLog.outDebug("AIM_Initialize: failed to init, locked."); return false; } - UnitAI *oldAI = i_AI; - Motion_Initialize(); - i_AI = ai ? ai : FactorySelector::selectAI(this); if(oldAI) delete oldAI; IsAIEnabled = true; i_AI->InitializeAI(); return true; } - void Creature::Motion_Initialize() { if(!m_formation) i_motionMaster.Initialize(); else if(m_formation->getLeader() == this) - { + { m_formation->FormationReset(false); i_motionMaster.Initialize(); } @@ -704,24 +600,19 @@ void Creature::Motion_Initialize() else i_motionMaster.Initialize(); } - bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data) { ASSERT(map); SetMap(map); SetPhaseMask(phaseMask,false); - Relocate(x, y, z, ang); - if(!IsPositionValid()) { sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,Entry,x,y); return false; } - //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0; const bool bResult = CreateFromProto(guidlow, Entry, vehId, team, data); - if (bResult) { switch (GetCreatureInfo()->rank) @@ -747,7 +638,6 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, if (minfo && !isTotem()) // Cancel load if no model defined or if totem { uint32 display_id = minfo->modelid; // it can be different (for another gender) - SetDisplayId(display_id); SetNativeDisplayId(display_id); SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender); @@ -755,21 +645,17 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, } return bResult; } - bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const { if(!isTrainer()) return false; - TrainerSpellData const* trainer_spells = GetTrainerSpells(); - if(!trainer_spells || trainer_spells->spellList.empty()) { sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", GetGUIDLow(),GetEntry()); return false; } - switch(GetCreatureInfo()->trainer_type) { case TRAINER_TYPE_CLASS: @@ -841,16 +727,13 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const } return true; } - bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const { if(!isBattleMaster()) return false; - BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); if(!msg) return pPlayer->GetBGAccessByLevel(bgTypeId); - if(!pPlayer->GetBGAccessByLevel(bgTypeId)) { pPlayer->PlayerTalkClass->ClearMenus(); @@ -873,27 +756,22 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const } return true; } - bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const { return pPlayer->getLevel() >= 10 && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS && pPlayer->getClass() == GetCreatureInfo()->trainer_class; } - void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) { //Prevent gossip from NPCs that are possessed. Unit* Charmed = Unit::GetCharmer(); if (Charmed) return; - PlayerMenu* pm=pPlayer->PlayerTalkClass; pm->ClearMenus(); - // lazy loading single time at use LoadGossipOptions(); - for( GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); ++i ) { GossipOption* gso=&*i; @@ -976,7 +854,6 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) break; } } - //note for future dev: should have database fields for BoxMessage & BoxMoney if(!gso->OptionText.empty() && cantalking) { @@ -998,7 +875,6 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) } } } - ///some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) if(pm->Empty()) { @@ -1012,38 +888,30 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) } } } - void Creature::sendPreparedGossip(Player* player) { if(!player) return; - if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) // if world event npc then gameeventmgr.HandleWorldEventGossip(player, this); // update world state with progress - // in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag) if (!HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP) && !player->PlayerTalkClass->GetQuestMenu().Empty()) { player->SendPreparedQuest(GetGUID()); return; } - // in case non empty gossip menu (that not included quests list size) show it // (quest entries from quest menu will be included in list) player->PlayerTalkClass->SendGossipMenu(GetNpcTextId(), GetGUID()); } - void Creature::OnGossipSelect(Player* player, uint32 option) { GossipMenu& gossipmenu = player->PlayerTalkClass->GetGossipMenu(); - if(option >= gossipmenu.MenuItemCount()) return; - uint32 action=gossipmenu.GetItem(option).m_gAction; uint32 zoneid=GetZoneId(); uint64 guid=GetGUID(); - GossipOption const *gossip=GetGossipOption( action ); if(!gossip) { @@ -1052,7 +920,6 @@ void Creature::OnGossipSelect(Player* player, uint32 option) if(!gossip) return; } - switch (gossip->Action) { case GOSSIP_OPTION_GOSSIP: @@ -1060,7 +927,6 @@ void Creature::OnGossipSelect(Player* player, uint32 option) uint32 textid = GetGossipTextId(action, zoneid); if (textid == 0) textid=GetNpcTextId(); - player->PlayerTalkClass->CloseGossip(); player->PlayerTalkClass->SendTalking(textid); break; @@ -1102,12 +968,10 @@ void Creature::OnGossipSelect(Player* player, uint32 option) else { player->ModifyMoney(-10000000); - // Cast spells that teach dual spec // Both are also ImplicitTarget self and must be cast by player player->CastSpell(player,63680,true,NULL,NULL,player->GetGUID()); player->CastSpell(player,63624,true,NULL,NULL,player->GetGUID()); - // Should show another Gossip text with "Congratulations..." player->PlayerTalkClass->CloseGossip(); } @@ -1154,9 +1018,7 @@ void Creature::OnGossipSelect(Player* player, uint32 option) OnPoiSelect( player, gossip ); break; } - } - void Creature::OnPoiSelect(Player* player, GossipOption const *gossip) { if(gossip->GossipId==GOSSIP_GUARD_SPELLTRAINER || gossip->GossipId==GOSSIP_GUARD_SKILLTRAINER) @@ -1184,38 +1046,28 @@ void Creature::OnPoiSelect(Player* player, GossipOption const *gossip) // how this could worked player->PlayerTalkClass->SendPointOfInterest( x, y, icon, 2, 15, areaname.c_str() ); } } - uint32 Creature::GetGossipTextId(uint32 action, uint32 zoneid) { QueryResult *result= WorldDatabase.PQuery("SELECT textid FROM npc_gossip_textid WHERE action = '%u' AND zoneid ='%u'", action, zoneid ); - if(!result) return 0; - Field *fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); - delete result; - return id; } - uint32 Creature::GetNpcTextId() { // don't cache / use cache in case it's a world event announcer if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) if(uint32 textid = gameeventmgr.GetNpcTextId(m_DBTableGuid)) return textid; - if (!m_DBTableGuid) return DEFAULT_GOSSIP_MESSAGE; - if(uint32 pos = objmgr.GetNpcGossip(m_DBTableGuid)) return pos; - return DEFAULT_GOSSIP_MESSAGE; } - GossipOption const* Creature::GetGossipOption( uint32 id ) const { for( GossipOptionList::const_iterator i = m_goptions.begin( ); i != m_goptions.end( ); ++i ) @@ -1225,28 +1077,22 @@ GossipOption const* Creature::GetGossipOption( uint32 id ) const } return NULL; } - void Creature::ResetGossipOptions() { m_gossipOptionLoaded = false; m_goptions.clear(); } - void Creature::LoadGossipOptions() { if(m_gossipOptionLoaded) return; - uint32 npcflags=GetUInt32Value(UNIT_NPC_FLAGS); - CacheNpcOptionList const& noList = objmgr.GetNpcOptions (); for (CacheNpcOptionList::const_iterator i = noList.begin (); i != noList.end (); ++i) if(i->NpcFlag & npcflags) addGossipOption(*i); - m_gossipOptionLoaded = true; } - void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type) { /* uint32 timeElap = getMSTime(); @@ -1260,28 +1106,23 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 oX = dX; oY = dY; } - dX = x; dY = y; m_orientation = atan2((oY - dY), (oX - dX)); - m_startMove = getMSTime(); m_moveTime = time;*/ SendMonsterMove(x, y, z, time); } - Player *Creature::GetLootRecipient() const { if (!m_lootRecipient) return NULL; else return ObjectAccessor::FindPlayer(m_lootRecipient); } - void Creature::SetLootRecipient(Unit *unit) { // set the player whose group should receive the right // to loot the creature after it dies // should be set to NULL after the loot disappears - if (!unit) { m_lootRecipient = 0; @@ -1289,15 +1130,12 @@ void Creature::SetLootRecipient(Unit *unit) RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); return; } - Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); if(!player) // normal creature, no player involved return; - m_lootRecipient = player->GetGUID(); SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); } - void Creature::SaveToDB() { // this should only be used when the creature has already been loaded @@ -1308,19 +1146,15 @@ void Creature::SaveToDB() sLog.outError("Creature::SaveToDB failed, cannot get creature data!"); return; } - SaveToDB(GetMapId(), data->spawnMask,GetPhaseMask()); } - void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) { // update in loaded data if (!m_DBTableGuid) m_DBTableGuid = GetGUIDLow(); CreatureData& data = objmgr.NewOrExistCreatureData(m_DBTableGuid); - uint32 displayId = GetNativeDisplayId(); - // check if it's a custom model and if not, use 0 for displayId CreatureInfo const *cinfo = GetCreatureInfo(); if (cinfo) @@ -1329,7 +1163,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4) displayId = 0; } - // data->guid = guid don't must be update at save data.id = GetEntry(); data.mapid = mapid; @@ -1351,12 +1184,9 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.movementType = !m_respawnradius && GetDefaultMovementType()==RANDOM_MOTION_TYPE ? IDLE_MOTION_TYPE : GetDefaultMovementType(); data.spawnMask = spawnMask; - // updated in DB WorldDatabase.BeginTransaction(); - WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); - std::ostringstream ss; ss << "INSERT INTO creature VALUES (" << m_DBTableGuid << "," @@ -1377,64 +1207,46 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << GetPower(POWER_MANA) << "," //curmana << (m_isDeadByDefault ? 1 : 0) << "," //is_dead << GetDefaultMovementType() << ")"; //default movement generator type - WorldDatabase.PExecuteLog( ss.str( ).c_str( ) ); - WorldDatabase.CommitTransaction(); } - void Creature::SelectLevel(const CreatureInfo *cinfo) { uint32 rank = isPet()? 0 : cinfo->rank; - // level uint32 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel); uint32 maxlevel = std::max(cinfo->maxlevel, cinfo->minlevel); uint32 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel); SetLevel(level); - float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel))/(maxlevel - minlevel); - // health float healthmod = _GetHealthMod(rank); - uint32 minhealth = std::min(cinfo->maxhealth, cinfo->minhealth); uint32 maxhealth = std::max(cinfo->maxhealth, cinfo->minhealth); uint32 health = uint32(healthmod * (minhealth + uint32(rellevel*(maxhealth - minhealth)))); - SetCreateHealth(health); SetMaxHealth(health); SetHealth(health); ResetPlayerDamageReq(); - // mana uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana); uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana); uint32 mana = minmana + uint32(rellevel*(maxmana - minmana)); - SetCreateMana(mana); SetMaxPower(POWER_MANA, mana); //MAX Mana SetPower(POWER_MANA, mana); - // TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc) - SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health); SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana); - //damage float damagemod = 1.0f;//_GetDamageMod(rank); - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg * damagemod); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg * damagemod); - SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE,cinfo->minrangedmg * damagemod); SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE,cinfo->maxrangedmg * damagemod); - SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower * damagemod); - } - float Creature::_GetHealthMod(int32 Rank) { switch (Rank) // define rates for each elite rank @@ -1453,7 +1265,6 @@ float Creature::_GetHealthMod(int32 Rank) return sWorld.getRate(RATE_CREATURE_ELITE_ELITE_HP); } } - float Creature::_GetDamageMod(int32 Rank) { switch (Rank) // define rates for each elite rank @@ -1472,7 +1283,6 @@ float Creature::_GetDamageMod(int32 Rank) return sWorld.getRate(RATE_CREATURE_ELITE_ELITE_DAMAGE); } } - float Creature::GetSpellDamageMod(int32 Rank) { switch (Rank) // define rates for each elite rank @@ -1491,7 +1301,6 @@ float Creature::GetSpellDamageMod(int32 Rank) return sWorld.getRate(RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE); } } - bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data) { SetZoneScript(); @@ -1501,56 +1310,41 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3 if(!Entry) return false; } - CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry); if(!cinfo) { sLog.outErrorDb("Creature entry %u does not exist.", Entry); return false; } - SetOriginalEntry(Entry); - if(!vehId) vehId = cinfo->VehicleId; - if(vehId && !CreateVehicleKit(vehId)) vehId = 0; - Object::_Create(guidlow, Entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT); - if(!UpdateEntry(Entry, team, data)) return false; - return true; } - bool Creature::LoadFromDB(uint32 guid, Map *map) { CreatureData const* data = objmgr.GetCreatureData(guid); - if(!data) { sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid); return false; } - m_DBTableGuid = guid; if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); - uint16 team = 0; if(!Create(guid,map,data->phaseMask,data->id,0,team,data->posX,data->posY,data->posZ,data->orientation,data)) return false; - //We should set first home position, because then AI calls home movement SetHomePosition(data->posX,data->posY,data->posZ,data->orientation); - m_respawnradius = data->spawndist; - m_respawnDelay = data->spawntimesecs; m_isDeadByDefault = data->is_dead; m_deathState = m_isDeadByDefault ? DEAD : ALIVE; - m_respawnTime = objmgr.GetCreatureRespawnTime(m_DBTableGuid,GetInstanceId()); if(m_respawnTime) // respawn on Update { @@ -1562,7 +1356,6 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) Relocate(data->posX,data->posY,tz); } } - uint32 curhealth = data->curhealth; if(curhealth) { @@ -1570,18 +1363,13 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) if(curhealth < 1) curhealth = 1; } - SetHealth(m_deathState == ALIVE ? curhealth : 0); SetPower(POWER_MANA,data->curmana); - // checked at creature_template loading m_defaultMovementType = MovementGeneratorType(data->movementType); - m_creatureData = data; - return true; } - void Creature::LoadEquipment(uint32 equip_entry, bool force) { if(equip_entry == 0) @@ -1594,16 +1382,13 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) } return; } - EquipmentInfo const *einfo = objmgr.GetEquipmentInfo(equip_entry); if (!einfo) return; - m_equipmentId = equip_entry; for (uint8 i = 0; i < 3; ++i) SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]); } - bool Creature::hasQuest(uint32 quest_id) const { QuestRelations const& qr = objmgr.mCreatureQuestRelations; @@ -1614,7 +1399,6 @@ bool Creature::hasQuest(uint32 quest_id) const } return false; } - bool Creature::hasInvolvedQuest(uint32 quest_id) const { QuestRelations const& qr = objmgr.mCreatureQuestInvolvedRelations; @@ -1625,7 +1409,6 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const } return false; } - void Creature::DeleteFromDB() { if (!m_DBTableGuid) @@ -1633,10 +1416,8 @@ void Creature::DeleteFromDB() sLog.outDebug("Trying to delete not saved creature!"); return; } - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); objmgr.DeleteCreatureData(m_DBTableGuid); - WorldDatabase.BeginTransaction(); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid); @@ -1644,40 +1425,31 @@ void Creature::DeleteFromDB() WorldDatabase.PExecuteLog("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.CommitTransaction(); } - bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const { // not in world if(!IsInWorld() || !u->IsInWorld()) return false; - // all dead creatures/players not visible for any creatures if(!u->isAlive() || !isAlive()) return false; - // Always can see self if (u == this) return true; - // phased visibility (both must phased in same way) if(!InSamePhase(u)) return false; - // always seen by owner if(GetGUID() == u->GetCharmerOrOwnerGUID()) return true; - if(u->GetVisibility() == VISIBILITY_OFF) //GM return false; - // invisible aura if((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u)) return false; - // unit got in stealth in this moment and must ignore old detected state //if (m_Visibility == VISIBILITY_GROUP_NO_DETECT) // return false; - // GM invisibility checks early, invisibility if any detectable, so if not stealth then visible if(u->GetVisibility() == VISIBILITY_GROUP_STEALTH) { @@ -1685,113 +1457,86 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bo if(!detect || !canDetectStealthOf(u, GetDistance(u))) return false; } - // Now check is target visible with LoS //return u->IsWithinLOS(GetPositionX(),GetPositionY(),GetPositionZ()); return true; } - bool Creature::canStartAttack(Unit const* who, bool force) const { if(isCivilian()) return false; - if(!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) //|| who->IsControlledByPlayer() && who->IsFlying())) // we cannot check flying for other creatures, too much map/vmap calculation // TODO: should switch to range attack return false; - if(!force) { if(!_IsTargetAcceptable(who)) return false; - if(who->isInCombat()) if(Unit *victim = who->getAttackerForHelper()) if(IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))) force = true; - if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance))) return false; } - if(!canCreatureAttack(who, force)) return false; - return IsWithinLOSInMap(who); } - float Creature::GetAttackDistance(Unit const* pl) const { float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO); if(aggroRate==0) return 0.0f; - uint32 playerlevel = pl->getLevelForTarget(this); uint32 creaturelevel = getLevelForTarget(pl); - int32 leveldif = int32(playerlevel) - int32(creaturelevel); - // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." if ( leveldif < - 25) leveldif = -25; - // "The aggro radius of a mob having the same level as the player is roughly 20 yards" float RetDistance = 20; - // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level" // radius grow if playlevel < creaturelevel RetDistance -= (float)leveldif; - if(creaturelevel+5 <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { // detect range auras RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE); - // detected range auras RetDistance += pl->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE); } - // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)" if(RetDistance < 5) RetDistance = 5; - return (RetDistance*aggroRate); } - void Creature::setDeathState(DeathState s) { if((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault)) { m_deathTimer = m_corpseDelay*IN_MILISECONDS; - // always save boss respawn time at death to prevent crash cheating if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss()) SaveRespawnTime(); } Unit::setDeathState(s); - if(s == JUST_DIED) { SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - setActive(false); - if(!isPet() && GetCreatureInfo()->SkinLootId) if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) ) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - SetNoSearchAssistance(false); - //Dismiss group if is leader if(m_formation && m_formation->getLeader() == this) m_formation->FormationReset(true); - if ((canFly() || IsFlying()) && FallGround()) return; - Unit::setDeathState(CORPSE); } else if(s == JUST_ALIVED) @@ -1816,28 +1561,23 @@ void Creature::setDeathState(DeathState s) Unit::setDeathState(ALIVE); } } - bool Creature::FallGround() { // Let's abort after we called this function one time if (getDeathState() == DEAD_FALLING) return false; - float x, y, z; GetPosition(x, y, z); float ground_Z = GetMap()->GetVmapHeight(x, y, z, true); if (fabs(ground_Z - z) < 0.1f) return false; - GetMotionMaster()->MoveFall(ground_Z, EVENT_FALL_GROUND); Unit::setDeathState(DEAD_FALLING); return true; } - void Creature::Respawn(bool force) { DestroyForNearbyPlayers(); - if(force) { if(isAlive()) @@ -1845,25 +1585,19 @@ void Creature::Respawn(bool force) else if(getDeathState() != CORPSE) setDeathState(CORPSE); } - RemoveCorpse(); - if(getDeathState()==DEAD) { if (m_DBTableGuid) objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); - DEBUG_LOG("Respawning..."); m_respawnTime = 0; lootForPickPocketed = false; lootForBody = false; - if(m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); - CreatureInfo const *cinfo = GetCreatureInfo(); SelectLevel(cinfo); - if (m_isDeadByDefault) { setDeathState(JUST_DIED); @@ -1874,59 +1608,46 @@ void Creature::Respawn(bool force) } else setDeathState( JUST_ALIVED ); - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(GetNativeDisplayId()); if (minfo) // Cancel load if no model defined { uint32 display_id = minfo->modelid; // it can be different (for another gender) - SetDisplayId(display_id); SetNativeDisplayId(display_id); SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender); } - //Call AI respawn virtual function AI()->JustRespawned(); - uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId()); if (poolid) poolhandler.UpdatePool(poolid, GetGUIDLow(), GetTypeId()); } - SetToNotify(); } - void Creature::ForcedDespawn() { setDeathState(JUST_DIED); RemoveCorpse(); SetHealth(0); // just for nice GM-mode view } - bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo) { if (!spellInfo) return false; - if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) return true; - return Unit::IsImmunedToSpell(spellInfo); } - bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const { if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1))) return true; - return Unit::IsImmunedToSpellEffect(spellInfo, index); } - SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) { if(!pVictim) return NULL; - for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { if(!m_spells[i]) @@ -1937,7 +1658,6 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) sLog.outError("WORLD: unknown spell id %i", m_spells[i]); continue; } - bool bcontinue = true; for(uint32 j=0;j<3;j++) { @@ -1952,7 +1672,6 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) } } if(bcontinue) continue; - if(spellInfo->manaCost > GetPower(POWER_MANA)) continue; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); @@ -1971,12 +1690,10 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) } return NULL; } - SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) { if(!pVictim) return NULL; - for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { if(!m_spells[i]) @@ -1987,7 +1704,6 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) sLog.outError("WORLD: unknown spell id %i", m_spells[i]); continue; } - bool bcontinue = true; for(uint32 j=0;j<3;j++) { @@ -1998,7 +1714,6 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) } } if(bcontinue) continue; - if(spellInfo->manaCost > GetPower(POWER_MANA)) continue; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); @@ -2017,17 +1732,14 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) } return NULL; } - bool Creature::IsVisibleInGridForPlayer(Player const* pl) const { // gamemaster in GM mode see all, including ghosts if(pl->isGameMaster()) return true; - // Trigger shouldn't be visible for players if(isTrigger()) return false; - // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 if(pl->isAlive() || pl->GetDeathTimer() > 0) { @@ -2035,7 +1747,6 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const return false; return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState==CORPSE)); } - // Dead player see live creatures near own corpse if(isAlive()) { @@ -2047,66 +1758,50 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const return true; } } - // Dead player see Spirit Healer or Spirit Guide if(isSpiritService()) return true; - // and not see any other return false; } - Unit* Creature::SelectNearestTarget(float dist) const { CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Unit *target = NULL; - { Trinity::NearestHostileUnitInAttackDistanceCheck u_check(this, dist); Trinity::UnitLastSearcher searcher(this, target, u_check); - TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE); cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE); } - return target; } - void Creature::CallAssistance() { if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) { SetNoCallAssistance(true); - float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS); - if(radius > 0) { std::list assistList; - { CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); MaNGOS::CreatureListSearcher searcher(this, assistList, u_check); - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius); } - if (!assistList.empty()) { AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetGUID(), *this); @@ -2121,48 +1816,37 @@ void Creature::CallAssistance() } } } - void Creature::CallForHelp(float fRadius) { if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) return; - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); MaNGOS::CreatureWorker worker(this, u_do); - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(worker); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, fRadius); } - bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const { // is it true? if(!HasReactState(REACT_AGGRESSIVE)) return false; - // we don't need help from zombies :) if (!isAlive()) return false; - // we don't need help from non-combatant ;) if (isCivilian()) return false; - // skip fighting creature if (isInCombat()) return false; - // only free creature if (GetCharmerOrOwnerGUID()) return false; - // only from same creature faction if (checkfaction) { @@ -2174,80 +1858,61 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / if (!IsFriendlyTo(u)) return false; } - // skip non hostile to caster enemy creatures if (!IsHostileTo(enemy)) return false; - return true; } - // use this function to avoid having hostile creatures attack // friendlies and other mobs they shouldn't attack bool Creature::_IsTargetAcceptable(const Unit *target) const { const Unit *myVictim = getAttackerForHelper(); - // if I'm already fighting target, the target is acceptable if (myVictim == target || target->getVictim() == this) return true; - // if I'm hostile towards the target, the target is acceptable if (IsHostileTo(target)) return true; - const Unit *targetVictim = target->getAttackerForHelper(); - // if the target does not have a victim, the target is not acceptable if (!targetVictim) return false; - // if the target's victim is friendly, and the target is neutral, the target is acceptable if (IsFriendlyTo(targetVictim) && !IsFriendlyTo(target)) return true; - // if the target's victim is not friendly, or the target is friendly, the target is not acceptable return false; } - void Creature::SaveRespawnTime() { if(isSummon() || !m_DBTableGuid || m_creatureData && !m_creatureData->dbData) return; - if(m_respawnTime > time(NULL)) // dead (no corpse) objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); else if(m_deathTimer > 0) // dead (corpse) objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS); } - -// this should not be called by petAI or +// this should not be called by petAI or bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const { if(!pVictim->IsInMap(this)) return false; - if(!canAttack(pVictim, force)) return false; - if(!pVictim->isInAccessiblePlaceFor(this)) return false; - if(IsAIEnabled && !AI()->CanAIAttack(pVictim)) return false; - if(sMapStore.LookupEntry(GetMapId())->IsDungeon()) return true; - //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. float dist = std::max(GetAttackDistance(pVictim), (float)sWorld.getConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance; - if(Unit *unit = GetCharmerOrOwner()) return pVictim->IsWithinDist(unit, dist); else return pVictim->IsInDist(&m_homePosition, dist); } - CreatureDataAddon const* Creature::GetCreatureAddon() const { if (m_DBTableGuid) @@ -2255,42 +1920,35 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const if(CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid)) return addon; } - // dependent from heroic mode entry return ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry); } - //creature_addon table bool Creature::LoadCreaturesAddon(bool reload) { CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo) return false; - if (cainfo->mount != 0) Mount(cainfo->mount); - if (cainfo->bytes1 != 0) { // 0 StandState // 1 FreeTalentPoints Pet only, so always 0 for default creature // 2 StandFlags // 3 StandMiscFlags - SetByteValue(UNIT_FIELD_BYTES_1, 0, uint8(cainfo->bytes1 & 0xFF)); //SetByteValue(UNIT_FIELD_BYTES_1, 1, uint8((cainfo->bytes1 >> 8) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_1, 1, 0); SetByteValue(UNIT_FIELD_BYTES_1, 2, uint8((cainfo->bytes1 >> 16) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); } - if (cainfo->bytes2 != 0) { // 0 SheathState // 1 Bytes2Flags // 2 UnitRename Pet only, so always 0 for default creature // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura - SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF)); //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF)); @@ -2298,20 +1956,15 @@ bool Creature::LoadCreaturesAddon(bool reload) //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); } - if (cainfo->emote != 0) SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); - if (cainfo->move_flags != 0) SetUnitMovementFlags(cainfo->move_flags); - if (cainfo->move_flags & (MOVEMENTFLAG_FLY_MODE | MOVEMENTFLAG_FLYING)) sLog.outErrorDb("Creature (GUID: %u Entry: %u) has improper `moveflags` value in `creature_template_addon`. Use `InhabitType` = 4 (Flying) in `creature_template`, not MOVEMENTFLAG_FLY_MODE or MOVEMENTFLAG_FLYING in `creature_template_addon`.",GetGUIDLow(),GetEntry()); - //Load Path if (cainfo->path_id != 0) m_path_id = cainfo->path_id; - if(cainfo->auras) { for (CreatureDataAddonAura const* cAura = cainfo->auras; cAura->spell_id; ++cAura) @@ -2322,33 +1975,27 @@ bool Creature::LoadCreaturesAddon(bool reload) sLog.outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id); continue; } - // skip already applied aura if(HasAuraEffect(cAura->spell_id,cAura->effect_idx)) { if(!reload) sLog.outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u effect %u) in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id,cAura->effect_idx); - continue; } - AddAuraEffect(AdditionalSpellInfo, cAura->effect_idx, this, this); sLog.outDebug("Spell: %u with Aura %u added to creature (GUID: %u Entry: %u)", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[cAura->effect_idx],GetGUIDLow(),GetEntry()); } } return true; } - /// Send a message to LocalDefense channel for players opposition team in the zone void Creature::SendZoneUnderAttackMessage(Player* attacker) { uint32 enemy_team = attacker->GetTeam(); - WorldPacket data(SMSG_ZONE_UNDER_ATTACK,4); data << (uint32)GetAreaId(); sWorld.SendGlobalMessage(&data,NULL,(enemy_team==ALLIANCE ? HORDE : ALLIANCE)); } - void Creature::SetInCombatWithZone() { if (!CanHaveThreatList()) @@ -2356,27 +2003,21 @@ void Creature::SetInCombatWithZone() sLog.outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); return; } - Map* pMap = GetMap(); - if (!pMap->IsDungeon()) { sLog.outError("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), pMap->GetId()); return; } - Map::PlayerList const &PlList = pMap->GetPlayers(); - if (PlList.isEmpty()) return; - for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if (Player* pPlayer = i->getSource()) { if (pPlayer->isGameMaster()) continue; - if (pPlayer->isAlive()) { pPlayer->SetInCombatWith(this); @@ -2385,56 +2026,44 @@ void Creature::SetInCombatWithZone() } } } - void Creature::_AddCreatureSpellCooldown(uint32 spell_id, time_t end_time) { m_CreatureSpellCooldowns[spell_id] = end_time; } - void Creature::_AddCreatureCategoryCooldown(uint32 category, time_t apply_time) { m_CreatureCategoryCooldowns[category] = apply_time; } - void Creature::AddCreatureSpellCooldown(uint32 spellid) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid); if(!spellInfo) return; - uint32 cooldown = GetSpellRecoveryTime(spellInfo); if(Player *modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown); - if(cooldown) _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILISECONDS); - if(spellInfo->Category) _AddCreatureCategoryCooldown(spellInfo->Category, time(NULL)); - m_GlobalCooldown = spellInfo->StartRecoveryTime; } - bool Creature::HasCategoryCooldown(uint32 spell_id) const { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if(!spellInfo) return false; - // check global cooldown if spell affected by it if (spellInfo->StartRecoveryCategory > 0 && m_GlobalCooldown > 0) return true; - CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category); return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILISECONDS)) > time(NULL)); } - bool Creature::HasSpellCooldown(uint32 spell_id) const { CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id); return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id); } - bool Creature::HasSpell(uint32 spellID) const { uint8 i; @@ -2443,7 +2072,6 @@ bool Creature::HasSpell(uint32 spellID) const break; return i < CREATURE_MAX_SPELLS; //broke before end of iteration of known spells } - time_t Creature::GetRespawnTimeEx() const { time_t now = time(NULL); @@ -2454,7 +2082,6 @@ time_t Creature::GetRespawnTimeEx() const else return now; } - void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* dist ) const { if (m_DBTableGuid) @@ -2468,11 +2095,9 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* *ori = data->orientation; if(dist) *dist = data->spawndist; - return; } } - x = GetPositionX(); y = GetPositionY(); z = GetPositionZ(); @@ -2481,33 +2106,27 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* if(dist) *dist = 0; } - void Creature::AllLootRemovedFromCorpse() { if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) { uint32 nDeathTimer; - CreatureInfo const *cinfo = GetCreatureInfo(); - // corpse was not skinnable -> apply corpse looted timer if (!cinfo || !cinfo->SkinLootId) nDeathTimer = (uint32)((m_corpseDelay * IN_MILISECONDS) * sWorld.getRate(RATE_CORPSE_DECAY_LOOTED)); // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update else nDeathTimer = 0; - // update death timer only if looted timer is shorter if (m_deathTimer > nDeathTimer) m_deathTimer = nDeathTimer; } } - uint32 Creature::getLevelForTarget( Unit const* target ) const { if(!isWorldBoss()) return Unit::getLevelForTarget(target); - uint32 level = target->getLevel()+sWorld.getConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF); if(level < 1) return 1; @@ -2515,104 +2134,81 @@ uint32 Creature::getLevelForTarget( Unit const* target ) const return 255; return level; } - std::string Creature::GetAIName() const { return ObjectMgr::GetCreatureTemplate(GetEntry())->AIName; } - std::string Creature::GetScriptName() const { return objmgr.GetScriptName(GetScriptId()); } - uint32 Creature::GetScriptId() const { return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptID; } - VendorItemData const* Creature::GetVendorItems() const { return objmgr.GetNpcVendorItemList(GetEntry()); } - uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) { if(!vItem->maxcount) return vItem->maxcount; - VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for(; itr != m_vendorItemCounts.end(); ++itr) if(itr->itemId==vItem->item) break; - if(itr == m_vendorItemCounts.end()) return vItem->maxcount; - VendorItemCount* vCount = &*itr; - time_t ptime = time(NULL); - if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); - uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) { m_vendorItemCounts.erase(itr); return vItem->maxcount; } - vCount->count += diff * pProto->BuyCount; vCount->lastIncrementTime = ptime; } - return vCount->count; } - uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count) { if(!vItem->maxcount) return 0; - VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for(; itr != m_vendorItemCounts.end(); ++itr) if(itr->itemId==vItem->item) break; - if(itr == m_vendorItemCounts.end()) { uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0; m_vendorItemCounts.push_back(VendorItemCount(vItem->item,new_count)); return new_count; } - VendorItemCount* vCount = &*itr; - time_t ptime = time(NULL); - if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); - uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) vCount->count += diff * pProto->BuyCount; else vCount->count = vItem->maxcount; } - vCount->count = vCount->count > used_count ? vCount->count-used_count : 0; vCount->lastIncrementTime = ptime; return vCount->count; } - TrainerSpellData const* Creature::GetTrainerSpells() const { return objmgr.GetNpcTrainerSpells(GetEntry()); } - // overwrite WorldObject function for proper name localization const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const { @@ -2625,27 +2221,21 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const return cl->Name[loc_idx].c_str(); } } - return GetName(); } - const CreatureData* Creature::GetLinkedRespawnCreatureData() const { if(!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master return NULL; - if(uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid)) return objmgr.GetCreatureData(targetGuid); - return NULL; } - // returns master's remaining respawn time if any time_t Creature::GetLinkedCreatureRespawnTime() const { if(!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master return 0; - if(uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid)) { Map* targetMap = NULL; @@ -2659,7 +2249,6 @@ time_t Creature::GetLinkedCreatureRespawnTime() const if(targetMap) return objmgr.GetCreatureRespawnTime(targetGuid,targetMap->GetInstanceId()); } - return 0; } diff --git a/src/game/Creature.h b/src/game/Creature.h index 5fbe4a07a28..f66d485d183 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITYCORE_CREATURE_H #define TRINITYCORE_CREATURE_H - #include "Common.h" #include "Unit.h" #include "UpdateMask.h" @@ -28,17 +26,13 @@ #include "LootMgr.h" #include "Database/DatabaseEnv.h" #include "Cell.h" - #include - struct SpellEntry; - class CreatureAI; class Quest; class Player; class WorldSession; class CreatureGroup; - enum Gossip_Option { GOSSIP_OPTION_NONE = 0, //UNIT_NPC_FLAG_NONE = 0, @@ -62,7 +56,6 @@ enum Gossip_Option GOSSIP_OPTION_LEARNDUALSPEC = 18, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) GOSSIP_OPTION_OUTDOORPVP = 19 //added by code (option for outdoor pvp creatures) }; - enum Gossip_Guard { GOSSIP_GUARD_BANK = 32, @@ -77,7 +70,6 @@ enum Gossip_Guard GOSSIP_GUARD_SPELLTRAINER = 41, GOSSIP_GUARD_SKILLTRAINER = 42 }; - enum Gossip_Guard_Spell { GOSSIP_GUARD_SPELL_WARRIOR = 64, @@ -92,7 +84,6 @@ enum Gossip_Guard_Spell GOSSIP_GUARD_SPELL_UNKNOWN2 = 73, GOSSIP_GUARD_SPELL_DRUID = 74 }; - enum Gossip_Guard_Skill { GOSSIP_GUARD_SKILL_ALCHEMY = 80, @@ -108,7 +99,6 @@ enum Gossip_Guard_Skill GOSSIP_GUARD_SKILL_TAILORING = 90, GOSSIP_GUARD_SKILL_ENGINERING = 91 }; - enum GossipOptionIcon { GOSSIP_ICON_CHAT = 0, //white chat bubble @@ -123,7 +113,6 @@ enum GossipOptionIcon GOSSIP_ICON_BATTLE = 9, //two swords GOSSIP_ICON_DOT = 10 //yellow dot }; - struct GossipOption { uint32 Id; @@ -136,7 +125,6 @@ struct GossipOption std::string OptionText; std::string BoxText; }; - enum CreatureFlagsExtra { CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group @@ -153,16 +141,13 @@ enum CreatureFlagsExtra CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills }; - // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack(1) #else #pragma pack(push,1) #endif - #define MAX_KILL_CREDIT 2 - // from `creature_template` table struct CreatureInfo { @@ -238,7 +223,6 @@ struct CreatureInfo uint32 ScriptID; uint32 GetRandomValidModelId() const; uint32 GetFirstValidModelId() const; - // helpers SkillType GetRequiredLootSkill() const { @@ -251,40 +235,33 @@ struct CreatureInfo else return SKILL_SKINNING; // normal case } - bool isTameable(bool exotic) const { if(type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE)==0) return false; - // if can tame exotic then can tame any temable return exotic || (type_flags & CREATURE_TYPEFLAGS_EXOTIC)==0; } }; - struct CreatureLocale { std::vector Name; std::vector SubName; }; - struct NpcOptionLocale { std::vector OptionText; std::vector BoxText; }; - struct PointOfInterestLocale { std::vector IconName; }; - struct EquipmentInfo { uint32 entry; uint32 equipentry[3]; }; - // from `creature` table struct CreatureData { @@ -308,13 +285,11 @@ struct CreatureData uint8 spawnMask; bool dbData; }; - struct CreatureDataAddonAura { uint32 spell_id; uint8 effect_idx; }; - // from `creature_addon` table struct CreatureDataAddon { @@ -327,7 +302,6 @@ struct CreatureDataAddon uint32 move_flags; CreatureDataAddonAura const* auras; // loaded as char* "spell1 eff1 spell2 eff2 ... " }; - struct CreatureModelInfo { uint32 modelid; @@ -336,7 +310,6 @@ struct CreatureModelInfo uint8 gender; uint32 modelid_other_gender; }; - enum InhabitTypeValues { INHABIT_GROUND = 1, @@ -344,7 +317,6 @@ enum InhabitTypeValues INHABIT_AIR = 4, INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR }; - // Enums used by StringTextData::Type (CreatureEventAI) enum ChatType { @@ -356,7 +328,6 @@ enum ChatType CHAT_TYPE_BOSS_WHISPER = 5, CHAT_TYPE_ZONE_YELL = 6 }; - //Selection method used by SelectTarget (CreatureEventAI) enum AttackingTarget { @@ -369,31 +340,26 @@ enum AttackingTarget ATTACKING_TARGET_BOTTOMAGGRO_PLAYER, //Selects targets from bottom aggro to top (player only) */ }; - // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack() #else #pragma pack(pop) #endif - // Vendors struct VendorItem { VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {} - uint32 item; uint32 maxcount; // 0 for infinity item amount uint32 incrtime; // time for restore items amount if maxcount != 0 uint32 ExtendedCost; }; typedef std::vector VendorItemList; - struct VendorItemData { VendorItemList m_items; - VendorItem* GetItem(uint32 slot) const { if(slot>=m_items.size()) return NULL; @@ -408,7 +374,6 @@ struct VendorItemData bool RemoveItem( uint32 item_id ); VendorItem const* FindItem(uint32 item_id) const; size_t FindItemSlot(uint32 item_id) const; - void Clear() { for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr) @@ -416,84 +381,62 @@ struct VendorItemData m_items.clear(); } }; - struct VendorItemCount { explicit VendorItemCount(uint32 _item, uint32 _count) : itemId(_item), count(_count), lastIncrementTime(time(NULL)) {} - uint32 itemId; uint32 count; time_t lastIncrementTime; }; - typedef std::list VendorItemCounts; - struct TrainerSpell { TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0), learnedSpell(0) {} - TrainerSpell(uint32 _spell, uint32 _spellCost, uint32 _reqSkill, uint32 _reqSkillValue, uint32 _reqLevel, uint32 _learnedspell) : spell(_spell), spellCost(_spellCost), reqSkill(_reqSkill), reqSkillValue(_reqSkillValue), reqLevel(_reqLevel), learnedSpell(_learnedspell) {} - uint32 spell; uint32 spellCost; uint32 reqSkill; uint32 reqSkillValue; uint32 reqLevel; uint32 learnedSpell; - // helpers bool IsCastable() const { return learnedSpell != spell; } }; - typedef UNORDERED_MAP TrainerSpellMap; - struct TrainerSpellData { TrainerSpellData() : trainerType(0) {} - TrainerSpellMap spellList; uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value. // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2. TrainerSpell const* Find(uint32 spell_id) const; void Clear() { spellList.clear(); } }; - typedef std::list GossipOptionList; - typedef std::map CreatureSpellCooldowns; - // max different by z coordinate for creature aggro reaction #define CREATURE_Z_ATTACK_RANGE 3 - #define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY - class TRINITY_DLL_SPEC Creature : public Unit { public: - explicit Creature(); virtual ~Creature(); - void AddToWorld(); void RemoveFromWorld(); - void DisappearAndDie(); - bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL); bool LoadCreaturesAddon(bool reload = false); void SelectLevel(const CreatureInfo *cinfo); void LoadEquipment(uint32 equip_entry, bool force=false); - uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } char const* GetSubName() const { return GetCreatureInfo()->SubName; } - void Update( uint32 time ); // overwrited Unit::Update void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; } - void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; } bool isCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; } @@ -517,45 +460,33 @@ class TRINITY_DLL_SPEC Creature : public Unit { if(isPet()) return false; - uint32 rank = GetCreatureInfo()->rank; return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE; } - bool isWorldBoss() const { if(isPet()) return false; - return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS; } - uint32 getLevelForTarget(Unit const* target) const; // overwrite Unit::getLevelForTarget for boss level support - bool IsInEvadeMode() const { return hasUnitState(UNIT_STAT_EVADE); } - bool AIM_Initialize(CreatureAI* ai = NULL); void Motion_Initialize(); - void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); CreatureAI * AI() const { return (CreatureAI*)i_AI; } - uint32 GetShieldBlockValue() const //dunno mob block value { return (getLevel()/2 + uint32(GetStat(STAT_STRENGTH)/20)); } - SpellSchoolMask GetMeleeDamageSchoolMask() const { return m_meleeDamageSchoolMask; } void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); } - void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time); void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time); void AddCreatureSpellCooldown(uint32 spellid); bool HasSpellCooldown(uint32 spell_id) const; bool HasCategoryCooldown(uint32 spell_id) const; - bool HasSpell(uint32 spellID) const; - bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); bool UpdateStats(Stats stat); bool UpdateAllStats(); @@ -567,72 +498,56 @@ class TRINITY_DLL_SPEC Creature : public Unit void UpdateDamagePhysical(WeaponAttackType attType); uint32 GetCurrentEquipmentId() { return m_equipmentId; } float GetSpellDamageMod(int32 Rank); - VendorItemData const* GetVendorItems() const; uint32 GetVendorItemCurrentCount(VendorItem const* vItem); uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count); - TrainerSpellData const* GetTrainerSpells() const; - CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; } CreatureData const *GetCreatureData() const { return m_creatureData; } CreatureDataAddon const* GetCreatureAddon() const; - std::string GetAIName() const; std::string GetScriptName() const; uint32 GetScriptId() const; - void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 ); void sendPreparedGossip( Player* player ); void OnGossipSelect(Player* player, uint32 option); void OnPoiSelect(Player* player, GossipOption const *gossip); - uint32 GetGossipTextId(uint32 action, uint32 zoneid); uint32 GetNpcTextId(); void LoadGossipOptions(); void ResetGossipOptions(); GossipOption const* GetGossipOption( uint32 id ) const; void addGossipOption(GossipOption const& gso) { m_goptions.push_back(gso); } - void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); } void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } - // overwrite WorldObject function for proper name localization const char* GetNameForLocaleIdx(int32 locale_idx) const; - void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState bool FallGround(); - bool LoadFromDB(uint32 guid, Map *map); void SaveToDB(); // overwrited in Pet virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); virtual void DeleteFromDB(); // overwrited in Pet - Loot loot; bool lootForPickPocketed; bool lootForBody; Player *GetLootRecipient() const; bool hasLootRecipient() const { return m_lootRecipient!=0; } - void SetLootRecipient (Unit* unit); void AllLootRemovedFromCorpse(); - SpellEntry const *reachWithSpellAttack(Unit *pVictim); SpellEntry const *reachWithSpellCure(Unit *pVictim); - uint32 m_spells[CREATURE_MAX_SPELLS]; CreatureSpellCooldowns m_CreatureSpellCooldowns; CreatureSpellCooldowns m_CreatureCategoryCooldowns; uint32 m_GlobalCooldown; - bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList = false, bool is3dDistance = true) const; bool canStartAttack(Unit const* u, bool force) const; float GetAttackDistance(Unit const* pl) const; - Unit* SelectNearestTarget(float dist = 0) const; void DoFleeToGetAssistance(); void CallForHelp(float fRadius); @@ -642,47 +557,33 @@ class TRINITY_DLL_SPEC Creature : public Unit bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; } bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const; bool _IsTargetAcceptable(const Unit* target) const; - MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; } void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; } - // for use only in LoadHelper, Map::Add Map::CreatureCellRelocation Cell const& GetCurrentCell() const { return m_currentCell; } void SetCurrentCell(Cell const& cell) { m_currentCell = cell; } - bool IsVisibleInGridForPlayer(Player const* pl) const; - void RemoveCorpse(); bool isDeadByDefault() const { return m_isDeadByDefault; }; - void ForcedDespawn(); - time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; } void Respawn(bool force = false); void SaveRespawnTime(); - uint32 GetRespawnDelay() const { return m_respawnDelay; } void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; } - float GetRespawnRadius() const { return m_respawnradius; } void SetRespawnRadius(float dist) { m_respawnradius = dist; } - // Linked Creature Respawning System time_t GetLinkedCreatureRespawnTime() const; const CreatureData* GetLinkedRespawnCreatureData() const; - uint32 m_groupLootTimer; // (msecs)timer used for group loot uint64 lootingGroupLeaderGUID; // used to find group which is looting corpse - void SendZoneUnderAttackMessage(Player* attacker); - void SetInCombatWithZone(); - bool hasQuest(uint32 quest_id) const; bool hasInvolvedQuest(uint32 quest_id) const; - GridReference &GetGridRef() { return m_gridRef; } bool isRegeneratingHealth() { return m_regenHealth; } virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; } @@ -693,26 +594,19 @@ class TRINITY_DLL_SPEC Creature : public Unit else return m_charmInfo->GetCharmSpell(pos)->GetAction(); } - void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); } void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos);} void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); } - uint32 GetGlobalCooldown() const { return m_GlobalCooldown; } - uint32 GetWaypointPath(){return m_path_id;} void LoadPath(uint32 pathid) { m_path_id = pathid; } - uint32 GetCurrentWaypointID(){return m_waypointID;} void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;} - void SearchFormation(); CreatureGroup *GetFormation() {return m_formation;} void SetFormation(CreatureGroup *formation) {m_formation = formation;} - Unit *SelectVictim(); void SetDeadByDefault (bool death_state) {m_isDeadByDefault = death_state;} - void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; } bool IsReputationGainDisabled() { return DisableReputationGain; } bool IsDamageEnoughForLootingAndReward() { return m_PlayerDamageReq == 0; } @@ -723,36 +617,26 @@ class TRINITY_DLL_SPEC Creature : public Unit } void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; } uint32 m_PlayerDamageReq; - void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; } - static float _GetDamageMod(int32 Rank); - float m_SightDistance, m_CombatDistance; protected: bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data = NULL); bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); - // vendor items VendorItemCounts m_vendorItemCounts; - void _RealtimeSetCreatureInfo(); - static float _GetHealthMod(int32 Rank); - uint32 m_lootMoney; uint64 m_lootRecipient; - /// Timers uint32 m_deathTimer; // (msecs)timer for death or corpse disappearance time_t m_respawnTime; // (secs) time of next respawn uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance float m_respawnradius; - bool m_gossipOptionLoaded; GossipOptionList m_goptions; - ReactStates m_reactState; // for AI, not charmInfo void RegenerateMana(); void RegenerateHealth(); @@ -761,48 +645,36 @@ class TRINITY_DLL_SPEC Creature : public Unit Cell m_currentCell; // store current cell where creature listed uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid uint32 m_equipmentId; - bool m_AlreadyCallAssistance; bool m_AlreadySearchedAssistance; bool m_regenHealth; bool m_AI_locked; bool m_isDeadByDefault; - SpellSchoolMask m_meleeDamageSchoolMask; uint32 m_originalEntry; - Position m_homePosition; - bool DisableReputationGain; - CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry()) CreatureData const* m_creatureData; - private: //WaypointMovementGenerator vars uint32 m_waypointID; uint32 m_path_id; - //Formation var CreatureGroup *m_formation; - GridReference m_gridRef; }; - class AssistDelayEvent : public BasicEvent { public: AssistDelayEvent(const uint64& victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { } - bool Execute(uint64 e_time, uint32 p_time); void AddAssistant(const uint64& guid) { m_assistants.push_back(guid); } private: AssistDelayEvent(); - uint64 m_victim; std::list m_assistants; Unit& m_owner; }; - #endif diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 27fe428efd1..6727575e920 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -17,14 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "CreatureAI.h" #include "CreatureAIImpl.h" #include "Creature.h" #include "World.h" #include "SpellMgr.h" #include "Vehicle.h" - //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool apply) { @@ -32,25 +30,20 @@ void CreatureAI::OnCharmed(bool apply) me->NeedChangeAI = true; me->IsAIEnabled = false; } - AISpellInfoType * UnitAI::AISpellInfo; TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; } - void CreatureAI::DoZoneInCombat(Creature* creature) { if (!creature) creature = me; - if(!creature->CanHaveThreatList()) return; - Map *map = creature->GetMap(); if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated { sLog.outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? ((Creature*)creature)->GetEntry() : 0); return; } - if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) { if(Unit *target = creature->SelectNearestTarget(50)) @@ -67,32 +60,26 @@ void CreatureAI::DoZoneInCombat(Creature* creature) } } } - if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) { sLog.outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); return; } - Map::PlayerList const &PlList = map->GetPlayers(); - if(PlList.isEmpty()) return; - for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if(Player* pPlayer = i->getSource()) { if(pPlayer->isGameMaster()) continue; - if(pPlayer->isAlive()) { creature->SetInCombatWith(pPlayer); pPlayer->SetInCombatWith(creature); creature->AddThreat(pPlayer, 0.0f); } - /* Causes certain things to never leave the threat list (Priest Lightwell, etc): for(Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr) { @@ -103,15 +90,12 @@ void CreatureAI::DoZoneInCombat(Creature* creature) } } } - void CreatureAI::MoveInLineOfSight(Unit *who) { if(me->getVictim()) return; - if (me->GetTypeId() == CREATURE_TYPE_NON_COMBAT_PET) // non-combat pets should just stand there and look good;) return; - if(me->canStartAttack(who, false)) AttackStart(who); //else if(who->getVictim() && me->IsFriendlyTo(who) @@ -119,7 +103,6 @@ void CreatureAI::MoveInLineOfSight(Unit *who) // && me->canStartAttack(who->getVictim(), true)) // TODO: if we use true, it will not attack it when it arrives // me->GetMotionMaster()->MoveChase(who->getVictim()); } - void CreatureAI::SelectNearestTarget(Unit *who) { if(me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) @@ -128,14 +111,11 @@ void CreatureAI::SelectNearestTarget(Unit *who) me->AddThreat(who, 1000000.0f); } } - void CreatureAI::EnterEvadeMode() { if(!_EnterEvadeMode()) return; - sLog.outDebug("Creature %u enters evade mode.", me->GetEntry()); - if(!me->GetVehicle()) // otherwise me will be in evade mode forever { if(Unit *owner = me->GetCharmerOrOwner()) @@ -146,13 +126,10 @@ void CreatureAI::EnterEvadeMode() else me->GetMotionMaster()->MoveTargetedHome(); } - Reset(); - if(me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! me->GetVehicleKit()->Reset(); } - /*void CreatureAI::AttackedBy( Unit* attacker ) { if(!m_creature->getVictim()) diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 556e9be14e0..98a145b79e0 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -17,38 +17,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CREATUREAI_H #define TRINITY_CREATUREAI_H - #include "UnitAI.h" #include "Common.h" - class WorldObject; class Unit; class Creature; class Player; struct SpellEntry; - #define TIME_INTERVAL_LOOK 5000 #define VISIBILITY_RANGE 10000 - //Spell targets used by SelectSpell enum SelectTargetType { SELECT_TARGET_DONTCARE = 0, //All target types allowed - SELECT_TARGET_SELF, //Only Self casting - SELECT_TARGET_SINGLE_ENEMY, //Only Single Enemy SELECT_TARGET_AOE_ENEMY, //Only AoE Enemy SELECT_TARGET_ANY_ENEMY, //AoE or Single Enemy - SELECT_TARGET_SINGLE_FRIEND, //Only Single Friend SELECT_TARGET_AOE_FRIEND, //Only AoE Friend SELECT_TARGET_ANY_FRIEND, //AoE or Single Friend }; - //Spell Effects used by SelectSpell enum SelectEffect { @@ -57,123 +48,84 @@ enum SelectEffect SELECT_EFFECT_HEALING, //Spell does healing SELECT_EFFECT_AURA, //Spell applies an aura }; - enum SCEquip { EQUIP_NO_CHANGE = -1, EQUIP_UNEQUIP = 0 }; - class TRINITY_DLL_SPEC CreatureAI : public UnitAI { protected: Creature * const me; Creature * const m_creature; - bool UpdateVictim(); bool UpdateVictimWithGaze(); bool UpdateCombatState(); - void SelectNearestTarget(Unit *who); - void SetGazeOn(Unit *target); - Creature *DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); Creature *DoSummon(uint32 uiEntry, WorldObject *obj, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); Creature *DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float fZ, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); - public: explicit CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c), m_creature(c) {} - virtual ~CreatureAI() {} - ///== Reactions At ================================= - // Called if IsVisible(Unit *who) is true at each *who move, reaction at visibility zone enter virtual void MoveInLineOfSight(Unit *); - // Called for reaction at stopping attack at no attackers or targets virtual void EnterEvadeMode(); - // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) virtual void EnterCombat(Unit* /*enemy*/) {} - // Called at any Damage from any attacker (before damage apply) // Note: it for recalculation damage or special reaction at damage // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also virtual void DamageTaken(Unit *done_by, uint32 & /*damage*/) {} - // Called when the creature is killed virtual void JustDied(Unit *) {} - // Called when the creature kills a unit virtual void KilledUnit(Unit *) {} - // Called when the creature summon successfully other creature virtual void JustSummoned(Creature* ) {} virtual void IsSummonedBy(Unit *summoner) {} - virtual void SummonedCreatureDespawn(Creature* /*unit*/) {} - // Called when hit by a spell virtual void SpellHit(Unit*, const SpellEntry*) {} - // Called when spell hits a target virtual void SpellHitTarget(Unit* target, const SpellEntry*) {} - // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc) //virtual void AttackedBy(Unit* attacker); virtual bool IsEscorted() {return false;} - // Called when creature is spawned or respawned (for reseting variables) virtual void JustRespawned() { Reset(); } - // Called at waypoint reached or point movement finished virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {} - void OnCharmed(bool apply); - //virtual void SpellClick(Player *player) {} - // Called at reaching home after evade virtual void JustReachedHome() {} - void DoZoneInCombat(Creature* pUnit = NULL); - - // Called at text emote receive from player + // Called at text emote receive from player virtual void ReceiveEmote(Player* pPlayer, uint32 text_emote) {} - ///== Triggered Actions Requested ================== - // Called when creature attack expected (if creature can and no have current victim) // Note: for reaction at hostile action must be called AttackedBy function. //virtual void AttackStart(Unit *) {} - // Called at World update tick //virtual void UpdateAI(const uint32 diff ) {} - ///== State checks ================================= - // Is unit visible for MoveInLineOfSight //virtual bool IsVisible(Unit *) const { return false; } - // called when the corpse of this creature gets removed virtual void CorpseRemoved(uint32 & /*respawnDelay*/) {} - // Called when victim entered water and creature can not enter water //virtual bool canReachByRangeAttack(Unit*) { return false; } - ///== Fields ======================================= - // Pointer to controlled by AI creature //Creature* const m_creature; - virtual void PassengerBoarded(Unit *who, int8 seatId, bool apply) {} - protected: bool _EnterEvadeMode(); }; - enum Permitions { PERMIT_BASE_NO = -1, @@ -183,5 +135,4 @@ enum Permitions PERMIT_BASE_FACTION_SPECIFIC = 400, PERMIT_BASE_SPECIAL = 800 }; - #endif diff --git a/src/game/CreatureAIFactory.h b/src/game/CreatureAIFactory.h index d546c2b1720..a2396fc5117 100644 --- a/src/game/CreatureAIFactory.h +++ b/src/game/CreatureAIFactory.h @@ -19,26 +19,20 @@ */ #ifndef TRINITY_CREATUREAIFACTORY_H #define TRINITY_CREATUREAIFACTORY_H - //#include "Policies/Singleton.h" #include "Dynamic/ObjectRegistry.h" #include "Dynamic/FactoryHolder.h" - struct SelectableAI : public FactoryHolder, public Permissible { SelectableAI(const char *id) : FactoryHolder(id) {} }; - template struct CreatureAIFactory : public SelectableAI { CreatureAIFactory(const char *name) : SelectableAI(name) {} - CreatureAI* Create(void *) const; - int Permit(const Creature *c) const { return REAL_AI::Permissible(c); } }; - template inline CreatureAI* CreatureAIFactory::Create(void *data) const @@ -46,7 +40,6 @@ CreatureAIFactory::Create(void *data) const Creature* creature = reinterpret_cast(data); return (new REAL_AI(creature)); } - typedef FactoryHolder CreatureAICreator; typedef FactoryHolder::FactoryHolderRegistry CreatureAIRegistry; typedef FactoryHolder::FactoryHolderRepository CreatureAIRepository; diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h index 89d5bbc2a9e..4fddcc6392d 100644 --- a/src/game/CreatureAIImpl.h +++ b/src/game/CreatureAIImpl.h @@ -17,21 +17,17 @@ */ #ifndef CREATUREAIIMPL_H #define CREATUREAIIMPL_H - #include "Common.h" #include "Platform/Define.h" #include "TemporarySummon.h" #include "CreatureAI.h" - #define HEROIC(n,h) (HeroicMode ? h : n) - template inline const T& RAND(const T& v1, const T& v2) { return (rand()%2) ? v1 : v2; } - template inline const T& RAND(const T& v1, const T& v2, const T& v3) @@ -44,7 +40,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3) case 2: return v3; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4) @@ -58,7 +53,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4) case 3: return v4; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) @@ -73,7 +67,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) case 4: return v5; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6) @@ -89,7 +82,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 5: return v6; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7) @@ -106,7 +98,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 6: return v7; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8) @@ -124,7 +115,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 7: return v8; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -144,7 +134,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 8: return v9; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -165,7 +154,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 9: return v10; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -187,7 +175,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 10: return v11; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -210,7 +197,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 11: return v12; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -234,7 +220,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 12: return v13; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -259,7 +244,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 13: return v14; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -285,7 +269,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 14: return v15; } } - template inline const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, @@ -312,26 +295,20 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c case 15: return v16; } } - class EventMap : private std::map { private: uint32 m_time, m_phase; public: explicit EventMap() : m_phase(0), m_time(0) {} - uint32 GetTimer() const { return m_time; } - void Reset() { clear(); m_time = 0; m_phase = 0; } - void Update(uint32 time) { m_time += time; } - void SetPhase(uint32 phase) { if(phase && phase < 9) m_phase = (1 << (phase + 24)); } - void ScheduleEvent(uint32 eventId, uint32 time, uint32 gcd = 0, uint32 phase = 0) { time += m_time; @@ -347,13 +324,11 @@ class EventMap : private std::map } insert(std::make_pair(time, eventId)); } - void RescheduleEvent(uint32 eventId, uint32 time, uint32 gcd = 0, uint32 phase = 0) { CancelEvent(eventId); ScheduleEvent(eventId, time, gcd, phase); } - void RepeatEvent(uint32 time) { if(empty()) @@ -369,12 +344,10 @@ class EventMap : private std::map } insert(std::make_pair(time, eventId)); } - void PopEvent() { erase(begin()); } - uint32 ExecuteEvent() { while(!empty()) @@ -392,7 +365,6 @@ class EventMap : private std::map } return 0; } - uint32 GetEvent() { while(!empty()) @@ -408,7 +380,6 @@ class EventMap : private std::map } return 0; } - void DelayEvents(uint32 time, uint32 gcd) { time += m_time; @@ -426,7 +397,6 @@ class EventMap : private std::map ++itr; } } - void CancelEvent(uint32 eventId) { for(iterator itr = begin(); itr != end();) @@ -437,7 +407,6 @@ class EventMap : private std::map ++itr; } } - void CancelEventsByGCD(uint32 gcd) { for(iterator itr = begin(); itr != end();) @@ -449,7 +418,6 @@ class EventMap : private std::map } } }; - enum AITarget { AITARGET_SELF, @@ -459,16 +427,13 @@ enum AITarget AITARGET_BUFF, AITARGET_DEBUFF, }; - enum AICondition { AICOND_AGGRO, AICOND_COMBAT, AICOND_DIE, }; - #define AI_DEFAULT_COOLDOWN 5000 - struct AISpellInfoType { AISpellInfoType() : target(AITARGET_SELF), condition(AICOND_COMBAT) @@ -479,10 +444,8 @@ struct AISpellInfoType uint32 realCooldown; float maxRange; }; - TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i); - inline void CreatureAI::SetGazeOn(Unit *target) { if(me->canAttack(target)) @@ -491,12 +454,10 @@ inline void CreatureAI::SetGazeOn(Unit *target) me->SetReactState(REACT_PASSIVE); } } - inline bool CreatureAI::UpdateVictimWithGaze() { if(!me->isInCombat()) return false; - if(me->HasReactState(REACT_PASSIVE)) { if(me->getVictim()) @@ -504,17 +465,14 @@ inline bool CreatureAI::UpdateVictimWithGaze() else me->SetReactState(REACT_AGGRESSIVE); } - if(Unit *victim = me->SelectVictim()) AttackStart(victim); return me->getVictim(); } - inline bool CreatureAI::UpdateCombatState() { if(!me->isInCombat()) return false; - if(!me->HasReactState(REACT_PASSIVE)) { if(Unit *victim = me->SelectVictim()) @@ -526,15 +484,12 @@ inline bool CreatureAI::UpdateCombatState() EnterEvadeMode(); return false; } - return true; } - inline bool CreatureAI::UpdateVictim() { if(!me->isInCombat()) return false; - if(!me->HasReactState(REACT_PASSIVE)) { if(Unit *victim = me->SelectVictim()) @@ -546,10 +501,8 @@ inline bool CreatureAI::UpdateVictim() EnterEvadeMode(); return false; } - return true; } - /* inline bool CreatureAI::UpdateVictim() { @@ -560,12 +513,10 @@ inline bool CreatureAI::UpdateVictim() return me->getVictim(); } */ - inline bool CreatureAI::_EnterEvadeMode() { if(!me->isAlive()) return false; - // sometimes bosses stuck in combat? me->RemoveAllAuras(); me->DeleteThreatList(); @@ -573,46 +524,36 @@ inline bool CreatureAI::_EnterEvadeMode() me->LoadCreaturesAddon(); me->SetLootRecipient(NULL); me->ResetPlayerDamageReq(); - if(me->IsInEvadeMode()) return false; - return true; } - inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) { if(!victim || me->hasUnitState(UNIT_STAT_CASTING) && !triggered) return; - me->CastSpell(victim, spellId, triggered); } - inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) { me->CastSpell(me->getVictim(), spellId, triggered); } - inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered) { if(!triggered && me->hasUnitState(UNIT_STAT_CASTING)) return; - me->CastSpell((Unit*)NULL, spellId, triggered); } - inline Creature *CreatureAI::DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime, TempSummonType uiType) { return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); } - inline Creature *CreatureAI::DoSummon(uint32 uiEntry, WorldObject* obj, float fRadius, uint32 uiDespawntime, TempSummonType uiType) { Position pos; obj->GetRandomNearPosition(pos, fRadius); return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); } - inline Creature *CreatureAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ, float fRadius, uint32 uiDespawntime, TempSummonType uiType) { Position pos; @@ -620,6 +561,5 @@ inline Creature *CreatureAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, flo pos.m_positionZ += _fZ; return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); } - #endif diff --git a/src/game/CreatureAIRegistry.cpp b/src/game/CreatureAIRegistry.cpp index 67c1f857a56..900f89da3b4 100644 --- a/src/game/CreatureAIRegistry.cpp +++ b/src/game/CreatureAIRegistry.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "PassiveAI.h" #include "ReactorAI.h" #include "CombatAI.h" @@ -30,7 +29,6 @@ #include "CreatureAIRegistry.h" #include "WaypointMovementGenerator.h" #include "CreatureAIFactory.h" - //#include "CreatureAIImpl.h" namespace AIRegistry { @@ -49,7 +47,6 @@ namespace AIRegistry (new CreatureAIFactory("ArchorAI"))->RegisterSelf(); (new CreatureAIFactory("TurretAI"))->RegisterSelf(); (new CreatureAIFactory("EventAI"))->RegisterSelf(); - (new MovementGeneratorFactory >(RANDOM_MOTION_TYPE))->RegisterSelf(); (new MovementGeneratorFactory >(WAYPOINT_MOTION_TYPE))->RegisterSelf(); } diff --git a/src/game/CreatureAIRegistry.h b/src/game/CreatureAIRegistry.h index 2b92a096731..c75167d74af 100644 --- a/src/game/CreatureAIRegistry.h +++ b/src/game/CreatureAIRegistry.h @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CREATUREAIREGISTRY_H #define TRINITY_CREATUREAIREGISTRY_H - namespace AIRegistry { void Initialize(void); diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 9f2828bf776..2f7bd0ff211 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Creature.h" #include "CreatureAISelector.h" #include "PassiveAI.h" @@ -27,30 +26,24 @@ #include "Pet.h" #include "TemporarySummon.h" #include "CreatureAIFactory.h" - INSTANTIATE_SINGLETON_1(CreatureAIRegistry); INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry); - namespace FactorySelector { CreatureAI* selectAI(Creature *creature) { const CreatureAICreator *ai_factory = NULL; CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance()); - if(creature->isPet()) ai_factory = ai_registry.GetRegistryItem("PetAI"); - //scriptname in db if(!ai_factory) if(CreatureAI* scriptedAI = Script->GetAI(creature)) return scriptedAI; - // AIname in db std::string ainame=creature->GetAIName(); if(!ai_factory && !ainame.empty()) ai_factory = ai_registry.GetRegistryItem( ainame.c_str() ); - // select by NPC flags if(!ai_factory) { @@ -74,7 +67,6 @@ namespace FactorySelector else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) ai_factory = ai_registry.GetRegistryItem("CritterAI"); } - if(!ai_factory) { for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) @@ -86,7 +78,6 @@ namespace FactorySelector } } } - // select by permit check if(!ai_factory) { @@ -106,20 +97,16 @@ namespace FactorySelector } } } - // select NullCreatureAI if not another cases ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); - DEBUG_LOG("Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str() ); return ( ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature) ); } - MovementGenerator* selectMovementGenerator(Creature *creature) { MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance()); assert( creature->GetCreatureInfo() != NULL ); const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType()); - /* if( mv_factory == NULL ) { int best_val = -1; @@ -138,9 +125,7 @@ namespace FactorySelector } } }*/ - return ( mv_factory == NULL ? NULL : mv_factory->Create(creature) ); - } } diff --git a/src/game/CreatureAISelector.h b/src/game/CreatureAISelector.h index 436233b5b21..e7e980518dd 100644 --- a/src/game/CreatureAISelector.h +++ b/src/game/CreatureAISelector.h @@ -17,14 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_CREATUREAISELECTOR_H #define TRINITY_CREATUREAISELECTOR_H - class CreatureAI; class Creature; class MovementGenerator; - namespace FactorySelector { CreatureAI* selectAI(Creature *); diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index b2f5dc354d2..9a6e907f33b 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "CreatureEventAI.h" #include "CreatureEventAIMgr.h" @@ -32,7 +31,6 @@ #include "InstanceData.h" #include "SpellMgr.h" #include "CreatureAIImpl.h" - bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeatMin, uint32 repeatMax ) { if (repeatMin == repeatMax) @@ -45,17 +43,14 @@ bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeat Enabled = false; return false; } - return true; } - int CreatureEventAI::Permissible(const Creature *creature) { if( creature->GetAIName() == "EventAI" ) return PERMIT_BASE_SPECIAL; return PERMIT_BASE_NO; } - CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) { // Need make copy for filter unneeded steps and safe in case table reload @@ -65,7 +60,6 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) std::vector::const_iterator i; for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) { - //Debug check #ifndef TRINITY_DEBUG if ((*i).event_flags & EFLAG_DEBUG_ONLY) @@ -89,16 +83,13 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) } else sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); - bEmptyList = CreatureEventAIList.empty(); Phase = 0; CombatMovementEnabled = true; MeleeEnabled = true; AttackDistance = 0.0f; AttackAngle = 0.0f; - InvinceabilityHpLevel = 0; - //Handle Spawned Events if (!bEmptyList) { @@ -107,32 +98,26 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) ProcessEvent(*i); } } - bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker) { if (!pHolder.Enabled || pHolder.Time) return false; - //Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask) if (pHolder.Event.event_inverse_phase_mask & (1 << Phase)) return false; - CreatureEventAI_Event const& event = pHolder.Event; - //Check event conditions based on the event type, also reset events switch (event.event_type) { case EVENT_T_TIMER: if (!m_creature->isInCombat()) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.timer.repeatMin,event.timer.repeatMax); break; case EVENT_T_TIMER_OOC: if (m_creature->isInCombat()) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.timer.repeatMin,event.timer.repeatMax); break; @@ -140,12 +125,9 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat() || !m_creature->GetMaxHealth()) return false; - uint32 perc = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth(); - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax); break; @@ -154,12 +136,9 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat() || !m_creature->GetMaxPower(POWER_MANA)) return false; - uint32 perc = (m_creature->GetPower(POWER_MANA)*100) / m_creature->GetMaxPower(POWER_MANA); - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax); break; @@ -175,7 +154,6 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_SPELLHIT: //Spell hit is special case, param1 and param2 handled within CreatureEventAI::SpellHit - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.spell_hit.repeatMin,event.spell_hit.repeatMax); break; @@ -193,12 +171,9 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth()) return false; - uint32 perc = (m_creature->getVictim()->GetHealth()*100) / m_creature->getVictim()->GetMaxHealth(); - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax); break; @@ -206,7 +181,6 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_TARGET_CASTING: if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true)) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.target_casting.repeatMin,event.target_casting.repeatMax); break; @@ -214,13 +188,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat()) return false; - Unit* pUnit = DoSelectLowestHpFriendly(event.friendly_hp.radius, event.friendly_hp.hpDeficit); if (!pUnit) return false; - pActionInvoker = pUnit; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.friendly_hp.repeatMin,event.friendly_hp.repeatMax); break; @@ -229,17 +200,13 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat()) return false; - std::list pList; DoFindFriendlyCC(pList, event.friendly_is_cc.radius); - //List is empty if (pList.empty()) return false; - //We don't really care about the whole list, just return first available pActionInvoker = *(pList.begin()); - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.friendly_is_cc.repeatMin,event.friendly_is_cc.repeatMax); break; @@ -248,14 +215,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { std::list pList; DoFindFriendlyMissingBuff(pList, event.friendly_buff.radius, event.friendly_buff.spellId); - //List is empty if (pList.empty()) return false; - //We don't really care about the whole list, just return first available pActionInvoker = *(pList.begin()); - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.friendly_buff.repeatMin,event.friendly_buff.repeatMax); break; @@ -265,11 +229,9 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction //Prevent event from occuring on no unit or non creatures if (!pActionInvoker || pActionInvoker->GetTypeId()!=TYPEID_UNIT) return false; - //Creature id doesn't match up if (((Creature*)pActionInvoker)->GetEntry() != event.summon_unit.creatureId) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.summon_unit.repeatMin,event.summon_unit.repeatMax); break; @@ -278,12 +240,9 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA)) return false; - uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA)*100) / m_creature->getVictim()->GetMaxPower(POWER_MANA); - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax); break; @@ -298,7 +257,6 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction Aura* aura = m_creature->GetAura(event.buffed.spellId,0); if(!aura || aura->GetStackAmount() < event.buffed.amount) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax); break; @@ -308,13 +266,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction //Prevent event from occuring on no unit if (!pActionInvoker) return false; - //Note: checked only aura for effect 0, if need check aura for effect 1/2 then // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) Aura* aura = pActionInvoker->GetAura(event.buffed.spellId,0); if(!aura || aura->GetStackAmount() < event.buffed.amount) return false; - //Repeat Timers pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax); break; @@ -323,25 +279,19 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type); break; } - //Disable non-repeatable events if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE)) pHolder.Enabled = false; - //Store random here so that all random actions match up uint32 rnd = rand(); - //Return if chance for event is not met if (pHolder.Event.event_chance <= rnd % 100) return false; - //Process actions for (uint32 j = 0; j < MAX_ACTIONS; j++) ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker); - return true; } - void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker) { switch (action.type) @@ -350,20 +300,16 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { if (!action.text.TextId1) return; - int32 temp = 0; - if (action.text.TextId2 && action.text.TextId3) temp = RAND(action.text.TextId1,action.text.TextId2,action.text.TextId3); else if (action.text.TextId2 && urand(0,1)) temp = action.text.TextId2; else temp = action.text.TextId1; - if (temp) { Unit* target = NULL; - if (pActionInvoker) { if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) @@ -381,7 +327,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (owner->GetTypeId() == TYPEID_PLAYER) target = owner; } - DoScriptText(temp, m_creature, target); } break; @@ -446,27 +391,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { Unit* target = GetTargetByType(action.cast.target, pActionInvoker); Unit* caster = m_creature; - if (!target) return; - if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) caster = target; - //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS)); - // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them if(action.cast.castFlags & CAST_AURA_NOT_PRESENT) { if(target->HasAura(action.cast.spellId)) return; } - if (canCast) { const SpellEntry* tSpell = GetSpellStore()->LookupEntry(action.cast.spellId); - //Verify that spell exists if (tSpell) { @@ -481,21 +420,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { AttackDistance = 0.0f; AttackAngle = 0.0f; - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); } } - } else { //Interrupt any previous spell if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTURRUPT_PREVIOUS) caster->InterruptNonMeleeSpells(false); - caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED)); } - } else sLog.outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", EventId, m_creature->GetEntry(), action.cast.spellId); @@ -505,14 +440,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SUMMON: { Unit* target = GetTargetByType(action.summon.target, pActionInvoker); - Creature* pCreature = NULL; - if (action.summon.duration) pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); else pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - if (!pCreature) sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); else if (action.summon.target != TARGET_T_SELF && target) @@ -544,14 +476,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SET_UNIT_FIELD: { Unit* target = GetTargetByType(action.set_unit_field.target, pActionInvoker); - // not allow modify important for integrity object fields if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) return; - if (target) target->SetUInt32Value(action.set_unit_field.field, action.set_unit_field.value); - break; } case ACTION_T_SET_UNIT_FLAG: @@ -569,16 +498,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 // ignore no affect case if(CombatMovementEnabled==(action.combat_movement.state!=0)) return; - CombatMovementEnabled = action.combat_movement.state != 0; - //Allow movement (create new targeted movement gen only if idle) if (CombatMovementEnabled) { if(action.combat_movement.melee && m_creature->isInCombat()) if(Unit* victim = m_creature->getVictim()) m_creature->SendMeleeAttackStart(victim); - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); } else @@ -586,7 +512,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if(action.combat_movement.melee && m_creature->isInCombat()) if(Unit* victim = m_creature->getVictim()) m_creature->SendMeleeAttackStop(victim); - m_creature->GetMotionMaster()->MoveIdle(); } break; @@ -608,7 +533,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } else Phase = new_phase; - break; } case ACTION_T_EVADE: @@ -641,7 +565,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_RANGED_MOVEMENT: AttackDistance = (float)action.ranged_movement.distance; AttackAngle = action.ranged_movement.angle/180.0f*M_PI; - if (CombatMovementEnabled) { m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); @@ -659,25 +582,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SUMMON_ID: { Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker); - CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end()) { sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry()); return; } - Creature* pCreature = NULL; if ((*i).second.SpawnTimeSecs) pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs); else pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - if (!pCreature) sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); else if (action.summon_id.target != TARGET_T_SELF && target) pCreature->AI()->AttackStart(target); - break; } case ACTION_T_KILLED_MONSTER: @@ -700,7 +619,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, m_creature->GetEntry()); return; } - pInst->SetData(action.set_inst_data.field, action.set_inst_data.value); break; } @@ -712,31 +630,26 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature->GetEntry()); return; } - InstanceData* pInst = (InstanceData*)m_creature->GetInstanceData(); if (!pInst) { sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, m_creature->GetEntry()); return; } - pInst->SetData64(action.set_inst_data64.field, target->GetGUID()); break; } case ACTION_T_UPDATE_TEMPLATE: if (m_creature->GetEntry() == action.update_template.creatureId) { - sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry()); return; } - m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE); break; case ACTION_T_DIE: if (m_creature->isDead()) { - sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry()); return; } @@ -753,7 +666,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; } break; - // TRINITY ONLY case ACTION_T_SET_ACTIVE: me->setActive(action.raw.param1 ? true : false); @@ -767,7 +679,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SUMMON_GO: { GameObject* pObject = NULL; - float x,y,z; m_creature->GetPosition(x,y,z); pObject = m_creature->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2); @@ -777,7 +688,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } break; } - case ACTION_T_SET_SHEATH: { m_creature->SetSheath(SheathState(action.set_sheath.sheath)); @@ -798,28 +708,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } } } - void CreatureEventAI::JustRespawned() { Reset(); - if (bEmptyList) return; - //Handle Spawned Events for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) if (SpawnedEventConditionsCheck((*i).Event)) ProcessEvent(*i); } - void CreatureEventAI::Reset() { EventUpdateTime = EVENT_UPDATE_TIME; EventDiff = 0; - if (bEmptyList) return; - //Reset all events to enabled for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { @@ -841,11 +745,9 @@ void CreatureEventAI::Reset() } } } - void CreatureEventAI::JustReachedHome() { m_creature->LoadCreaturesAddon(); - if (!bEmptyList) { for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) @@ -854,17 +756,13 @@ void CreatureEventAI::JustReachedHome() ProcessEvent(*i); } } - Reset(); } - void CreatureEventAI::EnterEvadeMode() { CreatureAI::EnterEvadeMode(); - if (bEmptyList) return; - //Handle Evade events for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { @@ -872,49 +770,40 @@ void CreatureEventAI::EnterEvadeMode() ProcessEvent(*i); } } - void CreatureEventAI::JustDied(Unit* killer) { Reset(); - if (bEmptyList) return; - //Handle Evade events for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { if ((*i).Event.event_type == EVENT_T_DEATH) ProcessEvent(*i, killer); } - // reset phase after any death state events Phase = 0; } - void CreatureEventAI::KilledUnit(Unit* victim) { if (bEmptyList || victim->GetTypeId() != TYPEID_PLAYER) return; - for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { if ((*i).Event.event_type == EVENT_T_KILL) ProcessEvent(*i, victim); } } - void CreatureEventAI::JustSummoned(Creature* pUnit) { if (bEmptyList || !pUnit) return; - for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { if ((*i).Event.event_type == EVENT_T_SUMMONED_UNIT) ProcessEvent(*i, pUnit); } } - void CreatureEventAI::EnterCombat(Unit *enemy) { //Check for on combat start events @@ -942,16 +831,13 @@ void CreatureEventAI::EnterCombat(Unit *enemy) } } } - EventUpdateTime = EVENT_UPDATE_TIME; EventDiff = 0; } - void CreatureEventAI::AttackStart(Unit *who) { if (!who) return; - if (m_creature->Attack(who, MeleeEnabled)) { if (CombatMovementEnabled) @@ -964,12 +850,10 @@ void CreatureEventAI::AttackStart(Unit *who) } } } - void CreatureEventAI::MoveInLineOfSight(Unit *who) { if(me->getVictim()) return; - //Check for OOC LOS Event if (!bEmptyList) { @@ -979,7 +863,6 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who) { //can trigger if closer than fMaxAllowedRange float fMaxAllowedRange = (*itr).Event.ooc_los.maxRange; - //if range is ok and we are actually in LOS if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who)) { @@ -991,16 +874,12 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who) } } } - CreatureAI::MoveInLineOfSight(who); } - void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell) { - if (bEmptyList) return; - for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) if ((*i).Event.event_type == EVENT_T_SPELLHIT) //If spell id matches (or no spell id) & if spell school matches (or no spell school) @@ -1008,19 +887,16 @@ void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell) if (pSpell->SchoolMask & (*i).Event.spell_hit.schoolMask) ProcessEvent(*i, pUnit); } - void CreatureEventAI::UpdateAI(const uint32 diff) { //Check if we are in combat (also updates calls threat update code) bool Combat = UpdateVictim(); - if (!bEmptyList) { //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events if (EventUpdateTime < diff) { EventDiff += diff; - //Check for time based events for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) { @@ -1032,13 +908,11 @@ void CreatureEventAI::UpdateAI(const uint32 diff) //Do not decrement timers if event cannot trigger in this phase if (!((*i).Event.event_inverse_phase_mask & (1 << Phase))) (*i).Time -= EventDiff; - //Skip processing of events that have time remaining continue; } else (*i).Time = 0; } - //Events that are updated every EVENT_UPDATE_TIME switch ((*i).Event.event_type) { @@ -1062,7 +936,6 @@ void CreatureEventAI::UpdateAI(const uint32 diff) break; } } - EventDiff = 0; EventUpdateTime = EVENT_UPDATE_TIME; } @@ -1072,22 +945,18 @@ void CreatureEventAI::UpdateAI(const uint32 diff) EventUpdateTime -= diff; } } - //Melee Auto-Attack if (Combat && MeleeEnabled) DoMeleeAttackIfReady(); } - inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position) { //ThreatList m_threatlist; std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); std::list::reverse_iterator r = m_threatlist.rbegin(); - if (position >= m_threatlist.size() || !m_threatlist.size()) return NULL; - switch (target) { case ATTACKING_TARGET_RANDOM: @@ -1108,7 +977,6 @@ inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position } return NULL; } - inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3) { switch (rnd % 3) @@ -1119,7 +987,6 @@ inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uin } return 0; } - inline int32 CreatureEventAI::GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3) { switch (rnd % 3) @@ -1130,7 +997,6 @@ inline int32 CreatureEventAI::GetRandActionParam(uint32 rnd, int32 param1, int32 } return 0; } - inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoker) { switch (Target) @@ -1153,65 +1019,50 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke return NULL; }; } - Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) { CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Unit* pUnit = NULL; - MaNGOS::MostHPMissingInRange u_check(m_creature, range, MinHPDiff); MaNGOS::UnitLastSearcher searcher(m_creature, pUnit, u_check); - /* typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes; This means that if we only search grid then we cannot possibly return pets or players so this is safe */ TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_unit_searcher, *m_creature->GetMap(), *m_creature, range); return pUnit; } - void CreatureEventAI::DoFindFriendlyCC(std::list& _list, float range) { CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::FriendlyCCedInRange u_check(m_creature, range); MaNGOS::CreatureListSearcher searcher(m_creature, _list, u_check); - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap()); } - void CreatureEventAI::DoFindFriendlyMissingBuff(std::list& _list, float range, uint32 spellid) { CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::FriendlyMissingBuffInRange u_check(m_creature, range, spellid); MaNGOS::CreatureListSearcher searcher(m_creature, _list, u_check); - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap()); } - //********************************* //*** Functions used globally *** - void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) { if (!pSource) @@ -1219,23 +1070,18 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.",textEntry); return; } - if (textEntry >= 0) { sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); return; } - CreatureEventAI_TextMap::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAITextMap().find(textEntry); - if (i == CreatureEAI_Mgr.GetCreatureEventAITextMap().end()) { sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); return; } - sLog.outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote); - if((*i).second.SoundId) { if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) @@ -1243,7 +1089,6 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); } - if((*i).second.Emote) { if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) @@ -1253,7 +1098,6 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); } - switch((*i).second.Type) { case CHAT_TYPE_SAY: @@ -1285,48 +1129,37 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* break; } } - bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered) { //No target so we can't cast if (!Target || !Spell) return false; - //Silenced so we can't cast if (!Triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) return false; - //Check for power if (!Triggered && me->GetPower((Powers)Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell))) return false; - SpellRangeEntry const *TempRange = NULL; - TempRange = GetSpellRangeStore()->LookupEntry(Spell->rangeIndex); - //Spell has invalid range store so we can't use it if (!TempRange) return false; - //Unit is out of range of this spell if (!m_creature->IsInRange(Target,TempRange->minRangeHostile,TempRange->maxRangeHostile)) return false; - return true; } - void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) { if (bEmptyList) return; - for (std::list::iterator itr = CreatureEventAIList.begin(); itr != CreatureEventAIList.end(); ++itr) { if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE) { if ((*itr).Event.receive_emote.emoteId != text_emote) return; - PlayerCondition pcon((*itr).Event.receive_emote.condition,(*itr).Event.receive_emote.conditionValue1,(*itr).Event.receive_emote.conditionValue2); if (pcon.Meets(pPlayer)) { @@ -1336,7 +1169,6 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) } } } - void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage ) { if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage) @@ -1347,12 +1179,10 @@ void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage ) damage = m_creature->GetHealth() - InvinceabilityHpLevel; } } - bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event) { if(event.event_type != EVENT_T_SPAWNED) return false; - switch (event.spawned.condition) { case SPAWNED_EVENT_ALWAY: @@ -1371,6 +1201,5 @@ bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& e default: break; } - return false; } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 7882e7542ec..b26dfe2e055 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -15,22 +15,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef MANGOS_CREATURE_EAI_H #define MANGOS_CREATURE_EAI_H - #include "Common.h" #include "Creature.h" #include "CreatureAI.h" #include "Unit.h" - class Player; class WorldObject; - #define EVENT_UPDATE_TIME 500 #define MAX_ACTIONS 3 #define MAX_PHASE 32 - enum EventAI_Type { EVENT_T_TIMER = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax @@ -58,10 +53,8 @@ enum EventAI_Type EVENT_T_RECEIVE_EMOTE = 22, // EmoteId, Condition, CondValue1, CondValue2 EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max - EVENT_T_END, }; - enum EventAI_ActionType { ACTION_T_NONE = 0, // No action @@ -105,44 +98,35 @@ enum EventAI_ActionType ACTION_T_ZONE_COMBAT_PULSE = 38, // No Params ACTION_T_CALL_FOR_HELP = 39, // Radius ACTION_T_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged) - ACTION_T_SET_ACTIVE = 101, //Apply ACTION_T_SET_AGGRESSIVE = 102, //Apply ACTION_T_ATTACK_START_PULSE = 103, //Distance ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms - ACTION_T_FORCE_DESPAWN = 41, // No Params ACTION_T_END = 105, ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health) }; - enum Target { //Self (m_creature) TARGET_T_SELF = 0, //Self cast - //Hostile targets (if pet then returns pet owner) TARGET_T_HOSTILE, //Our current target (ie: highest aggro) TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat - //Invoker targets (if pet then returns pet owner) TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) - //Hostile targets (including pets) TARGET_T_HOSTILE_WPET, //Current target (can be a pet) TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat - TARGET_T_ACTION_INVOKER_WPET, - TARGET_T_END }; - enum CastFlags { CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting @@ -152,7 +136,6 @@ enum CastFlags CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell }; - enum EventFlags { EFLAG_REPEATABLE = 0x01, //Event repeats @@ -164,14 +147,12 @@ enum EventFlags EFLAG_RESERVED_6 = 0x40, EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build }; - enum SpawnedEventMode { SPAWNED_EVENT_ALWAY = 0, SPAWNED_EVENT_MAP = 1, SPAWNED_EVENT_ZONE = 2 }; - // String text additional data, used in (CreatureEventAI) struct StringTextData { @@ -182,7 +163,6 @@ struct StringTextData }; // Text Maps typedef UNORDERED_MAP CreatureEventAI_TextMap; - struct CreatureEventAI_Action { EventAI_ActionType type: 16; @@ -395,19 +375,14 @@ struct CreatureEventAI_Action } raw; }; }; - struct CreatureEventAI_Event { uint32 event_id; - uint32 creature_id; - uint32 event_inverse_phase_mask; - EventAI_Type event_type : 16; uint8 event_chance : 8; uint8 event_flags : 8; - union { // EVENT_T_TIMER = 0 @@ -526,7 +501,6 @@ struct CreatureEventAI_Event uint32 repeatMin; uint32 repeatMax; } buffed; - // RAW struct { @@ -536,41 +510,32 @@ struct CreatureEventAI_Event uint32 param4; } raw; }; - CreatureEventAI_Action action[MAX_ACTIONS]; }; //Event_Map typedef UNORDERED_MAP > CreatureEventAI_Event_Map; - struct CreatureEventAI_Summon { uint32 id; - float position_x; float position_y; float position_z; float orientation; uint32 SpawnTimeSecs; }; - //EventSummon_Map typedef UNORDERED_MAP CreatureEventAI_Summon_Map; - struct CreatureEventAIHolder { CreatureEventAIHolder(CreatureEventAI_Event p) : Event(p), Time(0), Enabled(true){} - CreatureEventAI_Event Event; uint32 Time; bool Enabled; - // helper bool UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax); }; - class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI { - public: explicit CreatureEventAI(Creature *c); ~CreatureEventAI() @@ -592,29 +557,23 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI void UpdateAI(const uint32 diff); void ReceiveEmote(Player* pPlayer, uint32 text_emote); static int Permissible(const Creature *); - bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL); void ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker); inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3); inline int32 GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3); inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker); inline Unit* SelectUnit(AttackingTarget target, uint32 position); - void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target); bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered); - bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event); - Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff); void DoFindFriendlyMissingBuff(std::list& _list, float range, uint32 spellid); void DoFindFriendlyCC(std::list& _list, float range); - //Holder for events (stores enabled, time, and eventid) std::list CreatureEventAIList; uint32 EventUpdateTime; //Time between event updates uint32 EventDiff; //Time between the last event call bool bEmptyList; - //Variables used by Events themselves uint8 Phase; // Current phase, max 32 phases bool CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat) diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 5325edff4a9..18c4ca97de4 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Common.h" #include "Database/DatabaseEnv.h" #include "Database/SQLStorage.h" @@ -26,77 +25,61 @@ #include "Policies/SingletonImp.h" #include "ObjectDefines.h" #include "GridDefines.h" - INSTANTIATE_SINGLETON_1(CreatureEventAIMgr); - // ------------------- void CreatureEventAIMgr::LoadCreatureEventAI_Texts() { // Drop Existing Text Map, only done once and we are ready to add data from multiple sources. m_CreatureEventAI_TextMap.clear(); - // Load EventAI Text objmgr.LoadTrinityStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); - // Gather Additional data from EventAI Texts QueryResult *result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); - sLog.outString("Loading EventAI Texts additional data..."); if (result) { barGoLink bar(result->GetRowCount()); uint32 count = 0; - do { bar.step(); Field* fields = result->Fetch(); StringTextData temp; - int32 i = fields[0].GetInt32(); temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); temp.Emote = fields[4].GetInt32(); - // range negative if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) { sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); continue; } - // range negative (don't must be happen, loaded from same table) if (!objmgr.GetTrinityStringLocale(i)) { sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i); continue; } - if (temp.SoundId) { if (!sSoundEntriesStore.LookupEntry(temp.SoundId)) sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId); } - if (!GetLanguageDescByID(temp.Language)) sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language); - if (temp.Type > CHAT_TYPE_ZONE_YELL) sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type); - if (temp.Emote) { if (!sEmotesStore.LookupEntry(temp.Emote)) sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote); } - m_CreatureEventAI_TextMap[i] = temp; ++count; } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count); } @@ -107,50 +90,39 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() sLog.outString(); sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); } - } - // ------------------- void CreatureEventAIMgr::LoadCreatureEventAI_Summons() { - //Drop Existing EventSummon Map m_CreatureEventAI_Summon_Map.clear(); - // Gather additional data for EventAI QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons"); if (result) { barGoLink bar(result->GetRowCount()); uint32 Count = 0; - do { bar.step(); Field *fields = result->Fetch(); - CreatureEventAI_Summon temp; - uint32 i = fields[0].GetUInt32(); temp.position_x = fields[1].GetFloat(); temp.position_y = fields[2].GetFloat(); temp.position_z = fields[3].GetFloat(); temp.orientation = fields[4].GetFloat(); temp.SpawnTimeSecs = fields[5].GetUInt32(); - if(!MaNGOS::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation)) { sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation); continue; } - //Add to map m_CreatureEventAI_Summon_Map[i] = temp; ++Count; } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count); } @@ -161,15 +133,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() sLog.outString(); sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); } - } - // ------------------- void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { //Drop Existing EventAI List m_CreatureEventAI_Event_Map.clear(); - // Gather event data QueryResult *result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, " "event_param1, event_param2, event_param3, event_param4, " @@ -181,19 +150,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { barGoLink bar(result->GetRowCount()); uint32 Count = 0; - do { bar.step(); Field *fields = result->Fetch(); - CreatureEventAI_Event temp; temp.event_id = EventAI_Type(fields[0].GetUInt32()); uint32 i = temp.event_id; - temp.creature_id = fields[1].GetUInt32(); uint32 creature_id = temp.creature_id; - uint32 e_type = fields[2].GetUInt32(); //Report any errors in event if (e_type >= EVENT_T_END) @@ -202,7 +167,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; } temp.event_type = EventAI_Type(e_type); - temp.event_inverse_phase_mask = fields[3].GetUInt32(); temp.event_chance = fields[4].GetUInt8(); temp.event_flags = fields[5].GetUInt8(); @@ -210,14 +174,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.raw.param2 = fields[7].GetUInt32(); temp.raw.param3 = fields[8].GetUInt32(); temp.raw.param4 = fields[9].GetUInt32(); - //Creature does not exist in database if (!sCreatureStorage.LookupEntry(temp.creature_id)) { sLog.outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); continue; } - //No chance of this event occuring if (temp.event_chance == 0) sLog.outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i); @@ -227,7 +189,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); temp.event_chance = 100; } - //Individual event checks switch (temp.event_type) { @@ -244,10 +205,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_TARGET_MANA: if (temp.percent_range.percentMax > 100) sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); - if (temp.percent_range.percentMax <= temp.percent_range.percentMin) sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); - if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax) { sLog.outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); @@ -263,14 +222,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); continue; } - if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask) sLog.outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); } - if (!temp.spell_hit.schoolMask) sLog.outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); - if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin) sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; @@ -341,7 +297,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); continue; - case EVENT_T_AGGRO: case EVENT_T_DEATH: case EVENT_T_EVADE: @@ -352,10 +307,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); temp.event_flags &= ~EFLAG_REPEATABLE; } - break; } - case EVENT_T_RECEIVE_EMOTE: { if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) @@ -363,22 +316,18 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.",temp.creature_id, i, temp.receive_emote.emoteId); continue; } - if (!PlayerCondition::IsValid(ConditionType(temp.receive_emote.condition), temp.receive_emote.conditionValue1, temp.receive_emote.conditionValue2)) { sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition); continue; } - if (!(temp.event_flags & EFLAG_REPEATABLE)) { sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i); temp.event_flags |= EFLAG_REPEATABLE; } - break; } - case EVENT_T_BUFFED: case EVENT_T_TARGET_BUFFED: { @@ -392,12 +341,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; } - default: sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i); break; } - for (uint32 j = 0; j < MAX_ACTIONS; j++) { uint16 action_type = fields[10+(j*4)].GetUInt16(); @@ -407,14 +354,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.action[j].type = ACTION_T_NONE; continue; } - CreatureEventAI_Action& action = temp.action[j]; - action.type = EventAI_ActionType(action_type); action.raw.param1 = fields[11+(j*4)].GetUInt32(); action.raw.param2 = fields[12+(j*4)].GetUInt32(); action.raw.param3 = fields[13+(j*4)].GetUInt32(); - //Report any errors in actions switch (action.type) { @@ -431,7 +375,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end()) sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); - if (!action.text.TextId1) sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); } @@ -439,7 +382,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end()) sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); - if (!action.text.TextId1 || !action.text.TextId2) sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); } @@ -460,7 +402,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); action.morph.creatureId = 0; } - if (action.morph.modelId) { if (action.morph.creatureId) @@ -516,11 +457,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } } */ - //Cast is always triggered if target is forced to cast on self if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) action.cast.castFlags |= CAST_TRIGGERED; - if (action.cast.target >= TARGET_T_END) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; @@ -528,7 +467,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_SUMMON: if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); - if (action.summon.target >= TARGET_T_END) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; @@ -550,10 +488,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } else sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId); - if (action.quest_event.target >= TARGET_T_END) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; case ACTION_T_CAST_EVENT: if (!sCreatureStorage.LookupEntry(action.cast_event.creatureId)) @@ -682,29 +618,24 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_RANGED_MOVEMENT: //Distance, Angle case ACTION_T_CALL_FOR_HELP: //Distance break; - case ACTION_T_RANDOM_SAY: case ACTION_T_RANDOM_YELL: case ACTION_T_RANDOM_TEXTEMOTE: sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); break; - case ACTION_T_SET_ACTIVE: case ACTION_T_SET_AGGRESSIVE: case ACTION_T_ATTACK_START_PULSE: case ACTION_T_SUMMON_GO: break; - default: sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type); break; } } - //Add to list m_CreatureEventAI_Event_Map[creature_id].push_back(temp); ++Count; - if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(temp.creature_id)) { if(!cInfo->AIName || !cInfo->AIName[0]) @@ -722,11 +653,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry); } - } + } } while (result->NextRow()); - delete result; - sLog.outString(); sLog.outString(">> Loaded %u CreatureEventAI scripts", Count); } diff --git a/src/game/CreatureEventAIMgr.h b/src/game/CreatureEventAIMgr.h index b4672460cc6..821cdb35c6a 100644 --- a/src/game/CreatureEventAIMgr.h +++ b/src/game/CreatureEventAIMgr.h @@ -15,32 +15,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef MANGOS_CREATURE_EAI_MGR_H #define MANGOS_CREATURE_EAI_MGR_H - #include "Common.h" #include "CreatureEventAI.h" - class CreatureEventAIMgr { public: CreatureEventAIMgr(){}; ~CreatureEventAIMgr(){}; - void LoadCreatureEventAI_Texts(); void LoadCreatureEventAI_Summons(); void LoadCreatureEventAI_Scripts(); - CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; } CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; } CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; } - private: CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map; CreatureEventAI_Summon_Map m_CreatureEventAI_Summon_Map; CreatureEventAI_TextMap m_CreatureEventAI_TextMap; }; - #define CreatureEAI_Mgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index 97610754e69..c0816f36804 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -17,28 +17,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "Creature.h" #include "CreatureGroups.h" #include "ObjectMgr.h" #include "ProgressBar.h" #include "Policies/SingletonImp.h" #include "CreatureAI.h" - #define MAX_DESYNC 5.0f - INSTANTIATE_SINGLETON_1(CreatureGroupManager); - CreatureGroupInfoType CreatureGroupMap; - void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member) { Map *map = member->FindMap(); if(!map) return; - CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId); - //Add member to an existing group if(itr != map->CreatureGroupHolder.end()) { @@ -54,58 +47,47 @@ void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member) group->AddMember(member); } } - void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *group, Creature *member) { sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow()); group->RemoveMember(member); - if(group->isEmpty()) { Map *map = member->FindMap(); if(!map) return; - sLog.outDebug("Deleting group with InstanceID %u", member->GetInstanceId()); map->CreatureGroupHolder.erase(group->GetId()); delete group; } } - void CreatureGroupManager::LoadCreatureFormations() { //Clear existing map CreatureGroupMap.clear(); - //Check Integrity of the table QueryResult *result = WorldDatabase.PQuery("SELECT MAX(leaderGUID) FROM creature_formations"); - if(!result) { sLog.outErrorDb(" ...an error occured while loading the table creature_formations ( maybe it doesn't exist ?)\n"); return; } delete result; - //Get group data result = WorldDatabase.PQuery("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID"); - if(!result) { sLog.outErrorDb("The table creature_formations is empty or corrupted"); return; } - uint32 total_records = result->GetRowCount(); barGoLink bar( total_records); Field *fields; - FormationInfo *group_member; //Loading data... do { fields = result->Fetch(); - bar.step(); //Load group member data group_member = new FormationInfo; @@ -123,7 +105,6 @@ void CreatureGroupManager::LoadCreatureFormations() group_member->follow_dist = 0; group_member->follow_angle = 0; } - // check data correctness { QueryResult* result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", group_member->leaderGUID); @@ -132,7 +113,6 @@ void CreatureGroupManager::LoadCreatureFormations() sLog.outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID); continue; } - result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", memberGUID); if(!result) { @@ -140,71 +120,56 @@ void CreatureGroupManager::LoadCreatureFormations() continue; } } - CreatureGroupMap[memberGUID] = group_member; - } + } while(result->NextRow()) ; - sLog.outString(); sLog.outString( ">> Loaded %u creatures in formations", total_records ); sLog.outString(); //Free some heap delete result; } - void CreatureGroup::AddMember(Creature *member) { sLog.outDebug("CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow()); - //Check if it is a leader if(member->GetDBTableGUIDLow() == m_groupID) { sLog.outDebug("Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow()); m_leader = member; } - m_members[member] = CreatureGroupMap.find(member->GetDBTableGUIDLow())->second; member->SetFormation(this); } - void CreatureGroup::RemoveMember(Creature *member) { if(m_leader == member) m_leader = NULL; - m_members.erase(member); member->SetFormation(NULL); } - void CreatureGroup::MemberAttackStart(Creature *member, Unit *target) { uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI; if(!groupAI) return; - if(groupAI == 1 && member != m_leader) return; - for(CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { sLog.outDebug("GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId()); //sLog.outDebug("AI:%u:Group member found: %u, attacked by %s.", groupAI, itr->second->GetGUIDLow(), member->getVictim()->GetName()); - //Skip one check if(itr->first == member) continue; - if(!itr->first->isAlive()) continue; - if(itr->first->getVictim()) continue; - if(itr->first->canAttack(target)) itr->first->AI()->AttackStart(target); } } - void CreatureGroup::FormationReset(bool dismiss) { for(CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) @@ -220,37 +185,28 @@ void CreatureGroup::FormationReset(bool dismiss) } m_Formed = !dismiss; } - void CreatureGroup::LeaderMoveTo(float x, float y, float z) { if(!m_leader) return; - float pathangle = atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x); - for(CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { Creature *member = itr->first; if(member == m_leader || !member->isAlive() || member->getVictim()) continue; - float angle = itr->second->follow_angle; - float dist = itr->second->follow_dist; - + float dist = itr->second->follow_dist; float dx = x + cos(angle + pathangle) * dist; float dy = y + sin(angle + pathangle) * dist; float dz = z; - Trinity::NormalizeMapCoord(dx); Trinity::NormalizeMapCoord(dy); - member->UpdateGroundPositionZ(dx, dy, dz); - if(member->IsWithinDist(m_leader, dist + MAX_DESYNC)) member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags()); else member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - member->GetMotionMaster()->MovePoint(0, dx, dy, dz); member->SetHomePosition(dx, dy, dz, pathangle); } diff --git a/src/game/CreatureGroups.h b/src/game/CreatureGroups.h index cc3eacfe185..1cdbc5c3695 100644 --- a/src/game/CreatureGroups.h +++ b/src/game/CreatureGroups.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2009 MaNGOS * * Copyright (C) 2008-2009 Trinity @@ -17,22 +17,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _FORMATIONS_H #define _FORMATIONS_H - #include "Common.h" - class CreatureGroup; - struct FormationInfo { uint32 leaderGUID; - float follow_dist; - float follow_angle; + float follow_dist; + float follow_angle; uint8 groupAI; }; - class CreatureGroupManager { public: @@ -40,39 +35,29 @@ class CreatureGroupManager void RemoveCreatureFromGroup(CreatureGroup *group, Creature *creature); void LoadCreatureFormations(); }; - typedef UNORDERED_MAP CreatureGroupInfoType; - extern CreatureGroupInfoType CreatureGroupMap; - class CreatureGroup { private: Creature *m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D typedef std::map CreatureGroupMemberType; CreatureGroupMemberType m_members; - uint32 m_groupID; bool m_Formed; - public: //Group cannot be created empty explicit CreatureGroup(uint32 id) : m_groupID(id), m_leader(NULL), m_Formed(false) {} ~CreatureGroup() { sLog.outDebug("Destroying group"); } - Creature* getLeader() const { return m_leader; } uint32 GetId() const { return m_groupID; } bool isEmpty() const { return m_members.empty(); } bool isFormed() const { return m_Formed; } - void AddMember(Creature *member); void RemoveMember(Creature *member); void FormationReset(bool dismiss); - void LeaderMoveTo(float x, float y, float z); void MemberAttackStart(Creature* member, Unit *target); }; - #define formation_mgr Trinity::Singleton::Instance() - #endif diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index a0e030bf7cb..21d23dca840 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -15,36 +15,29 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DBCENUMS_H #define DBCENUMS_H - // Client expected level limitation, like as used in DBC item max levels for "until max player level" // use as default max player level, must be fit max level for used client // also see MAX_LEVEL and STRONG_MAX_LEVEL define #define DEFAULT_MAX_LEVEL 80 - // client supported max level for player/pets/etc. Avoid overflow or client stability affected. // also see GT_MAX_LEVEL define #define MAX_LEVEL 100 - // Server side limitation. Base at used code requirements. // also see MAX_LEVEL and GT_MAX_LEVEL define #define STRONG_MAX_LEVEL 255 - enum AreaTeams { AREATEAM_NONE = 0, AREATEAM_ALLY = 2, AREATEAM_HORDE = 4 }; - enum AchievementFactionFlags { ACHIEVEMENT_FACTION_FLAG_HORDE = 0x00000000, ACHIEVEMENT_FACTION_FLAG_ALLIANCE = 0x00000001, }; - enum AchievementFlags { ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete) @@ -58,7 +51,6 @@ enum AchievementFlags ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, // ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, // }; - enum AchievementCriteriaCondition { ACHIEVEMENT_CRITERIA_CONDITION_NONE = 0, @@ -69,7 +61,6 @@ enum AchievementCriteriaCondition ACHIEVEMENT_CRITERIA_CONDITION_UNK2 = 9, // unk ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13, // unk }; - enum AchievementCriteriaCompletionFlags { ACHIEVEMENT_CRITERIA_FLAG_SHOW_PROGRESS_BAR = 0x00000001, // Show progress as bar @@ -79,13 +70,11 @@ enum AchievementCriteriaCompletionFlags ACHIEVEMENT_CRITERIA_FLAG_UNK5 = 0x00000010, // not used ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020, // Displays counter as money }; - enum AchievementCriteriaGroupFlags { // you mustn't be in a group while fulfilling this achievement ACHIEVEMENT_CRITERIA_GROUP_NOT_IN_GROUP = 2, }; - enum AchievementCriteriaTypes { ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0, @@ -199,7 +188,6 @@ enum AchievementCriteriaTypes // 0..114 => 115 criteria types total ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 115, }; - enum AreaFlags { AREA_FLAG_SNOW = 0x00000001, // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) @@ -231,12 +219,10 @@ enum AreaFlags AREA_FLAG_UNK10 = 0x04000000, // unknown AREA_FLAG_OUTDOOR_PVP2 = 0x08000000 // Wintergrasp and it's subzones }; - enum FactionTemplateFlags { FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats }; - enum FactionMasks { FACTION_MASK_PLAYER = 1, // any player @@ -245,7 +231,6 @@ enum FactionMasks FACTION_MASK_MONSTER = 8 // aggressive creature from monster team // if none flags set then non-aggressive creature }; - enum MapTypes { MAP_COMMON = 0, @@ -254,13 +239,11 @@ enum MapTypes MAP_BATTLEGROUND = 3, MAP_ARENA = 4 }; - enum AbilytyLearnType { ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1, ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 }; - enum ItemEnchantmentType { ITEM_ENCHANTMENT_TYPE_NONE = 0, @@ -273,7 +256,6 @@ enum ItemEnchantmentType ITEM_ENCHANTMENT_TYPE_USE_SPELL = 7, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET = 8 }; - enum TotemCategoryType { TOTEM_CATEGORY_TYPE_KNIFE = 1, @@ -284,7 +266,6 @@ enum TotemCategoryType TOTEM_CATEGORY_TYPE_HAMMER = 23, TOTEM_CATEGORY_TYPE_SPANNER = 24 }; - // SummonProperties.dbc, col 1 enum SummonPropGroup { @@ -294,7 +275,6 @@ enum SummonPropGroup SUMMON_PROP_GROUP_CONTROLLABLE = 3, // 13 spells in 3.0.3, mostly controllable SUMMON_PROP_GROUP_UNKNOWN3 = 4 // 86 spells in 3.0.3, taxi/mounts }; - // SummonProperties.dbc, col 3 enum SummonPropType { @@ -311,7 +291,6 @@ enum SummonPropType SUMMON_PROP_TYPE_DRAKE_VEH = 10, // summon drake (vehicle), 3 spells SUMMON_PROP_TYPE_LIGHTWELL = 11 // summon lightwell, 6 spells in 3.0.3 }; - // SummonProperties.dbc, col 5 enum SummonPropFlags { @@ -331,6 +310,5 @@ enum SummonPropFlags SUMMON_PROP_FLAG_UNK13 = 0x1000, // 8 spells in 3.0.3, siege vehicle SUMMON_PROP_FLAG_UNK14 = 0x2000, // 2 spells in 3.0.3, escort? }; - #endif diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 5dae4cb6e17..fa117a169c0 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -17,27 +17,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "DBCStores.h" #include "Policies/SingletonImp.h" #include "Log.h" #include "ProgressBar.h" #include "SharedDefines.h" #include "SpellMgr.h" - #include "DBCfmt.h" - #include - typedef std::map AreaFlagByAreaID; typedef std::map AreaFlagByMapID; - DBCStorage sAreaStore(AreaTableEntryfmt); DBCStorage sAreaGroupStore(AreaGroupEntryfmt); DBCStorage sAreaPOIStore(AreaPOIEntryfmt); static AreaFlagByAreaID sAreaFlagByAreaID; static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files - DBCStorage sAchievementStore(Achievementfmt); DBCStorage sAchievementCriteriaStore(AchievementCriteriafmt); DBCStorage sAreaTriggerStore(AreaTriggerEntryfmt); @@ -56,23 +50,18 @@ DBCStorage sCreatureFamilyStore(CreatureFamilyfmt); DBCStorage sCreatureSpellDataStore(CreatureSpellDatafmt); DBCStorage sCreatureTypeStore(CreatureTypefmt); DBCStorage sCurrencyTypesStore(CurrencyTypesfmt); - DBCStorage sDurabilityQualityStore(DurabilityQualityfmt); DBCStorage sDurabilityCostsStore(DurabilityCostsfmt); - DBCStorage sEmotesStore(EmotesEntryfmt); DBCStorage sEmotesTextStore(EmotesTextEntryfmt); - typedef std::map FactionTeamMap; static FactionTeamMap sFactionTeamMap; DBCStorage sFactionStore(FactionEntryfmt); DBCStorage sFactionTemplateStore(FactionTemplateEntryfmt); - DBCStorage sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt); DBCStorage sGemPropertiesStore(GemPropertiesEntryfmt); DBCStorage sGlyphPropertiesStore(GlyphPropertiesfmt); DBCStorage sGlyphSlotStore(GlyphSlotfmt); - DBCStorage sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt); DBCStorage sGtCombatRatingsStore(GtCombatRatingsfmt); DBCStorage sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt); @@ -83,9 +72,7 @@ DBCStorage sGtOCTRegenHPStore(GtOCTRegenHPfmt); //DBCStorage sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently DBCStorage sGtRegenHPPerSptStore(GtRegenHPPerSptfmt); DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptfmt); - DBCStorage sHolidaysStore(Holidaysfmt); - DBCStorage sItemStore(Itemfmt); DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); //DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); @@ -95,30 +82,22 @@ DBCStorage sItemLimitCategoryStore(ItemLimitCategoryEnt DBCStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt); DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); DBCStorage sItemSetStore(ItemSetEntryfmt); - DBCStorage sLockStore(LockEntryfmt); - DBCStorage sMailTemplateStore(MailTemplateEntryfmt); DBCStorage sMapStore(MapEntryfmt); DBCStorage sMovieStore(MovieEntryfmt); - DBCStorage sQuestSortStore(QuestSortEntryfmt); - DBCStorage sRandomPropertiesPointsStore(RandomPropertiesPointsfmt); DBCStorage sScalingStatDistributionStore(ScalingStatDistributionfmt); DBCStorage sScalingStatValuesStore(ScalingStatValuesfmt); - DBCStorage sSkillLineStore(SkillLinefmt); DBCStorage sSkillLineAbilityStore(SkillLineAbilityfmt); - DBCStorage sSoundEntriesStore(SoundEntriesfmt); - DBCStorage sSpellItemEnchantmentStore(SpellItemEnchantmentfmt); DBCStorage sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt); DBCStorage sSpellStore(SpellEntryfmt); SpellCategoryStore sSpellCategoryStore; PetFamilySpellsStore sPetFamilySpellsStore; - DBCStorage sSpellCastTimesStore(SpellCastTimefmt); DBCStorage sSpellDurationStore(SpellDurationfmt); DBCStorage sSpellFocusObjectStore(SpellFocusObjectfmt); @@ -131,21 +110,16 @@ DBCStorage sSummonPropertiesStore(SummonPropertiesfmt); DBCStorage sTalentStore(TalentEntryfmt); TalentSpellPosMap sTalentSpellPosMap; DBCStorage sTalentTabStore(TalentTabEntryfmt); - // store absolute bit position for first rank for talent inspect static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; - DBCStorage sTaxiNodesStore(TaxiNodesEntryfmt); TaxiMask sTaxiNodesMask; TaxiMask sOldContinentsNodesMask; - // DBC used only for initialization sTaxiPathSetBySource at startup. TaxiPathSetBySource sTaxiPathSetBySource; DBCStorage sTaxiPathStore(TaxiPathEntryfmt); - // DBC used only for initialization sTaxiPathSetBySource at startup. TaxiPathNodesByPath sTaxiPathNodesByPath; - static DBCStorage sTaxiPathNodeStore(TaxiPathNodeEntryfmt); DBCStorage sTotemCategoryStore(TotemCategoryEntryfmt); DBCStorage sVehicleStore(VehicleEntryfmt); @@ -153,28 +127,22 @@ DBCStorage sVehicleSeatStore(VehicleSeatEntryfmt); DBCStorage sWorldMapAreaStore(WorldMapAreaEntryfmt); DBCStorage sWorldMapOverlayStore(WorldMapOverlayEntryfmt); DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); - typedef std::list StoreProblemList; - static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename) { sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize); - // assert must fail after function call return false; } - template inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename, const std::string * custom_entries = NULL, const std::string * idname = NULL) { // compatibility format and C++ structure sizes assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); - std::string dbc_filename = dbc_path + filename; SqlDbc * sql = NULL; if (custom_entries) sql = new SqlDbc(&filename,custom_entries, idname,storage.GetFormat()); - if(storage.Load(dbc_filename.c_str(), sql)) { bar.step(); @@ -182,7 +150,6 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList { if(!(availableDbcLocales & (1 << i))) continue; - std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename; if(!storage.LoadStringsFrom(dbc_filename_loc.c_str())) availableDbcLocales &= ~(1<DBC records sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag)); - // fill MapId->DBC records ( skip sub zones and continents ) if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 ) sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag)); } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementStore, dbcPath,"Achievement.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementCriteriaStore, dbcPath,"Achievement_Criteria.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaTriggerStore, dbcPath,"AreaTrigger.dbc"); @@ -243,7 +202,6 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharStartOutfitStore, dbcPath,"CharStartOutfit.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharTitlesStore, dbcPath,"CharTitles.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChatChannelsStore, dbcPath,"ChatChannels.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrClassesStore, dbcPath,"ChrClasses.dbc"); @@ -268,7 +226,6 @@ void LoadDBCStores(const std::string& dataPath) flist.push_back(i); } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionTemplateStore, dbcPath,"FactionTemplate.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore, dbcPath,"GameObjectDisplayInfo.dbc"); for(uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i) @@ -283,20 +240,15 @@ void LoadDBCStores(const std::string& dataPath) std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ)); } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGemPropertiesStore, dbcPath,"GemProperties.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphPropertiesStore, dbcPath,"GlyphProperties.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphSlotStore, dbcPath,"GlyphSlot.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtBarberShopCostBaseStore,dbcPath,"gtBarberShopCostBase.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtCombatRatingsStore, dbcPath,"gtCombatRatings.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritBaseStore, dbcPath,"gtChanceToMeleeCritBase.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritStore, dbcPath,"gtChanceToMeleeCrit.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritBaseStore, dbcPath,"gtChanceToSpellCritBase.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritStore, dbcPath,"gtChanceToSpellCrit.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenHPStore, dbcPath,"gtOCTRegenHP.dbc"); //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenHPPerSptStore, dbcPath,"gtRegenHPPerSpt.dbc"); @@ -329,16 +281,12 @@ void LoadDBCStores(const std::string& dataPath) if(spell && spell->Category) sSpellCategoryStore[spell->Category].insert(i); } - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) { SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if(!skillLine) continue; - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(spellInfo && IsPassiveSpell(spellInfo->Id)) { for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) @@ -346,20 +294,16 @@ void LoadDBCStores(const std::string& dataPath) CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i); if(!cFamily) continue; - if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) continue; if(spellInfo->spellLevel) continue; - if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL) continue; - sPetFamilySpellsStore[i].insert(spellInfo->Id); } } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellCastTimesStore, dbcPath,"SpellCastTimes.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDurationStore, dbcPath,"SpellDuration.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore, dbcPath,"SpellFocusObject.dbc"); @@ -372,7 +316,6 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc"); - // create talent spells set for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { @@ -382,9 +325,7 @@ void LoadDBCStores(const std::string& dataPath) if(talentInfo->RankID[j]) sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j); } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentTabStore, dbcPath,"TalentTab.dbc"); - // prepare fast data access to bit pos of talent ranks for use at inspecting { // now have all max ranks (and then bit amount used for store talent ranks in inspect) @@ -393,27 +334,21 @@ void LoadDBCStores(const std::string& dataPath) TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId ); if(!talentTabInfo) continue; - // prevent memory corruption; otherwise cls will become 12 below if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE)==0) continue; - // store class talent tab pages uint32 cls = 1; for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES;m <<=1, ++cls) {} - sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId; } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiNodesStore, dbcPath,"TaxiNodes.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc"); for(uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i) if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i)) sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price); uint32 pathCount = sTaxiPathStore.GetNumRows(); - //## TaxiPathNode.dbc ## Loaded only for initialization different structures LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathNodeStore, dbcPath,"TaxiPathNode.dbc"); // Calculate path nodes count @@ -434,7 +369,6 @@ void LoadDBCStores(const std::string& dataPath) if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay); sTaxiPathNodeStore.Clear(); - // Initialize global taxinodes mask // include existed nodes that have at least single not spell base (scripted) path { @@ -444,7 +378,6 @@ void LoadDBCStores(const std::string& dataPath) for(int j=0; j < 3; ++j) if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/) spellPaths.insert(sInfo->EffectMiscValue[j]); - memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask)); memset(sOldContinentsNodesMask,0,sizeof(sTaxiNodesMask)); for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) @@ -452,7 +385,6 @@ void LoadDBCStores(const std::string& dataPath) TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); if(!node) continue; - TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i); if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty()) { @@ -466,29 +398,24 @@ void LoadDBCStores(const std::string& dataPath) break; } } - if(!ok) continue; } - // valid taxi network node uint8 field = (uint8)((i - 1) / 32); uint32 submask = 1<<((i-1)%32); sTaxiNodesMask[field] |= submask; - // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info) if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94) sOldContinentsNodesMask[field] |= submask; } } - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTotemCategoryStore, dbcPath,"TotemCategory.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc"); - // error checks if(bad_dbc_files.size() >= DBCFilesCount ) { @@ -500,11 +427,9 @@ void LoadDBCStores(const std::string& dataPath) std::string str; for(std::list::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) str += *i + "\n"; - sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s",(uint32)bad_dbc_files.size(),DBCFilesCount,str.c_str()); exit(1); } - // Check loaded DBC files proper version if( !sSpellStore.LookupEntry(66530) || // last added spell in 3.1.3 !sMapStore.LookupEntry(624) || // last map added in 3.1.3 @@ -517,11 +442,9 @@ void LoadDBCStores(const std::string& dataPath) sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client."); exit(1); } - sLog.outString(); sLog.outString( ">> Initialized %d data stores", DBCFilesCount ); } - SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember) { for(FactionTeamMap::const_iterator itr = sFactionTeamMap.begin(); itr != sFactionTeamMap.end(); ++itr) @@ -542,7 +465,6 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember) } return NULL; } - char* GetPetName(uint32 petfamily, uint32 dbclang) { if(!petfamily) @@ -552,53 +474,41 @@ char* GetPetName(uint32 petfamily, uint32 dbclang) return NULL; return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL; } - TalentSpellPos const* GetTalentSpellPos(uint32 spellId) { TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); if(itr==sTalentSpellPosMap.end()) return NULL; - return &itr->second; } - uint32 GetTalentSpellCost(uint32 spellId) { if(TalentSpellPos const* pos = GetTalentSpellPos(spellId)) return pos->rank+1; - return 0; } - int32 GetAreaFlagByAreaID(uint32 area_id) { AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); if(i == sAreaFlagByAreaID.end()) return -1; - return i->second; } - AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) { int32 areaflag = GetAreaFlagByAreaID(area_id); if(areaflag < 0) return NULL; - return sAreaStore.LookupEntry(areaflag ); } - AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id) { if(area_flag) return sAreaStore.LookupEntry(area_flag); - if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) return GetAreaEntryByAreaID(mapEntry->linked_zone); - return NULL; } - uint32 GetAreaFlagByMapId(uint32 mapid) { AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); @@ -607,28 +517,22 @@ uint32 GetAreaFlagByMapId(uint32 mapid) else return i->second; } - uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) { if(mapid != 530 && mapid != 571) // speed for most cases return mapid; - if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId)) return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; - return mapid; } - ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) { mapid = GetVirtualMapForMapAndZone(mapid,zoneId); if(mapid < 2) return CONTENT_1_60; - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if(!mapEntry) return CONTENT_1_60; - switch(mapEntry->Expansion()) { default: return CONTENT_1_60; @@ -636,7 +540,6 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) case 2: return CONTENT_71_80; } } - ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id) { // not sorted, numbering index from 0 @@ -648,58 +551,46 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id) } return NULL; } - bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId) { if(requiredTotemCategoryId==0) return true; if(itemTotemCategoryId==0) return false; - TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId); if(!itemEntry) return false; TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId); if(!reqEntry) return false; - if(itemEntry->categoryType!=reqEntry->categoryType) return false; - return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask; } - void Zone2MapCoordinates(float& x,float& y,uint32 zone) { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); - // if not listed then map coordinates (instance) if(!maEntry) return; - std::swap(x,y); // at client map coords swapped x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1; y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down } - void Map2ZoneCoordinates(float& x,float& y,uint32 zone) { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); - // if not listed then map coordinates (instance) if(!maEntry) return; - x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100); y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down std::swap(x,y); // client have map coords swapped } - uint32 const* GetTalentTabPages(uint32 cls) { return sTalentTabPages[cls]; } - // script support functions TRINITY_DLL_SPEC DBCStorage const* GetSoundEntriesStore() { return &sSoundEntriesStore; } TRINITY_DLL_SPEC DBCStorage const* GetSpellStore() { return &sSpellStore; } diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 4fd5b6bcb59..90ac6dd97c8 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -15,30 +15,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef MANGOS_DBCSTORES_H #define MANGOS_DBCSTORES_H - #include "Common.h" #include "Database/DBCStore.h" #include "DBCStructure.h" - #include - typedef std::list SimpleFactionsList; - SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember); char* GetPetName(uint32 petfamily, uint32 dbclang); uint32 GetTalentSpellCost(uint32 spellId); TalentSpellPos const* GetTalentSpellPos(uint32 spellId); - int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id); AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id); uint32 GetAreaFlagByMapId(uint32 mapid); - uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId); - enum ContentLevels { CONTENT_1_60 = 0, @@ -46,16 +38,11 @@ enum ContentLevels CONTENT_71_80 }; ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); - ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id); - bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); - void Zone2MapCoordinates(float& x,float& y,uint32 zone); void Map2ZoneCoordinates(float& x,float& y,uint32 zone); - uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls); - extern DBCStorage sAchievementStore; extern DBCStorage sAchievementCriteriaStore; extern DBCStorage sAreaStore;// recommend access using functions @@ -87,7 +74,6 @@ extern DBCStorage sGameObjectDisplayInfoStore; extern DBCStorage sGemPropertiesStore; extern DBCStorage sGlyphPropertiesStore; extern DBCStorage sGlyphSlotStore; - extern DBCStorage sGtBarberShopCostBaseStore; extern DBCStorage sGtCombatRatingsStore; extern DBCStorage sGtChanceToMeleeCritBaseStore; @@ -146,9 +132,7 @@ extern DBCStorage sVehicleSeatStore; //extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates extern DBCStorage sWorldMapOverlayStore; extern DBCStorage sWorldSafeLocsStore; - void LoadDBCStores(const std::string& dataPath); - // script support functions TRINITY_DLL_SPEC DBCStorage const* GetSoundEntriesStore(); TRINITY_DLL_SPEC DBCStorage const* GetSpellStore(); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 7e459c61e8b..98f4dfd3744 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -17,27 +17,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef MANGOS_DBCSTRUCTURE_H #define MANGOS_DBCSTRUCTURE_H - #include "DBCEnums.h" #include "Platform/Define.h" #include "Util.h" - #include #include #include - // Structures using to access raw DBC data and required packing to portability - // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack(1) #else #pragma pack(push,1) #endif - struct AchievementEntry { uint32 ID; // 0 @@ -58,7 +52,6 @@ struct AchievementEntry uint32 count; // 60 - need this count of completed criterias (own or referenced achievement criterias) uint32 refAchievement; // 61 - referenced achievement (counting of all completed criterias) }; - struct AchievementCategoryEntry { uint32 ID; // 0 @@ -67,7 +60,6 @@ struct AchievementCategoryEntry //uint32 name_flags; // 18 //uint32 sortOrder; // 19 }; - struct AchievementCriteriaEntry { uint32 ID; // 0 @@ -82,7 +74,6 @@ struct AchievementCriteriaEntry uint32 creatureID; // 3 uint32 creatureCount; // 4 } kill_creature; - // ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1 struct { @@ -93,105 +84,89 @@ struct AchievementCriteriaEntry uint32 additionalRequirement2_type; // 7 additional requirement 2 type uint32 additionalRequirement2_value; // 8 additional requirement 1 value } win_bg; - // ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5 struct { uint32 unused; // 3 uint32 level; // 4 } reach_level; - // ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7 struct { uint32 skillID; // 3 uint32 skillLevel; // 4 } reach_skill_level; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8 struct { uint32 linkedAchievement; // 3 } complete_achievement; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9 struct { uint32 unused; // 3 uint32 totalQuestCount; // 4 } complete_quest_count; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10 struct { uint32 unused; // 3 uint32 numberOfDays; // 4 } complete_daily_quest_daily; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11 struct { uint32 zoneID; // 3 uint32 questCount; // 4 } complete_quests_in_zone; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14 struct { uint32 unused; // 3 uint32 questCount; // 4 } complete_daily_quest; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND = 15 struct { uint32 mapID; // 3 } complete_battleground; - // ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP = 16 struct { uint32 mapID; // 3 } death_at_map; - // ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18 struct { uint32 manLimit; // 3 } death_in_dungeon; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19 struct { uint32 groupSize; // 3 can be 5, 10 or 25 } complete_raid; - // ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20 struct { uint32 creatureEntry; // 3 } killed_by_creature; - // ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24 struct { uint32 unused; // 3 uint32 fallHeight; // 4 } fall_without_dying; - // ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26 struct { uint32 type; // 3, see enum EnviromentalDamage } death_from; - // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27 struct { uint32 questID; // 3 uint32 questCount; // 4 } complete_quest; - // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28 // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2 = 69 struct @@ -199,7 +174,6 @@ struct AchievementCriteriaEntry uint32 spellID; // 3 uint32 spellCount; // 4 } be_spell_target; - // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL = 29 // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110 struct @@ -207,39 +181,33 @@ struct AchievementCriteriaEntry uint32 spellID; // 3 uint32 castCount; // 4 } cast_spell; - // ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31 struct { uint32 areaID; // 3 Reference to AreaTable.dbc uint32 killCount; // 4 } honorable_kill_at_area; - // ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32 struct { uint32 mapID; // 3 Reference to Map.dbc } win_arena; - // ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33 struct { uint32 mapID; // 3 Reference to Map.dbc } play_arena; - // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34 struct { uint32 spellID; // 3 Reference to Map.dbc } learn_spell; - // ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36 struct { uint32 itemID; // 3 uint32 itemCount; // 4 } own_item; - // ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37 struct { @@ -247,90 +215,77 @@ struct AchievementCriteriaEntry uint32 count; // 4 uint32 flag; // 5 4=in a row } win_rated_arena; - // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38 struct { uint32 teamtype; // 3 {2,3,5} } highest_team_rating; - // ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING = 39 struct { uint32 teamtype; // 3 {2,3,5} uint32 teamrating; // 4 } reach_team_rating; - // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40 struct { uint32 skillID; // 3 uint32 skillLevel; // 4 apprentice=1, journeyman=2, expert=3, artisan=4, master=5, grand master=6 } learn_skill_level; - // ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41 struct { uint32 itemID; // 3 uint32 itemCount; // 4 } use_item; - // ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM = 42 struct { uint32 itemID; // 3 uint32 itemCount; // 4 } loot_item; - // ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43 struct { // TODO: This rank is _NOT_ the index from AreaTable.dbc uint32 areaReference; // 3 } explore_area; - // ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK = 44 struct { // TODO: This rank is _NOT_ the index from CharTitles.dbc uint32 rank; // 3 } own_rank; - // ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT = 45 struct { uint32 unused; // 3 uint32 numberOfSlots; // 4 } buy_bank_slot; - // ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION = 46 struct { uint32 factionID; // 3 uint32 reputationAmount; // 4 Total reputation amount, so 42000 = exalted } gain_reputation; - // ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47 struct { uint32 unused; // 3 uint32 numberOfExaltedFactions; // 4 } gain_exalted_reputation; - // ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP = 48 struct { uint32 unused; // 3 uint32 numberOfVisits; // 4 } visit_barber; - // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49 // TODO: where is the required itemlevel stored? struct { uint32 itemSlot; // 3 } equip_epic_item; - // ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50 struct { @@ -343,21 +298,18 @@ struct AchievementCriteriaEntry uint32 rollValue; // 3 uint32 count; // 4 } roll_greed_on_loot; - // ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52 struct { uint32 classID; // 3 uint32 count; // 4 } hk_class; - // ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53 struct { uint32 raceID; // 3 uint32 count; // 4 } hk_race; - // ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54 // TODO: where is the information about the target stored? struct @@ -375,14 +327,12 @@ struct AchievementCriteriaEntry uint32 flag; // 5 =3 for battleground healing uint32 mapid; // 6 } healing_done; - // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57 struct { uint32 itemID; // 3 uint32 count; // 4 } equip_item; - // ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD= 62 struct { @@ -390,21 +340,18 @@ struct AchievementCriteriaEntry uint32 goldInCopper; // 4 } quest_reward_money; - // ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67 struct { uint32 unused; // 3 uint32 goldInCopper; // 4 } loot_money; - // ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68 struct { uint32 goEntry; // 3 uint32 useCount; // 4 } use_gameobject; - // ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL = 70 // TODO: are those special criteria stored in the dbc or do we have to add another sql table? struct @@ -412,73 +359,62 @@ struct AchievementCriteriaEntry uint32 unused; // 3 uint32 killCount; // 4 } special_pvp_kill; - // ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72 struct { uint32 goEntry; // 3 uint32 lootCount; // 4 } fish_in_gameobject; - // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS = 75 struct { uint32 skillLine; // 3 uint32 spellCount; // 4 } learn_skillline_spell; - // ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76 struct { uint32 unused; // 3 uint32 duelCount; // 4 } win_duel; - // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96 struct { uint32 powerType; // 3 mana=0, 1=rage, 3=energy, 6=runic power } highest_power; - // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97 struct { uint32 statType; // 3 4=spirit, 3=int, 2=stamina, 1=agi, 0=strength } highest_stat; - // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98 struct { uint32 spellSchool; // 3 } highest_spellpower; - // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100 struct { uint32 ratingType; // 3 } highest_rating; - // ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109 struct { uint32 lootType; // 3 3=fishing, 2=pickpocket, 4=disentchant uint32 lootTypeCount; // 4 } loot_type; - // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE = 112 struct { uint32 skillLine; // 3 uint32 spellCount; // 4 } learn_skill_line; - // ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113 struct { uint32 unused; // 3 uint32 killCount; // 4 } honorable_kill; - struct { uint32 field3; // 3 main requirement @@ -499,7 +435,6 @@ struct AchievementCriteriaEntry uint32 timeLimit; // 29 time limit in seconds //uint32 showOrder; // 30 show order }; - struct AreaTableEntry { uint32 ID; // 0 @@ -512,7 +447,6 @@ struct AreaTableEntry char* area_name[16]; // 11-26 // 27, string flags, unused uint32 team; // 28 - // helpers bool IsSanctuary() const { @@ -521,14 +455,12 @@ struct AreaTableEntry return (flags & AREA_FLAG_SANCTUARY); } }; - struct AreaGroupEntry { uint32 AreaGroupId; // 0 uint32 AreaId[6]; // 1-6 uint32 nextGroup; // 7 index of next group }; - struct AreaPOIEntry { uint32 id; //0 @@ -546,7 +478,6 @@ struct AreaPOIEntry uint32 worldState; //52 //uint32 val2; //53 }; - struct AreaTriggerEntry { uint32 id; // 0 m_ID @@ -560,7 +491,6 @@ struct AreaTriggerEntry float box_z; // 8 m_box_heigh float box_orientation; // 9 m_box_yaw }; - struct AuctionHouseEntry { uint32 houseId; // 0 index @@ -570,13 +500,11 @@ struct AuctionHouseEntry //char* name[16]; // 4-19 // 20 string flag, unused }; - struct BankBagSlotPricesEntry { uint32 ID; uint32 price; }; - struct BarberShopStyleEntry { uint32 Id; // 0 @@ -590,7 +518,6 @@ struct BarberShopStyleEntry uint32 gender; // 38 0 -> male, 1 -> female uint32 hair_id; // 39 real ID to hair/facial hair }; - struct BattlemasterListEntry { uint32 id; // 0 @@ -607,9 +534,7 @@ struct BattlemasterListEntry // 33 unused //uint32 unk; // 34 new 3.1 }; - #define MAX_OUTFIT_ITEMS 24 - struct CharStartOutfitEntry { //uint32 Id; // 0 @@ -621,7 +546,6 @@ struct CharStartOutfitEntry //uint32 Unknown2; // 39 //uint32 Unknown3; // 40 }; - struct CharTitlesEntry { uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId() @@ -632,7 +556,6 @@ struct CharTitlesEntry // 35 string flag, unused uint32 bit_index; // 36 used in PLAYER_CHOSEN_TITLE and 1<