*Integrate Script system to Core

-added ScriptMgr for loading scripts
-removed bindings
-moved script system to src/game
-moved scripts to src/scripts
-VC project files updated
-cmakes updated (not 100% done yet)

NOTE to Devs:
-file locations changed
-precompiled renamed to ScriptedPch
-ecsort_ai renamed to ScriptedEscortAI
-follower_ai renamed to ScriptedFollowerAI
-guard_ai renamed to ScriptedGuardAI
-simple_ai renamed to ScriptedSimpleAI
-sc_creature renamed to ScriptedCreature
-sc_gossip renamed to ScriptedGossip
-sc_instance  renamed to ScriptedInstance

*use the new headers in scripts, thank you

NOTE to ALL:
cmake not fully tested, please report any errors with it
could make creashes, incompability
USE AT YOUR OWN RISK before further tests!!

--HG--
branch : trunk
This commit is contained in:
Rat
2010-01-19 11:36:05 +01:00
parent f5dea61b66
commit 0cc053ea4d
601 changed files with 3908 additions and 7245 deletions
+551
View File
@@ -227,6 +227,26 @@ SET(game_STAT_SRCS
ReputationMgr.h
ScriptCalls.cpp
ScriptCalls.h
ScriptedCreature.cpp
ScriptedCreature.h
ScriptedEscortAI.cpp
ScriptedEscortAI.h
ScriptedFollowerAI.cpp
ScriptedFollowerAI.h
ScriptedGossip.h
ScriptedGuardAI.cpp
ScriptedGuardAI.h
ScriptedInstance.h
ScriptedPch.cpp
ScriptedPch.h
ScriptedSimpleAI.cpp
ScriptedSimpleAI.h
ScriptLoader.cpp
ScriptLoader.h
ScriptMgr.cpp
ScriptMgr.h
ScriptSystem.cpp
ScriptSystem.h
SharedDefines.h
SkillHandler.cpp
SpellAuraDefines.h
@@ -303,5 +323,536 @@ SET(game_STAT_SRCS
OutdoorPvPImpl.h
ZoneScript.h
)
if (DO_SCRIPTS)
LIST(APPEND game_STAT_SRCS
../scripts/custom/on_events.cpp
../scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_anubshiah.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_gorosh_the_dervish.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_grizzle.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_high_interrogator_gerstahn.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_moira_bronzebeard.cpp
../scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp
../scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h
../scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_drakkisath.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_gyth.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_halycon.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_highlord_omokk.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_overlord_wyrmthalak.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_pyroguard_emberseer.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_quartermaster_zigris.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_rend_blackhand.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_shadow_hunter_voshgajin.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_the_beast.cpp
../scripts/eastern_kingdoms/blackrock_spire/boss_warmaster_voone.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_broodlord_lashlayer.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_ebonroc.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_firemaw.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_flamegor.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_razorgore.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_vaelastrasz.cpp
../scripts/eastern_kingdoms/blackwing_lair/boss_victor_nefarius.cpp
../scripts/eastern_kingdoms/blackwing_lair/instance_blackwing_lair.cpp
../scripts/eastern_kingdoms/deadmines/boss_mr_smite.cpp
../scripts/eastern_kingdoms/deadmines/deadmines.h
../scripts/eastern_kingdoms/deadmines/deadmines.cpp
../scripts/eastern_kingdoms/deadmines/instance_deadmines.cpp
../scripts/eastern_kingdoms/gnomeregan/gnomeregan.h
../scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp
../scripts/eastern_kingdoms/gnomeregan/instance_gnomeregan.cpp
../scripts/eastern_kingdoms/karazhan/boss_curator.cpp
../scripts/eastern_kingdoms/karazhan/boss_maiden_of_virtue.cpp
../scripts/eastern_kingdoms/karazhan/boss_midnight.cpp
../scripts/eastern_kingdoms/karazhan/boss_moroes.cpp
../scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp
../scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp
../scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp
../scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp
../scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp
../scripts/eastern_kingdoms/karazhan/bosses_opera.cpp
../scripts/eastern_kingdoms/karazhan/karazhan.h
../scripts/eastern_kingdoms/karazhan/instance_karazhan.cpp
../scripts/eastern_kingdoms/karazhan/karazhan.cpp
../scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp
../scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp
../scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp
../scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp
../scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.h
../scripts/eastern_kingdoms/magisters_terrace/instance_magisters_terrace.cpp
../scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp
../scripts/eastern_kingdoms/molten_core/boss_baron_geddon.cpp
../scripts/eastern_kingdoms/molten_core/boss_garr.cpp
../scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp
../scripts/eastern_kingdoms/molten_core/boss_golemagg.cpp
../scripts/eastern_kingdoms/molten_core/boss_lucifron.cpp
../scripts/eastern_kingdoms/molten_core/boss_magmadar.cpp
../scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp
../scripts/eastern_kingdoms/molten_core/boss_ragnaros.cpp
../scripts/eastern_kingdoms/molten_core/boss_shazzrah.cpp
../scripts/eastern_kingdoms/molten_core/boss_sulfuron_harbinger.cpp
../scripts/eastern_kingdoms/molten_core/molten_core.h
../scripts/eastern_kingdoms/molten_core/instance_molten_core.cpp
../scripts/eastern_kingdoms/molten_core/molten_core.cpp
../scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
../scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
../scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp
../scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_arcanist_doan.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_azshir_the_sleepless.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_bloodmage_thalnos.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_houndmaster_loksey.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_interrogator_vishas.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_scorn.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp
../scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp
../scripts/eastern_kingdoms/scarlet_monastery/instance_scarlet_monastery.cpp
../scripts/eastern_kingdoms/scarlet_monastery/scarlet_monastery.h
../scripts/eastern_kingdoms/scholomance/boss_darkmaster_gandling.cpp
../scripts/eastern_kingdoms/scholomance/boss_death_knight_darkreaver.cpp
../scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp
../scripts/eastern_kingdoms/scholomance/boss_illucia_barov.cpp
../scripts/eastern_kingdoms/scholomance/boss_instructor_malicia.cpp
../scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp
../scripts/eastern_kingdoms/scholomance/boss_kormok.cpp
../scripts/eastern_kingdoms/scholomance/boss_lord_alexei_barov.cpp
../scripts/eastern_kingdoms/scholomance/boss_lorekeeper_polkelt.cpp
../scripts/eastern_kingdoms/scholomance/boss_ras_frostwhisper.cpp
../scripts/eastern_kingdoms/scholomance/boss_the_ravenian.cpp
../scripts/eastern_kingdoms/scholomance/boss_vectus.cpp
../scripts/eastern_kingdoms/scholomance/scholomance.h
../scripts/eastern_kingdoms/scholomance/instance_scholomance.cpp
../scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.h
../scripts/eastern_kingdoms/shadowfang_keep/instance_shadowfang_keep.cpp
../scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp
../scripts/eastern_kingdoms/stratholme/boss_baron_rivendare.cpp
../scripts/eastern_kingdoms/stratholme/boss_baroness_anastari.cpp
../scripts/eastern_kingdoms/stratholme/boss_cannon_master_willey.cpp
../scripts/eastern_kingdoms/stratholme/boss_dathrohan_balnazzar.cpp
../scripts/eastern_kingdoms/stratholme/boss_magistrate_barthilas.cpp
../scripts/eastern_kingdoms/stratholme/boss_maleki_the_pallid.cpp
../scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp
../scripts/eastern_kingdoms/stratholme/boss_order_of_silver_hand.cpp
../scripts/eastern_kingdoms/stratholme/boss_postmaster_malown.cpp
../scripts/eastern_kingdoms/stratholme/boss_ramstein_the_gorger.cpp
../scripts/eastern_kingdoms/stratholme/boss_timmy_the_cruel.cpp
../scripts/eastern_kingdoms/stratholme/stratholme.h
../scripts/eastern_kingdoms/stratholme/instance_stratholme.cpp
../scripts/eastern_kingdoms/stratholme/stratholme.cpp
../scripts/eastern_kingdoms/sunken_temple/sunken_temple.h
../scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp
../scripts/eastern_kingdoms/sunken_temple/sunken_temple.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp
../scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp
../scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.cpp
../scripts/eastern_kingdoms/sunwell_plateau/sunwell_plateau.h
../scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp
../scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp
../scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp
../scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp
../scripts/eastern_kingdoms/uldaman/uldaman.cpp
../scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp
../scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp
../scripts/eastern_kingdoms/zulaman/boss_hexlord.cpp
../scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
../scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp
../scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp
../scripts/eastern_kingdoms/zulaman/zulaman.h
../scripts/eastern_kingdoms/zulaman/instance_zulaman.cpp
../scripts/eastern_kingdoms/zulaman/zulaman.cpp
../scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp
../scripts/eastern_kingdoms/zulgurub/boss_gahzranka.cpp
../scripts/eastern_kingdoms/zulgurub/boss_grilek.cpp
../scripts/eastern_kingdoms/zulgurub/boss_hakkar.cpp
../scripts/eastern_kingdoms/zulgurub/boss_hazzarah.cpp
../scripts/eastern_kingdoms/zulgurub/boss_jeklik.cpp
../scripts/eastern_kingdoms/zulgurub/boss_jindo.cpp
../scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp
../scripts/eastern_kingdoms/zulgurub/boss_marli.cpp
../scripts/eastern_kingdoms/zulgurub/boss_renataki.cpp
../scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp
../scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp
../scripts/eastern_kingdoms/zulgurub/boss_wushoolay.cpp
../scripts/eastern_kingdoms/zulgurub/zulgurub.h
../scripts/eastern_kingdoms/zulgurub/instance_zulgurub.cpp
../scripts/eastern_kingdoms/alterac_mountains.cpp
../scripts/eastern_kingdoms/arathi_highlands.cpp
../scripts/eastern_kingdoms/blasted_lands.cpp
../scripts/eastern_kingdoms/boss_kruul.cpp
../scripts/eastern_kingdoms/burning_steppes.cpp
../scripts/eastern_kingdoms/dun_morogh.cpp
../scripts/eastern_kingdoms/duskwood.cpp
../scripts/eastern_kingdoms/eastern_plaguelands.cpp
../scripts/eastern_kingdoms/elwynn_forest.cpp
../scripts/eastern_kingdoms/eversong_woods.cpp
../scripts/eastern_kingdoms/ghostlands.cpp
../scripts/eastern_kingdoms/hinterlands.cpp
../scripts/eastern_kingdoms/ironforge.cpp
../scripts/eastern_kingdoms/isle_of_queldanas.cpp
../scripts/eastern_kingdoms/loch_modan.cpp
../scripts/eastern_kingdoms/redridge_mountains.cpp
../scripts/eastern_kingdoms/searing_gorge.cpp
../scripts/eastern_kingdoms/silvermoon_city.cpp
../scripts/eastern_kingdoms/silverpine_forest.cpp
../scripts/eastern_kingdoms/stormwind_city.cpp
../scripts/eastern_kingdoms/stranglethorn_vale.cpp
../scripts/eastern_kingdoms/tirisfal_glades.cpp
../scripts/eastern_kingdoms/undercity.cpp
../scripts/eastern_kingdoms/western_plaguelands.cpp
../scripts/eastern_kingdoms/westfall.cpp
../scripts/eastern_kingdoms/wetlands.cpp
../scripts/examples/example_creature.cpp
../scripts/examples/example_escort.cpp
../scripts/examples/example_gossip_codebox.cpp
../scripts/examples/example_misc.cpp
../scripts/kalimdor/blackfathom_depths/boss_gelihast.cpp
../scripts/kalimdor/blackfathom_depths/boss_kelris.cpp
../scripts/kalimdor/blackfathom_depths/boss_aku_mai.cpp
../scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp
../scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp
../scripts/kalimdor/blackfathom_depths/blackfathom_deeps.h
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp
../scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h
../scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.h
../scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp
../scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp
../scripts/kalimdor/caverns_of_time/dark_portal/boss_aeonus.cpp
../scripts/kalimdor/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp
../scripts/kalimdor/caverns_of_time/dark_portal/boss_temporus.cpp
../scripts/kalimdor/caverns_of_time/hyjal/boss_anetheron.cpp
../scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp
../scripts/kalimdor/caverns_of_time/hyjal/boss_azgalor.cpp
../scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp
../scripts/kalimdor/caverns_of_time/hyjal/boss_rage_winterchill.cpp
../scripts/kalimdor/caverns_of_time/hyjal/hyjal.h
../scripts/kalimdor/caverns_of_time/hyjal/hyjal.cpp
../scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.cpp
../scripts/kalimdor/caverns_of_time/hyjal/hyjal_trash.h
../scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
../scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.h
../scripts/kalimdor/caverns_of_time/hyjal/instance_hyjal.cpp
../scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp
../scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp
../scripts/kalimdor/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp
../scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.h
../scripts/kalimdor/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp
../scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
../scripts/kalimdor/maraudon/boss_celebras_the_cursed.cpp
../scripts/kalimdor/maraudon/boss_landslide.cpp
../scripts/kalimdor/maraudon/boss_noxxion.cpp
../scripts/kalimdor/maraudon/boss_princess_theradras.cpp
../scripts/kalimdor/onyxias_lair/boss_onyxia.cpp
../scripts/kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp
../scripts/kalimdor/razorfen_downs/razorfen_downs.cpp
../scripts/kalimdor/razorfen_kraul/razorfen_kraul.h
../scripts/kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp
../scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_ayamiss.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_kurinnaxx.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_moam.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_ossirian.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp
../scripts/kalimdor/ruins_of_ahnqiraj/ruins_of_ahnqiraj.h
../scripts/kalimdor/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_bug_trio.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_fankriss.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_huhuran.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_sartura.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp
../scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp
../scripts/kalimdor/temple_of_ahnqiraj/temple_of_ahnqiraj.h
../scripts/kalimdor/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp
../scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
../scripts/kalimdor/wailing_caverns/wailing_caverns.h
../scripts/kalimdor/wailing_caverns/instance_wailing_caverns.cpp
../scripts/kalimdor/wailing_caverns/wailing_caverns.cpp
../scripts/kalimdor/zulfarrak/zulfarrak.cpp
../scripts/kalimdor/ashenvale.cpp
../scripts/kalimdor/azshara.cpp
../scripts/kalimdor/azuremyst_isle.cpp
../scripts/kalimdor/bloodmyst_isle.cpp
../scripts/kalimdor/boss_azuregos.cpp
../scripts/kalimdor/darkshore.cpp
../scripts/kalimdor/desolace.cpp
../scripts/kalimdor/dustwallow_marsh.cpp
../scripts/kalimdor/felwood.cpp
../scripts/kalimdor/feralas.cpp
../scripts/kalimdor/moonglade.cpp
../scripts/kalimdor/mulgore.cpp
../scripts/kalimdor/orgrimmar.cpp
../scripts/kalimdor/silithus.cpp
../scripts/kalimdor/stonetalon_mountains.cpp
../scripts/kalimdor/tanaris.cpp
../scripts/kalimdor/teldrassil.cpp
../scripts/kalimdor/the_barrens.cpp
../scripts/kalimdor/thousand_needles.cpp
../scripts/kalimdor/thunder_bluff.cpp
../scripts/kalimdor/ungoro_crater.cpp
../scripts/kalimdor/winterspring.cpp
../scripts/northrend/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp
../scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp
../scripts/northrend/azjol_nerub/azjol_nerub/boss_hadronox.cpp
../scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp
../scripts/northrend/azjol_nerub/azjol_nerub/azjol_nerub.h
../scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp
../scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
../scripts/northrend/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
../scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp
../scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
../scripts/northrend/azjol_nerub/ahnkahet/boss_amanitar.cpp
../scripts/northrend/azjol_nerub/ahnkahet/ahnkahet.h
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_argent_challenge.cpp
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_black_knight.cpp
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/instance_trial_of_the_champion.cpp
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp
../scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.h
../scripts/northrend/draktharon_keep/instance_drak_tharon_keep.cpp
../scripts/northrend/draktharon_keep/boss_trollgore.cpp
../scripts/northrend/draktharon_keep/boss_novos.cpp
../scripts/northrend/draktharon_keep/boss_dred.cpp
../scripts/northrend/draktharon_keep/boss_tharon_ja.cpp
../scripts/northrend/draktharon_keep/drak_tharon_keep.h
../scripts/northrend/gundrak/instance_gundrak.cpp
../scripts/northrend/gundrak/boss_slad_ran.cpp
../scripts/northrend/gundrak/boss_moorabi.cpp
../scripts/northrend/gundrak/boss_drakkari_colossus.cpp
../scripts/northrend/gundrak/boss_gal_darah.cpp
../scripts/northrend/gundrak/boss_eck.cpp
../scripts/northrend/gundrak/gundrak.h
../scripts/northrend/naxxramas/boss_anubrekhan.cpp
../scripts/northrend/naxxramas/boss_faerlina.cpp
../scripts/northrend/naxxramas/boss_gluth.cpp
../scripts/northrend/naxxramas/boss_gothik.cpp
../scripts/northrend/naxxramas/boss_grobbulus.cpp
../scripts/northrend/naxxramas/boss_heigan.cpp
../scripts/northrend/naxxramas/boss_kelthuzad.cpp
../scripts/northrend/naxxramas/boss_four_horsemen.cpp
../scripts/northrend/naxxramas/boss_loatheb.cpp
../scripts/northrend/naxxramas/boss_maexxna.cpp
../scripts/northrend/naxxramas/boss_noth.cpp
../scripts/northrend/naxxramas/boss_patchwerk.cpp
../scripts/northrend/naxxramas/boss_razuvious.cpp
../scripts/northrend/naxxramas/boss_sapphiron.cpp
../scripts/northrend/naxxramas/boss_thaddius.cpp
../scripts/northrend/naxxramas/naxxramas.h
../scripts/northrend/naxxramas/instance_naxxramas.cpp
../scripts/northrend/nexus/eye_of_eternity/instance_eye_of_eternity.cpp
../scripts/northrend/nexus/eye_of_eternity/boss_malygos.cpp
../scripts/northrend/nexus/eye_of_eternity/eye_of_eternity.h
../scripts/northrend/nexus/nexus/instance_nexus.cpp
../scripts/northrend/nexus/nexus/boss_magus_telestra.cpp
../scripts/northrend/nexus/nexus/boss_anomalus.cpp
../scripts/northrend/nexus/nexus/boss_ormorok.cpp
../scripts/northrend/nexus/nexus/boss_keristrasza.cpp
../scripts/northrend/nexus/nexus/commander_stoutbeard.cpp
../scripts/northrend/nexus/nexus/commander_kolurg.cpp
../scripts/northrend/nexus/nexus/nexus.h
../scripts/northrend/nexus/oculus/instance_oculus.cpp
../scripts/northrend/nexus/oculus/boss_drakos.cpp
../scripts/northrend/nexus/oculus/boss_urom.cpp
../scripts/northrend/nexus/oculus/boss_varos.cpp
../scripts/northrend/nexus/oculus/boss_eregos.cpp
../scripts/northrend/nexus/oculus/oculus.h
../scripts/northrend/obsidian_sanctum/instance_obsidian_sanctum.cpp
../scripts/northrend/obsidian_sanctum/boss_sartharion.cpp
../scripts/northrend/obsidian_sanctum/obsidian_sanctum.h
../scripts/northrend/ulduar/halls_of_stone/instance_halls_of_stone.cpp
../scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
../scripts/northrend/ulduar/halls_of_stone/boss_krystallus.cpp
../scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp
../scripts/northrend/ulduar/halls_of_stone/halls_of_stone.h
../scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp
../scripts/northrend/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp
../scripts/northrend/ulduar/halls_of_lightning/boss_bjarngrim.cpp
../scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp
../scripts/northrend/ulduar/halls_of_lightning/boss_volkhan.cpp
../scripts/northrend/ulduar/halls_of_lightning/boss_loken.cpp
../scripts/northrend/ulduar/halls_of_lightning/halls_of_lightning.h
../scripts/northrend/ulduar/ulduar/boss_algalon.cpp
../scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp
../scripts/northrend/ulduar/ulduar/boss_auriaya.cpp
../scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
../scripts/northrend/ulduar/ulduar/boss_freya.cpp
../scripts/northrend/ulduar/ulduar/boss_general_vezax.cpp
../scripts/northrend/ulduar/ulduar/boss_hodir.cpp
../scripts/northrend/ulduar/ulduar/boss_ignis.cpp
../scripts/northrend/ulduar/ulduar/boss_kologarn.cpp
../scripts/northrend/ulduar/ulduar/boss_mimiron.cpp
../scripts/northrend/ulduar/ulduar/boss_razorscale.cpp
../scripts/northrend/ulduar/ulduar/boss_thorim.cpp
../scripts/northrend/ulduar/ulduar/boss_xt002.cpp
../scripts/northrend/ulduar/ulduar/boss_yoggsaron.cpp
../scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp
../scripts/northrend/ulduar/ulduar/ulduar.h
../scripts/northrend/ulduar/ulduar/instance_ulduar.cpp
../scripts/northrend/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp
../scripts/northrend/utgarde_keep/utgarde_keep/boss_keleseth.cpp
../scripts/northrend/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp
../scripts/northrend/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
../scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.h
../scripts/northrend/utgarde_keep/utgarde_keep/utgarde_keep.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_svala.cpp
../scripts/northrend/utgarde_keep/utgarde_pinnacle/utgarde_pinnacle.h
../scripts/northrend/vault_of_archavon/instance_vault_of_archavon.cpp
../scripts/northrend/vault_of_archavon/boss_archavon.cpp
../scripts/northrend/vault_of_archavon/boss_emalon.cpp
../scripts/northrend/vault_of_archavon/vault_of_archavon.h
../scripts/northrend/violet_hold/instance_violet_hold.cpp
../scripts/northrend/violet_hold/boss_cyanigosa.cpp
../scripts/northrend/violet_hold/boss_erekem.cpp
../scripts/northrend/violet_hold/boss_ichoron.cpp
../scripts/northrend/violet_hold/boss_lavanthor.cpp
../scripts/northrend/violet_hold/boss_moragg.cpp
../scripts/northrend/violet_hold/boss_xevozz.cpp
../scripts/northrend/violet_hold/boss_zuramat.cpp
../scripts/northrend/violet_hold/violet_hold.h
../scripts/northrend/violet_hold/violet_hold.cpp
../scripts/northrend/dalaran.cpp
../scripts/northrend/borean_tundra.cpp
../scripts/northrend/dragonblight.cpp
../scripts/northrend/grizzly_hills.cpp
../scripts/northrend/howling_fjord.cpp
../scripts/northrend/icecrown.cpp
../scripts/northrend/sholazar_basin.cpp
../scripts/northrend/storm_peaks.cpp
../scripts/northrend/wintergrasp.cpp
../scripts/northrend/zuldrak.cpp
../scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp
../scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp
../scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
../scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp
../scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp
../scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp
../scripts/outland/auchindoun/sethekk_halls/sethekk_halls.h
../scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp
../scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp
../scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp
../scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
../scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp
../scripts/outland/auchindoun/shadow_labyrinth/shadow_labyrinth.h
../scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
../scripts/outland/black_temple/black_temple.cpp
../scripts/outland/black_temple/boss_bloodboil.cpp
../scripts/outland/black_temple/boss_illidan.cpp
../scripts/outland/black_temple/boss_mother_shahraz.cpp
../scripts/outland/black_temple/boss_reliquary_of_souls.cpp
../scripts/outland/black_temple/boss_shade_of_akama.cpp
../scripts/outland/black_temple/boss_supremus.cpp
../scripts/outland/black_temple/boss_teron_gorefiend.cpp
../scripts/outland/black_temple/boss_warlord_najentus.cpp
../scripts/outland/black_temple/black_temple.h
../scripts/outland/black_temple/illidari_council.cpp
../scripts/outland/black_temple/instance_black_temple.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp
../scripts/outland/coilfang_resevoir/serpent_shrine/serpent_shrine.h
../scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
../scripts/outland/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp
../scripts/outland/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp
../scripts/outland/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp
../scripts/outland/coilfang_resevoir/steam_vault/steam_vault.h
../scripts/outland/coilfang_resevoir/steam_vault/instance_steam_vault.cpp
../scripts/outland/coilfang_resevoir/underbog/boss_hungarfen.cpp
../scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
../scripts/outland/gruuls_lair/boss_gruul.cpp
../scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp
../scripts/outland/gruuls_lair/gruuls_lair.h
../scripts/outland/gruuls_lair/instance_gruuls_lair.cpp
../scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp
../scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
../scripts/outland/hellfire_citadel/blood_furnace/boss_the_maker.cpp
../scripts/outland/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp
../scripts/outland/hellfire_citadel/blood_furnace/blood_furnace.h
../scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp
../scripts/outland/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp
../scripts/outland/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
../scripts/outland/hellfire_citadel/hellfire_ramparts/hellfire_ramparts.h
../scripts/outland/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp
../scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
../scripts/outland/hellfire_citadel/magtheridons_lair/magtheridons_lair.h
../scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp
../scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
../scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
../scripts/outland/hellfire_citadel/shattered_halls/shattered_halls.h
../scripts/outland/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp
../scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp
../scripts/outland/tempest_keep/arcatraz/arcatraz.cpp
../scripts/outland/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp
../scripts/outland/tempest_keep/arcatraz/arcatraz.h
../scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp
../scripts/outland/tempest_keep/botanica/boss_high_botanist_freywinn.cpp
../scripts/outland/tempest_keep/botanica/boss_laj.cpp
../scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp
../scripts/outland/tempest_keep/the_eye/boss_alar.cpp
../scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp
../scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp
../scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp
../scripts/outland/tempest_keep/the_eye/the_eye.h
../scripts/outland/tempest_keep/the_eye/instance_the_eye.cpp
../scripts/outland/tempest_keep/the_eye/the_eye.cpp
../scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_gyrokill.cpp
../scripts/outland/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp
../scripts/outland/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp
../scripts/outland/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp
../scripts/outland/tempest_keep/the_mechanar/mechanar.h
../scripts/outland/tempest_keep/the_mechanar/instance_mechanar.cpp
../scripts/outland/blades_edge_mountains.cpp
../scripts/outland/boss_doomlord_kazzak.cpp
../scripts/outland/boss_doomwalker.cpp
../scripts/outland/hellfire_peninsula.cpp
../scripts/outland/nagrand.cpp
../scripts/outland/netherstorm.cpp
../scripts/outland/shadowmoon_valley.cpp
../scripts/outland/shattrath_city.cpp
../scripts/outland/terokkar_forest.cpp
../scripts/outland/zangarmarsh.cpp
../scripts/world/areatrigger_scripts.cpp
../scripts/world/boss_emeriss.cpp
../scripts/world/boss_lethon.cpp
../scripts/world/boss_taerar.cpp
../scripts/world/boss_ysondre.cpp
../scripts/world/go_scripts.cpp
../scripts/world/guards.cpp
../scripts/world/item_scripts.cpp
../scripts/world/mob_generic_creature.cpp
../scripts/world/npc_innkeeper.cpp
../scripts/world/npc_professions.cpp
../scripts/world/npcs_special.cpp
../scripts/world/npc_taxi.cpp
)
endif (DO_SCRIPTS)
add_library(game STATIC ${game_STAT_SRCS})
ADD_DEPENDENCIES(game revision.h)
+11 -11
View File
@@ -44,6 +44,7 @@
#include "Util.h"
#include "ScriptCalls.h"
#include "SpellId.h"
#include "ScriptMgr.h"
class LoginQueryHolder : public SqlQueryHolder
{
@@ -817,8 +818,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
m_playerLoading = false;
//Hook for OnLogin Event
Script->OnLogin(pCurrChar);
sScriptMgr.OnLogin(pCurrChar);
delete holder;
}
@@ -1381,45 +1381,45 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
void WorldSession::HandleOnPVPKill(Player *killed)
{
Script->OnPVPKill(GetPlayer(), killed);
sScriptMgr.OnPVPKill(GetPlayer(), killed);
}
bool WorldSession::HandleOnPlayerChat(const char *text)
{
return Script->OnPlayerChat(GetPlayer(), text);
return sScriptMgr.OnPlayerChat(GetPlayer(), text);
}
uint32 WorldSession::HandleOnGetXP(uint32 amount)
{
return Script->OnGetXP(GetPlayer(), amount);
return sScriptMgr.OnGetXP(GetPlayer(), amount);
}
int32 WorldSession::HandleOnGetMoney(int32 amount)
{
return Script->OnGetMoney(GetPlayer(), amount);
return sScriptMgr.OnGetMoney(GetPlayer(), amount);
}
void WorldSession::HandleOnAreaChange(AreaTableEntry const *pArea)
{
Script->OnAreaChange(GetPlayer(), pArea);
sScriptMgr.OnAreaChange(GetPlayer(), pArea);
}
bool WorldSession::HandleOnItemClick(Item *pItem)
{
return Script->OnItemClick(GetPlayer(), pItem);
return sScriptMgr.OnItemClick(GetPlayer(), pItem);
}
bool WorldSession::HandleOnItemOpen(Item *pItem)
{
return Script->OnItemOpen(GetPlayer(), pItem);
return sScriptMgr.OnItemOpen(GetPlayer(), pItem);
}
bool WorldSession::HandleOnGoClick(GameObject *pGameObject)
{
return Script->OnGoClick(GetPlayer(), pGameObject);
return sScriptMgr.OnGoClick(GetPlayer(), pGameObject);
}
void WorldSession::HandleOnCreatureKill(Creature *pCreature)
{
Script->OnCreatureKill(GetPlayer(), pCreature);
sScriptMgr.OnCreatureKill(GetPlayer(), pCreature);
}
-1
View File
@@ -724,7 +724,6 @@ ChatCommand * ChatHandler::getCommandTable()
{ "pinfo", SEC_GAMEMASTER, true, &ChatHandler::HandlePInfoCommand, "", NULL },
{ "respawn", SEC_ADMINISTRATOR, false, &ChatHandler::HandleRespawnCommand, "", NULL },
{ "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
{ "loadscripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLoadScriptsCommand, "", NULL },
{ "mute", SEC_MODERATOR, true, &ChatHandler::HandleMuteCommand, "", NULL },
{ "unmute", SEC_MODERATOR, true, &ChatHandler::HandleUnmuteCommand, "", NULL },
{ "movegens", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMovegensCommand, "", NULL },
-2
View File
@@ -495,8 +495,6 @@ class TRINITY_DLL_SPEC ChatHandler
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);
+2 -1
View File
@@ -27,6 +27,7 @@
#include "Pet.h"
#include "TemporarySummon.h"
#include "CreatureAIFactory.h"
#include "ScriptMgr.h"
INSTANTIATE_SINGLETON_1(CreatureAIRegistry);
INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry);
@@ -43,7 +44,7 @@ namespace FactorySelector
//scriptname in db
if(!ai_factory)
if(CreatureAI* scriptedAI = Script->GetAI(creature))
if(CreatureAI* scriptedAI = sScriptMgr.GetAI(creature))
return scriptedAI;
// AIname in db
+2 -1
View File
@@ -38,6 +38,7 @@
#include "GridNotifiersImpl.h"
#include "SpellMgr.h"
#include "ScriptCalls.h"
#include "ScriptMgr.h"
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
{
@@ -898,7 +899,7 @@ bool ChatHandler::HandleDebugItemExpireCommand(const char* args)
return false;
m_session->GetPlayer()->DestroyItem( i->GetBagSlot(),i->GetSlot(), true);
Script->ItemExpire(m_session->GetPlayer(),i->GetProto());
sScriptMgr.ItemExpire(m_session->GetPlayer(),i->GetProto());
return true;
}
+2 -1
View File
@@ -26,6 +26,7 @@
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
#include "ScriptCalls.h"
#include "ScriptMgr.h"
void AddItemsSetItem(Player*player,Item *item)
{
@@ -285,7 +286,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff)
{
Script->ItemExpire(owner, GetProto());
sScriptMgr.ItemExpire(owner, GetProto());
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
return;
}
-8
View File
@@ -1383,14 +1383,6 @@ bool ChatHandler::HandleReloadMailLevelRewardCommand(const char* /*arg*/)
return true;
}
bool ChatHandler::HandleLoadScriptsCommand(const char *args)
{
if(!LoadScriptingModule(args)) return true;
sWorld.SendGMText(LANG_SCRIPTS_RELOADED);
return true;
}
bool ChatHandler::HandleReloadAuctionsCommand(const char *args)
{
///- Reload dynamic data tables from the database
+2 -1
View File
@@ -39,6 +39,7 @@
#include "Vehicle.h"
#include "WaypointManager.h"
#include "DBCEnums.h"
#include "ScriptMgr.h"
#include "MapInstanced.h"
#include "InstanceSaveMgr.h"
@@ -2749,7 +2750,7 @@ void InstanceMap::CreateInstanceData(bool load)
if (mInstance)
{
i_script_id = mInstance->script_id;
i_data = Script->CreateInstanceData(this);
i_data = sScriptMgr.CreateInstanceData(this);
}
if (!i_data)
+6 -5
View File
@@ -48,6 +48,7 @@
#include "Vehicle.h"
#include "CreatureAI.h"
#include "DBCEnums.h"
#include "ScriptMgr.h"
void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
{
@@ -128,21 +129,21 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
{
if(unit)
{
if(!Script->GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
if(!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
Script->GOSelectWithCode( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str());
sScriptMgr.GOSelectWithCode( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str());
}
else
{
if(unit)
{
if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
if(!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
Script->GOSelect( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId));
sScriptMgr.GOSelect( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId));
}
}
@@ -866,7 +867,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
}
}
if(Script->scriptAreaTrigger(GetPlayer(), atEntry))
if(sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
return;
uint32 quest_id = objmgr.GetQuestForAreaTrigger( Trigger_ID );
+2 -1
View File
@@ -37,6 +37,7 @@
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "Guild.h"
#include "ScriptMgr.h"
void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
{
@@ -291,7 +292,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
}
}
if(!Script->GossipHello(_player, unit))
if(!sScriptMgr.GossipHello(_player, unit))
{
_player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
_player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId);
+11 -10
View File
@@ -33,6 +33,7 @@
#include "Group.h"
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "ScriptMgr.h"
void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
@@ -56,7 +57,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
Creature* cr_questgiver=(Creature*)questgiver;
if( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
{
questStatus = Script->NPCDialogStatus(_player, cr_questgiver);
questStatus = sScriptMgr.NPCDialogStatus(_player, cr_questgiver);
if( questStatus > 6 )
questStatus = getDialogStatus(_player, cr_questgiver, defstatus);
}
@@ -66,7 +67,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u",uint32(GUID_LOPART(guid)) );
GameObject* go_questgiver=(GameObject*)questgiver;
questStatus = Script->GODialogStatus(_player, go_questgiver);
questStatus = sScriptMgr.GODialogStatus(_player, go_questgiver);
if( questStatus > 6 )
questStatus = getDialogStatus(_player, go_questgiver, defstatus);
break;
@@ -101,7 +102,7 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
// Stop the npc if moving
pCreature->StopMoving();
if(Script->GossipHello( _player, pCreature ) )
if(sScriptMgr.GossipHello( _player, pCreature ) )
return;
_player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId);
@@ -188,12 +189,12 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
switch(pObject->GetTypeId())
{
case TYPEID_UNIT:
Script->QuestAccept(_player, ((Creature*)pObject), qInfo );
sScriptMgr.QuestAccept(_player, ((Creature*)pObject), qInfo );
break;
case TYPEID_ITEM:
case TYPEID_CONTAINER:
{
Script->ItemQuestAccept(_player, ((Item*)pObject), qInfo );
sScriptMgr.ItemQuestAccept(_player, ((Item*)pObject), qInfo );
// destroy not required for quest finish quest starting item
bool destroyItem = true;
@@ -212,7 +213,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
break;
}
case TYPEID_GAMEOBJECT:
Script->GOQuestAccept(_player, ((GameObject*)pObject), qInfo );
sScriptMgr.GOQuestAccept(_player, ((GameObject*)pObject), qInfo );
break;
}
_player->PlayerTalkClass->CloseGossip();
@@ -297,7 +298,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
switch(pObject->GetTypeId())
{
case TYPEID_UNIT:
if( !(Script->ChooseReward( _player, ((Creature*)pObject), pQuest, reward )) )
if( !(sScriptMgr.ChooseReward( _player, ((Creature*)pObject), pQuest, reward )) )
{
// Send next quest
if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
@@ -305,7 +306,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
}
break;
case TYPEID_GAMEOBJECT:
if( !Script->GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) )
if( !sScriptMgr.GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) )
{
// Send next quest
if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
@@ -661,7 +662,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
continue;
if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
questStatus = Script->NPCDialogStatus(_player, questgiver);
questStatus = sScriptMgr.NPCDialogStatus(_player, questgiver);
if( questStatus > 6 )
questStatus = getDialogStatus(_player, questgiver, defstatus);
@@ -676,7 +677,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
continue;
if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
questStatus = Script->GODialogStatus(_player, questgiver);
questStatus = sScriptMgr.GODialogStatus(_player, questgiver);
if( questStatus > 6 )
questStatus = getDialogStatus(_player, questgiver, defstatus);
+4 -93
View File
@@ -27,101 +27,12 @@
#include "ScriptCalls.h"
#include "World.h"
#include "Config/ConfigEnv.h"
#include "ScriptMgr.h"
ScriptsSet Script=NULL;
void UnloadScriptingModule()
bool LoadScriptingModule()
{
if(Script)
{
//todo: some check if some func from script library is called right now
Script->ScriptsFree();
TRINITY_CLOSE_LIBRARY(Script->hScriptsLib);
delete Script;
Script = NULL;
}
}
bool LoadScriptingModule(char const* libName)
{
ScriptsSet testScript=new _ScriptSet;
std::string name = strlen(libName) ? libName : TRINITY_SCRIPT_NAME;
name += TRINITY_SCRIPT_EXT;
testScript->hScriptsLib=TRINITY_LOAD_LIBRARY(name.c_str());
if(!testScript->hScriptsLib )
{
printf("Error loading Scripts Library %s !\n",name.c_str());
delete testScript;
return false;
}
if( !(testScript->ScriptsInit =(scriptCallScriptsInit )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" ))
||!(testScript->OnLogin =(scriptCallOnLogin )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogin" ))
||!(testScript->OnLogout =(scriptCallOnLogout )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogout" ))
||!(testScript->OnPVPKill =(scriptCallOnPVPKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPVPKill" ))
||!(testScript->OnLogin =(scriptCallOnLogin )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogin" ))
||!(testScript->OnLogout =(scriptCallOnLogout )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogout" ))
||!(testScript->OnPVPKill =(scriptCallOnPVPKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPVPKill" ))
||!(testScript->OnSpellCast =(scriptCallOnSpellCast )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnSpellCast" ))
||!(testScript->OnGetXP =(scriptCallOnGetXP )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGetXP" ))
||!(testScript->OnGetMoney =(scriptCallOnGetMoney )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGetMoney" ))
||!(testScript->OnPlayerChat =(scriptCallOnPlayerChat )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPlayerChat" ))
||!(testScript->OnServerStartup =(scriptCallOnServerStartup )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnServerStartup" ))
||!(testScript->OnServerShutdown =(scriptCallOnServerShutdown )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnServerShutdown" ))
||!(testScript->OnAreaChange =(scriptCallOnAreaChange )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnAreaChange" ))
||!(testScript->OnItemClick =(scriptCallOnItemClick )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnItemClick" ))
||!(testScript->OnItemOpen =(scriptCallOnItemOpen )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnItemOpen" ))
||!(testScript->OnGoClick =(scriptCallOnGoClick )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGoClick" ))
||!(testScript->OnCreatureKill =(scriptCallOnCreatureKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnCreatureKill" ))
||!(testScript->ScriptsFree =(scriptCallScriptsFree )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" ))
||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" ))
||!(testScript->GossipHello =(scriptCallGossipHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" ))
||!(testScript->GOChooseReward =(scriptCallGOChooseReward )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" ))
||!(testScript->QuestAccept =(scriptCallQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" ))
||!(testScript->GossipSelect =(scriptCallGossipSelect )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect" ))
||!(testScript->GossipSelectWithCode=(scriptCallGossipSelectWithCode)TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelectWithCode"))
||!(testScript->GOSelect =(scriptCallGOSelect )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOSelect" ))
||!(testScript->GOSelectWithCode =(scriptCallGOSelectWithCode )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOSelectWithCode" ))
||!(testScript->QuestSelect =(scriptCallQuestSelect )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestSelect" ))
||!(testScript->QuestComplete =(scriptCallQuestComplete )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestComplete" ))
||!(testScript->NPCDialogStatus =(scriptCallNPCDialogStatus )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"NPCDialogStatus" ))
||!(testScript->GODialogStatus =(scriptCallGODialogStatus )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GODialogStatus" ))
||!(testScript->ChooseReward =(scriptCallChooseReward )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ChooseReward" ))
||!(testScript->ItemHello =(scriptCallItemHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemHello" ))
||!(testScript->GOHello =(scriptCallGOHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOHello" ))
||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" ))
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
||!(testScript->ItemUse =(scriptCallItemUse )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" ))
||!(testScript->ItemExpire =(scriptCallItemExpire )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemExpire" ))
||!(testScript->EffectDummyGameObj =(scriptCallEffectDummyGameObj )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj" ))
||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
||!(testScript->EffectDummyItem =(scriptCallEffectDummyItem )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyItem" ))
||!(testScript->GetAI =(scriptCallGetAI )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GetAI" ))
||!(testScript->CreateInstanceData =(scriptCallCreateInstanceData )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"CreateInstanceData" ))
)
{
printf("Error loading Scripts Library %s !\n Library missing required functions.",name.c_str());
TRINITY_CLOSE_LIBRARY(testScript->hScriptsLib);
delete testScript;
return false;
}
sLog.outString();
sLog.outString( ">>> Scripts Library %s was successfully loaded.\n", name.c_str() );
//heh we are still there :P we have a valid library
//we reload script
UnloadScriptingModule();
Script=testScript;
Script->ScriptsInit(sConfig.GetFilename().c_str());
sWorld.SetScriptsVersion(Script->ScriptsVersion());
sScriptMgr.ScriptsInit();
sWorld.SetScriptsVersion(sScriptMgr.ScriptsVersion());
return true;
}
+2 -3
View File
@@ -34,8 +34,7 @@ class SpellCastTargets;
class Map;
class InstanceData;
bool LoadScriptingModule(char const* libName = "");
void UnloadScriptingModule();
bool LoadScriptingModule();
//On Event Handlers
typedef void(TRINITY_IMPORT * scriptCallOnLogin) (Player *pPlayer);
@@ -130,6 +129,6 @@ typedef struct
TRINITY_LIBRARY_HANDLE hScriptsLib;
}_ScriptSet,*ScriptsSet;
extern ScriptsSet Script;
//extern ScriptsSet Script;
#endif
+937
View File
@@ -0,0 +1,937 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "ScriptedPch.h"
#ifdef WIN32
#define DO_SCRIPTS
#endif
#ifdef DO_SCRIPTS
//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();
extern void AddSC_boss_taerar();
extern void AddSC_boss_ysondre();
extern void AddSC_generic_creature();
extern void AddSC_go_scripts();
extern void AddSC_guards();
extern void AddSC_item_scripts();
extern void AddSC_npc_professions();
extern void AddSC_npc_innkeeper();
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();
extern void AddSC_boss_anubshiah();
extern void AddSC_boss_draganthaurissan();
extern void AddSC_boss_general_angerforge();
extern void AddSC_boss_gorosh_the_dervish();
extern void AddSC_boss_grizzle();
extern void AddSC_boss_high_interrogator_gerstahn();
extern void AddSC_boss_magmus();
extern void AddSC_boss_moira_bronzebeard();
extern void AddSC_boss_tomb_of_seven();
extern void AddSC_instance_blackrock_depths();
extern void AddSC_boss_drakkisath(); //Blackrock Spire
extern void AddSC_boss_halycon();
extern void AddSC_boss_highlordomokk();
extern void AddSC_boss_mothersmolderweb();
extern void AddSC_boss_overlordwyrmthalak();
extern void AddSC_boss_shadowvosh();
extern void AddSC_boss_thebeast();
extern void AddSC_boss_warmastervoone();
extern void AddSC_boss_quatermasterzigris();
extern void AddSC_boss_pyroguard_emberseer();
extern void AddSC_boss_gyth();
extern void AddSC_boss_rend_blackhand();
extern void AddSC_boss_razorgore(); //Blackwing lair
extern void AddSC_boss_vael();
extern void AddSC_boss_broodlord();
extern void AddSC_boss_firemaw();
extern void AddSC_boss_ebonroc();
extern void AddSC_boss_flamegor();
extern void AddSC_boss_chromaggus();
extern void AddSC_boss_nefarian();
extern void AddSC_boss_victor_nefarius();
extern void AddSC_boss_mr_smite();
extern void AddSC_deadmines(); //Deadmines
extern void AddSC_instance_deadmines();
extern void AddSC_gnomeregan(); //Gnomeregan
extern void AddSC_instance_gnomeregan();
extern void AddSC_boss_attumen(); //Karazhan
extern void AddSC_boss_curator();
extern void AddSC_boss_maiden_of_virtue();
extern void AddSC_boss_shade_of_aran();
extern void AddSC_boss_malchezaar();
extern void AddSC_boss_terestian_illhoof();
extern void AddSC_boss_moroes();
extern void AddSC_bosses_opera();
extern void AddSC_boss_netherspite();
extern void AddSC_instance_karazhan();
extern void AddSC_karazhan();
extern void AddSC_boss_nightbane();
extern void AddSC_boss_felblood_kaelthas(); // Magister's Terrace
extern void AddSC_boss_selin_fireheart();
extern void AddSC_boss_vexallus();
extern void AddSC_boss_priestess_delrissa();
extern void AddSC_instance_magisters_terrace();
extern void AddSC_magisters_terrace();
extern void AddSC_boss_lucifron(); //Molten core
extern void AddSC_boss_magmadar();
extern void AddSC_boss_gehennas();
extern void AddSC_boss_garr();
extern void AddSC_boss_baron_geddon();
extern void AddSC_boss_shazzrah();
extern void AddSC_boss_golemagg();
extern void AddSC_boss_sulfuron();
extern void AddSC_boss_majordomo();
extern void AddSC_boss_ragnaros();
extern void AddSC_instance_molten_core();
extern void AddSC_molten_core();
extern void AddSC_the_scarlet_enclave(); //Scarlet Enclave
extern void AddSC_the_scarlet_enclave_c1();
extern void AddSC_the_scarlet_enclave_c2();
extern void AddSC_the_scarlet_enclave_c5();
extern void AddSC_boss_arcanist_doan(); //Scarlet Monastery
extern void AddSC_boss_azshir_the_sleepless();
extern void AddSC_boss_bloodmage_thalnos();
extern void AddSC_boss_headless_horseman();
extern void AddSC_boss_herod();
extern void AddSC_boss_high_inquisitor_fairbanks();
extern void AddSC_boss_houndmaster_loksey();
extern void AddSC_boss_interrogator_vishas();
extern void AddSC_boss_scorn();
extern void AddSC_instance_scarlet_monastery();
extern void AddSC_boss_mograine_and_whitemane();
extern void AddSC_boss_darkmaster_gandling(); //Scholomance
extern void AddSC_boss_death_knight_darkreaver();
extern void AddSC_boss_theolenkrastinov();
extern void AddSC_boss_illuciabarov();
extern void AddSC_boss_instructormalicia();
extern void AddSC_boss_jandicebarov();
extern void AddSC_boss_kormok();
extern void AddSC_boss_lordalexeibarov();
extern void AddSC_boss_lorekeeperpolkelt();
extern void AddSC_boss_rasfrost();
extern void AddSC_boss_theravenian();
extern void AddSC_boss_vectus();
extern void AddSC_instance_scholomance();
extern void AddSC_shadowfang_keep(); //Shadowfang keep
extern void AddSC_instance_shadowfang_keep();
extern void AddSC_boss_magistrate_barthilas(); //Stratholme
extern void AddSC_boss_maleki_the_pallid();
extern void AddSC_boss_nerubenkan();
extern void AddSC_boss_cannon_master_willey();
extern void AddSC_boss_baroness_anastari();
extern void AddSC_boss_ramstein_the_gorger();
extern void AddSC_boss_timmy_the_cruel();
extern void AddSC_boss_postmaster_malown();
extern void AddSC_boss_baron_rivendare();
extern void AddSC_boss_dathrohan_balnazzar();
extern void AddSC_boss_order_of_silver_hand();
extern void AddSC_instance_stratholme();
extern void AddSC_stratholme();
extern void AddSC_sunken_temple(); // Sunken Temple
extern void AddSC_instance_sunken_temple();
extern void AddSC_instance_sunwell_plateau(); //Sunwell Plateau
extern void AddSC_boss_kalecgos();
extern void AddSC_boss_brutallus();
extern void AddSC_boss_felmyst();
extern void AddSC_boss_eredar_twins();
extern void AddSC_boss_muru();
extern void AddSC_boss_kiljaeden();
extern void AddSC_sunwell_plateau();
extern void AddSC_boss_archaedas(); //Uldaman
extern void AddSC_boss_ironaya();
extern void AddSC_uldaman();
extern void AddSC_instance_uldaman();
extern void AddSC_boss_akilzon(); //Zul'Aman
extern void AddSC_boss_halazzi();
extern void AddSC_boss_hex_lord_malacrass();
extern void AddSC_boss_janalai();
extern void AddSC_boss_nalorakk();
extern void AddSC_boss_zuljin();
extern void AddSC_instance_zulaman();
extern void AddSC_zulaman();
extern void AddSC_boss_jeklik(); //Zul'Gurub
extern void AddSC_boss_venoxis();
extern void AddSC_boss_marli();
extern void AddSC_boss_mandokir();
extern void AddSC_boss_gahzranka();
extern void AddSC_boss_thekal();
extern void AddSC_boss_arlokk();
extern void AddSC_boss_jindo();
extern void AddSC_boss_hakkar();
extern void AddSC_boss_grilek();
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();
extern void AddSC_boss_kruul();
extern void AddSC_burning_steppes();
extern void AddSC_dun_morogh();
extern void AddSC_duskwood();
extern void AddSC_eastern_plaguelands();
extern void AddSC_elwynn_forest();
extern void AddSC_eversong_woods();
extern void AddSC_ghostlands();
extern void AddSC_hinterlands();
extern void AddSC_ironforge();
extern void AddSC_isle_of_queldanas();
extern void AddSC_loch_modan();
extern void AddSC_redridge_mountains();
extern void AddSC_searing_gorge();
extern void AddSC_silvermoon_city();
extern void AddSC_silverpine_forest();
extern void AddSC_stormwind_city();
extern void AddSC_stranglethorn_vale();
extern void AddSC_tirisfal_glades();
extern void AddSC_undercity();
extern void AddSC_western_plaguelands();
extern void AddSC_westfall();
extern void AddSC_wetlands();
//kalimdor
extern void AddSC_blackfathom_deeps(); //Blackfathom Depths
extern void AddSC_boss_gelihast();
extern void AddSC_boss_kelris();
extern void AddSC_boss_aku_mai();
extern void AddSC_instance_blackfathom_deeps();
extern void AddSC_hyjal(); //CoT Battle for Mt. Hyjal
extern void AddSC_boss_archimonde();
extern void AddSC_instance_mount_hyjal();
extern void AddSC_hyjal_trash();
extern void AddSC_boss_rage_winterchill();
extern void AddSC_boss_anetheron();
extern void AddSC_boss_kazrogal();
extern void AddSC_boss_azgalor();
extern void AddSC_boss_captain_skarloc(); //CoT Old Hillsbrad
extern void AddSC_boss_epoch_hunter();
extern void AddSC_boss_lieutenant_drake();
extern void AddSC_instance_old_hillsbrad();
extern void AddSC_old_hillsbrad();
extern void AddSC_boss_aeonus(); //CoT The Dark Portal
extern void AddSC_boss_chrono_lord_deja();
extern void AddSC_boss_temporus();
extern void AddSC_dark_portal();
extern void AddSC_instance_dark_portal();
extern void AddSC_boss_celebras_the_cursed(); //Maraudon
extern void AddSC_boss_landslide();
extern void AddSC_boss_noxxion();
extern void AddSC_boss_ptheradras();
extern void AddSC_boss_onyxia(); //Onyxia's Lair
extern void AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs
extern void AddSC_razorfen_downs();
extern void AddSC_razorfen_kraul(); //Razorfen Kraul
extern void AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj
extern void AddSC_boss_rajaxx();
extern void AddSC_boss_moam();
extern void AddSC_boss_buru();
extern void AddSC_boss_ayamiss();
extern void AddSC_boss_ossirian();
extern void AddSC_instance_ruins_of_ahnqiraj();
extern void AddSC_boss_cthun(); //Temple of ahn'qiraj
extern void AddSC_boss_fankriss();
extern void AddSC_boss_huhuran();
extern void AddSC_bug_trio();
extern void AddSC_boss_sartura();
extern void AddSC_boss_skeram();
extern void AddSC_boss_twinemperors();
extern void AddSC_mob_anubisath_sentinel();
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();
extern void AddSC_bloodmyst_isle();
extern void AddSC_boss_azuregos();
extern void AddSC_darkshore();
extern void AddSC_desolace();
extern void AddSC_dustwallow_marsh();
extern void AddSC_felwood();
extern void AddSC_feralas();
extern void AddSC_moonglade();
extern void AddSC_mulgore();
extern void AddSC_orgrimmar();
extern void AddSC_silithus();
extern void AddSC_stonetalon_mountains();
extern void AddSC_tanaris();
extern void AddSC_teldrassil();
extern void AddSC_the_barrens();
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();
extern void AddSC_boss_drakkari_colossus();
extern void AddSC_boss_gal_darah();
extern void AddSC_boss_eck();
extern void AddSC_instance_gundrak();
extern void AddSC_boss_krik_thir(); //Azjol-Nerub
extern void AddSC_boss_hadronox();
extern void AddSC_boss_anub_arak();
extern void AddSC_instance_azjol_nerub();
extern void AddSC_instance_ahnkahet(); //Azjol-Nerub Ahn'kahet
extern void AddSC_boss_amanitar();
extern void AddSC_boss_taldaram();
extern void AddSC_boss_jedoga_shadowseeker();
extern void AddSC_boss_elder_nadox();
extern void AddSC_boss_volazj();
extern void AddSC_boss_argent_challenge(); //Trial of the Champion
extern void AddSC_boss_black_knight();
extern void AddSC_boss_grand_champions();
extern void AddSC_instance_trial_of_the_champion();
extern void AddSC_trial_of_the_champion();
extern void AddSC_boss_anubrekhan(); //Naxxramas
extern void AddSC_boss_maexxna();
extern void AddSC_boss_patchwerk();
extern void AddSC_boss_grobbulus();
extern void AddSC_boss_razuvious();
extern void AddSC_boss_kelthuzad();
extern void AddSC_boss_loatheb();
extern void AddSC_boss_noth();
extern void AddSC_boss_gluth();
extern void AddSC_boss_sapphiron();
extern void AddSC_boss_four_horsemen();
extern void AddSC_boss_faerlina();
extern void AddSC_boss_heigan();
extern void AddSC_boss_gothik();
extern void AddSC_boss_thaddius();
extern void AddSC_instance_naxxramas();
extern void AddSC_boss_magus_telestra(); //The Nexus Nexus
extern void AddSC_boss_anomalus();
extern void AddSC_boss_ormorok();
extern void AddSC_boss_keristrasza();
extern void AddSC_instance_nexus();
extern void AddSC_boss_sartharion(); //Obsidian Sanctum
extern void AddSC_instance_obsidian_sanctum();
extern void AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning
extern void AddSC_boss_loken();
extern void AddSC_boss_ionar();
extern void AddSC_boss_volkhan();
extern void AddSC_instance_halls_of_lightning();
extern void AddSC_boss_maiden_of_grief(); //Ulduar Halls of Stone
extern void AddSC_boss_krystallus();
extern void AddSC_boss_sjonnir();
extern void AddSC_instance_halls_of_stone();
extern void AddSC_halls_of_stone();
extern void AddSC_boss_auriaya(); //Ulduar Ulduar
extern void AddSC_boss_flame_leviathan();
extern void AddSC_boss_ignis();
extern void AddSC_boss_razorscale();
extern void AddSC_boss_xt002();
extern void AddSC_boss_kologarn();
extern void AddSC_boss_assembly_of_iron();
extern void AddSC_ulduar_teleporter();
extern void AddSC_instance_ulduar();
extern void AddSC_boss_keleseth(); //Utgarde Keep
extern void AddSC_boss_skarvald_dalronn();
extern void AddSC_boss_ingvar_the_plunderer();
extern void AddSC_instance_utgarde_keep();
extern void AddSC_boss_svala(); //Utgarde pinnacle
extern void AddSC_boss_palehoof();
extern void AddSC_boss_skadi();
extern void AddSC_boss_ymiron();
extern void AddSC_instance_utgarde_pinnacle();
extern void AddSC_utgarde_keep();
extern void AddSC_boss_archavon(); //Vault of Archavon
extern void AddSC_boss_emalon();
extern void AddSC_instance_archavon();
extern void AddSC_boss_trollgore(); //Drak'Tharon Keep
extern void AddSC_boss_novos();
extern void AddSC_boss_dred();
extern void AddSC_boss_tharon_ja();
extern void AddSC_instance_drak_tharon();
extern void AddSC_boss_cyanigosa(); //Violet Hold
extern void AddSC_boss_erekem();
extern void AddSC_boss_ichoron();
extern void AddSC_boss_lavanthor();
extern void AddSC_boss_moragg();
extern void AddSC_boss_xevozz();
extern void AddSC_boss_zuramat();
extern void AddSC_instance_violet_hold();
extern void AddSC_violet_hold();
extern void AddSC_dalaran();
extern void AddSC_borean_tundra();
extern void AddSC_dragonblight();
extern void AddSC_grizzly_hills();
extern void AddSC_howling_fjord();
extern void AddSC_icecrown();
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();
extern void AddSC_boss_nexusprince_shaffar(); //Auchindoun Mana Tombs
extern void AddSC_boss_pandemonius();
extern void AddSC_boss_darkweaver_syth(); //Auchindoun Sekketh Halls
extern void AddSC_boss_talon_king_ikiss();
extern void AddSC_instance_sethekk_halls();
extern void AddSC_instance_shadow_labyrinth(); //Auchindoun Shadow Labyrinth
extern void AddSC_boss_ambassador_hellmaw();
extern void AddSC_boss_blackheart_the_inciter();
extern void AddSC_boss_grandmaster_vorpil();
extern void AddSC_boss_murmur();
extern void AddSC_black_temple(); //Black Temple
extern void AddSC_boss_illidan();
extern void AddSC_boss_shade_of_akama();
extern void AddSC_boss_supremus();
extern void AddSC_boss_gurtogg_bloodboil();
extern void AddSC_boss_mother_shahraz();
extern void AddSC_boss_reliquary_of_souls();
extern void AddSC_boss_teron_gorefiend();
extern void AddSC_boss_najentus();
extern void AddSC_boss_illidari_council();
extern void AddSC_instance_black_temple();
extern void AddSC_boss_fathomlord_karathress(); //CR Serpent Shrine Cavern
extern void AddSC_boss_hydross_the_unstable();
extern void AddSC_boss_lady_vashj();
extern void AddSC_boss_leotheras_the_blind();
extern void AddSC_boss_morogrim_tidewalker();
extern void AddSC_instance_serpentshrine_cavern();
extern void AddSC_boss_the_lurker_below();
extern void AddSC_boss_hydromancer_thespia(); //CR Steam Vault
extern void AddSC_boss_mekgineer_steamrigger();
extern void AddSC_boss_warlord_kalithresh();
extern void AddSC_instance_steam_vault();
extern void AddSC_boss_hungarfen(); //CR Underbog
extern void AddSC_boss_the_black_stalker();
extern void AddSC_boss_gruul(); //Gruul's Lair
extern void AddSC_boss_high_king_maulgar();
extern void AddSC_instance_gruuls_lair();
extern void AddSC_boss_broggok(); //HC Blood Furnace
extern void AddSC_boss_kelidan_the_breaker();
extern void AddSC_boss_the_maker();
extern void AddSC_instance_blood_furnace();
extern void AddSC_boss_magtheridon(); //HC Magtheridon's Lair
extern void AddSC_instance_magtheridons_lair();
extern void AddSC_boss_grand_warlock_nethekurse(); //HC Shattered Halls
extern void AddSC_boss_warbringer_omrogg();
extern void AddSC_boss_warchief_kargath_bladefist();
extern void AddSC_instance_shattered_halls();
extern void AddSC_boss_watchkeeper_gargolmar(); //HC Ramparts
extern void AddSC_boss_omor_the_unscarred();
extern void AddSC_boss_vazruden_the_herald();
extern void AddSC_instance_ramparts();
extern void AddSC_arcatraz(); //TK Arcatraz
extern void AddSC_boss_harbinger_skyriss();
extern void AddSC_instance_arcatraz();
extern void AddSC_boss_high_botanist_freywinn(); //TK Botanica
extern void AddSC_boss_laj();
extern void AddSC_boss_warp_splinter();
extern void AddSC_boss_alar(); //TK The Eye
extern void AddSC_boss_kaelthas();
extern void AddSC_boss_void_reaver();
extern void AddSC_boss_high_astromancer_solarian();
extern void AddSC_instance_the_eye();
extern void AddSC_the_eye();
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();
extern void AddSC_hellfire_peninsula();
extern void AddSC_nagrand();
extern void AddSC_netherstorm();
extern void AddSC_shadowmoon_valley();
extern void AddSC_shattrath_city();
extern void AddSC_terokkar_forest();
extern void AddSC_zangarmarsh();
extern void AddSC_onevents();
#endif
void AddScripts()
{
#ifdef DO_SCRIPTS
//custom
//examples
AddSC_example_creature();
AddSC_example_escort();
AddSC_example_gossip_codebox();
AddSC_example_misc();
//world
AddSC_areatrigger_scripts();
AddSC_boss_emeriss();
AddSC_boss_taerar();
AddSC_boss_ysondre();
AddSC_generic_creature();
AddSC_go_scripts();
AddSC_guards();
AddSC_item_scripts();
AddSC_npc_professions();
AddSC_npc_innkeeper();
AddSC_npcs_special();
AddSC_npc_taxi();
//eastern kingdoms
AddSC_blackrock_depths(); //Blackrock Depths
AddSC_boss_ambassador_flamelash();
AddSC_boss_anubshiah();
AddSC_boss_draganthaurissan();
AddSC_boss_general_angerforge();
AddSC_boss_gorosh_the_dervish();
AddSC_boss_grizzle();
AddSC_boss_high_interrogator_gerstahn();
AddSC_boss_magmus();
AddSC_boss_moira_bronzebeard();
AddSC_boss_tomb_of_seven();
AddSC_instance_blackrock_depths();
AddSC_boss_drakkisath(); //Blackrock Spire
AddSC_boss_halycon();
AddSC_boss_highlordomokk();
AddSC_boss_mothersmolderweb();
AddSC_boss_overlordwyrmthalak();
AddSC_boss_shadowvosh();
AddSC_boss_thebeast();
AddSC_boss_warmastervoone();
AddSC_boss_quatermasterzigris();
AddSC_boss_pyroguard_emberseer();
AddSC_boss_gyth();
AddSC_boss_rend_blackhand();
AddSC_boss_razorgore(); //Blackwing lair
AddSC_boss_vael();
AddSC_boss_broodlord();
AddSC_boss_firemaw();
AddSC_boss_ebonroc();
AddSC_boss_flamegor();
AddSC_boss_chromaggus();
AddSC_boss_nefarian();
AddSC_boss_victor_nefarius();
AddSC_boss_mr_smite();
AddSC_deadmines(); //Deadmines
AddSC_instance_deadmines();
AddSC_gnomeregan(); //Gnomeregan
AddSC_instance_gnomeregan();
AddSC_boss_attumen(); //Karazhan
AddSC_boss_curator();
AddSC_boss_maiden_of_virtue();
AddSC_boss_shade_of_aran();
AddSC_boss_malchezaar();
AddSC_boss_terestian_illhoof();
AddSC_boss_moroes();
AddSC_bosses_opera();
AddSC_boss_netherspite();
AddSC_instance_karazhan();
AddSC_karazhan();
AddSC_boss_nightbane();
AddSC_boss_felblood_kaelthas(); // Magister's Terrace
AddSC_boss_selin_fireheart();
AddSC_boss_vexallus();
AddSC_boss_priestess_delrissa();
AddSC_instance_magisters_terrace();
AddSC_magisters_terrace();
AddSC_boss_lucifron(); //Molten core
AddSC_boss_magmadar();
AddSC_boss_gehennas();
AddSC_boss_garr();
AddSC_boss_baron_geddon();
AddSC_boss_shazzrah();
AddSC_boss_golemagg();
AddSC_boss_sulfuron();
AddSC_boss_majordomo();
AddSC_boss_ragnaros();
AddSC_instance_molten_core();
AddSC_molten_core();
AddSC_the_scarlet_enclave(); //Scarlet Enclave
AddSC_the_scarlet_enclave_c1();
AddSC_the_scarlet_enclave_c2();
AddSC_the_scarlet_enclave_c5();
AddSC_boss_arcanist_doan(); //Scarlet Monastery
AddSC_boss_azshir_the_sleepless();
AddSC_boss_bloodmage_thalnos();
AddSC_boss_headless_horseman();
AddSC_boss_herod();
AddSC_boss_high_inquisitor_fairbanks();
AddSC_boss_houndmaster_loksey();
AddSC_boss_interrogator_vishas();
AddSC_boss_scorn();
AddSC_instance_scarlet_monastery();
AddSC_boss_mograine_and_whitemane();
AddSC_boss_darkmaster_gandling(); //Scholomance
AddSC_boss_death_knight_darkreaver();
AddSC_boss_theolenkrastinov();
AddSC_boss_illuciabarov();
AddSC_boss_instructormalicia();
AddSC_boss_jandicebarov();
AddSC_boss_kormok();
AddSC_boss_lordalexeibarov();
AddSC_boss_lorekeeperpolkelt();
AddSC_boss_rasfrost();
AddSC_boss_theravenian();
AddSC_boss_vectus();
AddSC_instance_scholomance();
AddSC_shadowfang_keep(); //Shadowfang keep
AddSC_instance_shadowfang_keep();
AddSC_boss_magistrate_barthilas(); //Stratholme
AddSC_boss_maleki_the_pallid();
AddSC_boss_nerubenkan();
AddSC_boss_cannon_master_willey();
AddSC_boss_baroness_anastari();
AddSC_boss_ramstein_the_gorger();
AddSC_boss_timmy_the_cruel();
AddSC_boss_postmaster_malown();
AddSC_boss_baron_rivendare();
AddSC_boss_dathrohan_balnazzar();
AddSC_boss_order_of_silver_hand();
AddSC_instance_stratholme();
AddSC_stratholme();
AddSC_sunken_temple(); // Sunken Temple
AddSC_instance_sunken_temple();
AddSC_instance_sunwell_plateau(); //Sunwell Plateau
AddSC_boss_kalecgos();
AddSC_boss_brutallus();
AddSC_boss_felmyst();
AddSC_boss_eredar_twins();
AddSC_boss_muru();
AddSC_boss_kiljaeden();
AddSC_sunwell_plateau();
AddSC_boss_archaedas(); //Uldaman
AddSC_boss_ironaya();
AddSC_uldaman();
AddSC_instance_uldaman();
AddSC_boss_akilzon(); //Zul'Aman
AddSC_boss_halazzi();
AddSC_boss_hex_lord_malacrass();
AddSC_boss_janalai();
AddSC_boss_nalorakk();
AddSC_boss_zuljin();
AddSC_instance_zulaman();
AddSC_zulaman();
AddSC_boss_jeklik(); //Zul'Gurub
AddSC_boss_venoxis();
AddSC_boss_marli();
AddSC_boss_mandokir();
AddSC_boss_gahzranka();
AddSC_boss_thekal();
AddSC_boss_arlokk();
AddSC_boss_jindo();
AddSC_boss_hakkar();
AddSC_boss_grilek();
AddSC_boss_hazzarah();
AddSC_boss_renataki();
AddSC_boss_wushoolay();
AddSC_instance_zulgurub();
//AddSC_alterac_mountains();
AddSC_arathi_highlands();
AddSC_blasted_lands();
AddSC_boss_kruul();
AddSC_burning_steppes();
AddSC_dun_morogh();
AddSC_duskwood();
AddSC_eastern_plaguelands();
AddSC_elwynn_forest();
AddSC_eversong_woods();
AddSC_ghostlands();
AddSC_hinterlands();
AddSC_ironforge();
AddSC_isle_of_queldanas();
AddSC_loch_modan();
AddSC_redridge_mountains();
AddSC_searing_gorge();
AddSC_silvermoon_city();
AddSC_silverpine_forest();
AddSC_stormwind_city();
AddSC_stranglethorn_vale();
AddSC_tirisfal_glades();
AddSC_undercity();
AddSC_western_plaguelands();
AddSC_westfall();
AddSC_wetlands();
//kalimdor
AddSC_blackfathom_deeps(); //Blackfathom Depths
AddSC_boss_gelihast();
AddSC_boss_kelris();
AddSC_boss_aku_mai();
AddSC_instance_blackfathom_deeps();
AddSC_hyjal(); //CoT Battle for Mt. Hyjal
AddSC_boss_archimonde();
AddSC_instance_mount_hyjal();
AddSC_hyjal_trash();
AddSC_boss_rage_winterchill();
AddSC_boss_anetheron();
AddSC_boss_kazrogal();
AddSC_boss_azgalor();
AddSC_boss_captain_skarloc(); //CoT Old Hillsbrad
AddSC_boss_epoch_hunter();
AddSC_boss_lieutenant_drake();
AddSC_instance_old_hillsbrad();
AddSC_old_hillsbrad();
AddSC_boss_aeonus(); //CoT The Dark Portal
AddSC_boss_chrono_lord_deja();
AddSC_boss_temporus();
AddSC_dark_portal();
AddSC_instance_dark_portal();
AddSC_boss_celebras_the_cursed(); //Maraudon
AddSC_boss_landslide();
AddSC_boss_noxxion();
AddSC_boss_ptheradras();
AddSC_boss_onyxia(); //Onyxia's Lair
AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs
AddSC_razorfen_downs();
AddSC_razorfen_kraul(); //Razorfen Kraul
AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj
AddSC_boss_rajaxx();
AddSC_boss_moam();
AddSC_boss_buru();
AddSC_boss_ayamiss();
AddSC_boss_ossirian();
AddSC_instance_ruins_of_ahnqiraj();
AddSC_boss_cthun(); //Temple of ahn'qiraj
AddSC_boss_fankriss();
AddSC_boss_huhuran();
AddSC_bug_trio();
AddSC_boss_sartura();
AddSC_boss_skeram();
AddSC_boss_twinemperors();
AddSC_mob_anubisath_sentinel();
AddSC_instance_temple_of_ahnqiraj();
AddSC_wailing_caverns(); //Wailing caverns
AddSC_instance_wailing_caverns();
AddSC_zulfarrak(); //Zul'Farrak
AddSC_ashenvale();
AddSC_azshara();
AddSC_azuremyst_isle();
AddSC_bloodmyst_isle();
AddSC_boss_azuregos();
AddSC_darkshore();
AddSC_desolace();
AddSC_dustwallow_marsh();
AddSC_felwood();
AddSC_feralas();
AddSC_moonglade();
AddSC_mulgore();
AddSC_orgrimmar();
AddSC_silithus();
AddSC_stonetalon_mountains();
AddSC_tanaris();
AddSC_teldrassil();
AddSC_the_barrens();
AddSC_thousand_needles();
AddSC_thunder_bluff();
AddSC_ungoro_crater();
AddSC_winterspring();
//northrend
AddSC_boss_slad_ran(); //Gundrak
AddSC_boss_moorabi();
AddSC_boss_drakkari_colossus();
AddSC_boss_gal_darah();
AddSC_boss_eck();
AddSC_instance_gundrak();
AddSC_boss_amanitar();
AddSC_boss_taldaram(); //Azjol-Nerub Ahn'kahet
AddSC_boss_elder_nadox();
AddSC_boss_jedoga_shadowseeker();
AddSC_boss_volazj();
AddSC_instance_ahnkahet();
AddSC_boss_argent_challenge(); //Trial of the Champion
AddSC_boss_black_knight();
AddSC_boss_grand_champions();
AddSC_instance_trial_of_the_champion();
AddSC_trial_of_the_champion();
AddSC_boss_krik_thir(); //Azjol-Nerub Azjol-Nerub
AddSC_boss_hadronox();
AddSC_boss_anub_arak();
AddSC_instance_azjol_nerub();
AddSC_boss_anubrekhan(); //Naxxramas
AddSC_boss_maexxna();
AddSC_boss_patchwerk();
AddSC_boss_grobbulus();
AddSC_boss_razuvious();
AddSC_boss_kelthuzad();
AddSC_boss_loatheb();
AddSC_boss_noth();
AddSC_boss_gluth();
AddSC_boss_sapphiron();
AddSC_boss_four_horsemen();
AddSC_boss_faerlina();
AddSC_boss_heigan();
AddSC_boss_gothik();
AddSC_boss_thaddius();
AddSC_instance_naxxramas();
AddSC_boss_magus_telestra(); //The Nexus Nexus
AddSC_boss_anomalus();
AddSC_boss_ormorok();
AddSC_boss_keristrasza();
AddSC_instance_nexus();
AddSC_boss_sartharion(); //Obsidian Sanctum
AddSC_instance_obsidian_sanctum();
AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning
AddSC_boss_loken();
AddSC_boss_ionar();
AddSC_boss_volkhan();
AddSC_instance_halls_of_lightning();
AddSC_boss_maiden_of_grief(); //Ulduar Halls of Stone
AddSC_boss_krystallus();
AddSC_boss_sjonnir();
AddSC_instance_halls_of_stone();
AddSC_halls_of_stone();
AddSC_boss_auriaya(); //Ulduar Ulduar
AddSC_boss_flame_leviathan();
AddSC_boss_ignis();
AddSC_boss_razorscale();
AddSC_boss_xt002();
AddSC_boss_assembly_of_iron();
AddSC_boss_kologarn();
AddSC_ulduar_teleporter();
AddSC_instance_ulduar();
AddSC_boss_keleseth(); //Utgarde Keep
AddSC_boss_skarvald_dalronn();
AddSC_boss_ingvar_the_plunderer();
AddSC_instance_utgarde_keep();
AddSC_boss_svala(); //Utgarde pinnacle
AddSC_boss_palehoof();
AddSC_boss_skadi();
AddSC_boss_ymiron();
AddSC_instance_utgarde_pinnacle();
AddSC_utgarde_keep();
AddSC_boss_archavon(); //Vault of Archavon
AddSC_boss_emalon();
AddSC_instance_archavon();
AddSC_boss_trollgore(); //Drak'Tharon Keep
AddSC_boss_novos();
AddSC_boss_dred();
AddSC_boss_tharon_ja();
AddSC_instance_drak_tharon();
AddSC_boss_cyanigosa(); //Violet Hold
AddSC_boss_erekem();
AddSC_boss_ichoron();
AddSC_boss_lavanthor();
AddSC_boss_moragg();
AddSC_boss_xevozz();
AddSC_boss_zuramat();
AddSC_instance_violet_hold();
AddSC_violet_hold();
AddSC_dalaran();
AddSC_borean_tundra();
AddSC_dragonblight();
AddSC_grizzly_hills();
AddSC_howling_fjord();
AddSC_icecrown();
AddSC_sholazar_basin();
AddSC_storm_peaks();
AddSC_wintergrasp();
AddSC_zuldrak();
//outland
AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts
AddSC_boss_shirrak_the_dead_watcher();
AddSC_boss_nexusprince_shaffar(); //Auchindoun Mana Tombs
AddSC_boss_pandemonius();
AddSC_boss_darkweaver_syth(); //Auchindoun Sekketh Halls
AddSC_boss_talon_king_ikiss();
AddSC_instance_sethekk_halls();
AddSC_instance_shadow_labyrinth(); //Auchindoun Shadow Labyrinth
AddSC_boss_ambassador_hellmaw();
AddSC_boss_blackheart_the_inciter();
AddSC_boss_grandmaster_vorpil();
AddSC_boss_murmur();
AddSC_black_temple(); //Black Temple
AddSC_boss_illidan();
AddSC_boss_shade_of_akama();
AddSC_boss_supremus();
AddSC_boss_gurtogg_bloodboil();
AddSC_boss_mother_shahraz();
AddSC_boss_reliquary_of_souls();
AddSC_boss_teron_gorefiend();
AddSC_boss_najentus();
AddSC_boss_illidari_council();
AddSC_instance_black_temple();
AddSC_boss_fathomlord_karathress(); //CR Serpent Shrine Cavern
AddSC_boss_hydross_the_unstable();
AddSC_boss_lady_vashj();
AddSC_boss_leotheras_the_blind();
AddSC_boss_morogrim_tidewalker();
AddSC_instance_serpentshrine_cavern();
AddSC_boss_the_lurker_below();
AddSC_boss_hydromancer_thespia(); //CR Steam Vault
AddSC_boss_mekgineer_steamrigger();
AddSC_boss_warlord_kalithresh();
AddSC_instance_steam_vault();
AddSC_boss_hungarfen(); //CR Underbog
AddSC_boss_the_black_stalker();
AddSC_boss_gruul(); //Gruul's Lair
AddSC_boss_high_king_maulgar();
AddSC_instance_gruuls_lair();
AddSC_boss_broggok(); //HC Blood Furnace
AddSC_boss_kelidan_the_breaker();
AddSC_boss_the_maker();
AddSC_instance_blood_furnace();
AddSC_boss_magtheridon(); //HC Magtheridon's Lair
AddSC_instance_magtheridons_lair();
AddSC_boss_grand_warlock_nethekurse(); //HC Shattered Halls
AddSC_boss_warbringer_omrogg();
AddSC_boss_warchief_kargath_bladefist();
AddSC_instance_shattered_halls();
AddSC_boss_watchkeeper_gargolmar(); //HC Ramparts
AddSC_boss_omor_the_unscarred();
AddSC_boss_vazruden_the_herald();
AddSC_instance_ramparts();
AddSC_arcatraz(); //TK Arcatraz
AddSC_boss_harbinger_skyriss();
AddSC_instance_arcatraz();
AddSC_boss_high_botanist_freywinn(); //TK Botanica
AddSC_boss_laj();
AddSC_boss_warp_splinter();
AddSC_boss_alar(); //TK The Eye
AddSC_boss_kaelthas();
AddSC_boss_void_reaver();
AddSC_boss_high_astromancer_solarian();
AddSC_instance_the_eye();
AddSC_the_eye();
AddSC_boss_gatewatcher_iron_hand(); //TK The Mechanar
AddSC_boss_nethermancer_sepethrea();
AddSC_boss_pathaleon_the_calculator();
AddSC_instance_mechanar();
AddSC_blades_edge_mountains();
AddSC_boss_doomlordkazzak();
AddSC_boss_doomwalker();
AddSC_hellfire_peninsula();
AddSC_nagrand();
AddSC_netherstorm();
AddSC_shadowmoon_valley();
AddSC_shattrath_city();
AddSC_terokkar_forest();
AddSC_zangarmarsh();
AddSC_onevents();
#endif
}
+10
View File
@@ -0,0 +1,10 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_SCRIPTLOADER_H
#define SC_SCRIPTLOADER_H
void AddScripts();
#endif
+618
View File
@@ -0,0 +1,618 @@
/* Copyright (C) 2006 - 2008 TrinityScript <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "ScriptedPch.h"
#include "Config/Config.h"
#include "Database/DatabaseEnv.h"
#include "DBCStores.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
#include "ScriptLoader.h"
#include "ScriptSystem.h"
#include "Policies/SingletonImp.h"
#define _FULLVERSION "TrinityScript"
INSTANTIATE_SINGLETON_1(ScriptMgr);
//#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 ScriptMgr::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();
pSystemMgr.LoadScriptWaypoints();
}
else
{
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;
ScriptMgr::ScriptMgr()
{
}
ScriptMgr::~ScriptMgr()
{
}
void ScriptMgr::ScriptsInit(char const* cfg_file)
{
//Trinity Script startup
outstring_log(" _____ _ _ _ ____ _ _");
outstring_log("|_ _| __(_)_ __ (_) |_ _ _/ ___| ___ _ __(_)_ __ | |_ ");
outstring_log(" | || '__| | '_ \\| | __| | | \\___ \\ / __| \'__| | \'_ \\| __|");
outstring_log(" | || | | | | | | | |_| |_| |___) | (__| | | | |_) | |_ ");
outstring_log(" |_||_| |_|_| |_|_|\\__|\\__, |____/ \\___|_| |_| .__/ \\__|");
outstring_log(" |___/ |_| ");
outstring_log("Trinity Script initializing %s", _FULLVERSION);
outstring_log("");
//Get configuration file
if (!TScriptConfig.SetSource(cfg_file))
error_log("TSCR: Unable to open configuration file. Database will be unaccessible. Configuration values will use default.");
else
outstring_log("TSCR: Using configuration file %s",cfg_file);
outstring_log("");
//Load database (must be called after SD2Config.SetSource).
LoadDatabase();
outstring_log("TSCR: Loading C++ scripts");
barGoLink bar(1);
bar.step();
outstring_log("");
for (uint16 i =0; i<MAX_SCRIPTS; ++i)
m_scripts[i]=NULL;
FillSpellSummary();
AddScripts();
outstring_log(">> Loaded %i C++ Scripts.", num_sc_scripts);
outstring_log(">> Load Overriden SQL Data.");
LoadOverridenSQLData();
outstring_log(">> Load Overriden DBC Data.");
LoadOverridenDBCData();
}
//*********************************
//*** Functions used globally ***
std::string ScriptMgr:: GetConfigValueStr(char const* option)
{
//Get db string from file
std::string dbstring = TScriptConfig.GetStringDefault(option, "");
if (dbstring.empty())
{
error_log("TSCR: %s is not a valid option.", option);
return "error";
}
return dbstring;
}
int32 ScriptMgr::GetConfigValueInt32(char const* option)
{
//Get db int from file
int32 dbint = TScriptConfig.GetIntDefault(option, 0);
return dbint;
}
float ScriptMgr::GetConfigValueFloat(char const* option)
{
//Get db int from file
float dbfloat = TScriptConfig.GetFloatDefault(option, 0);
return dbfloat;
}
void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
{
if (!pSource)
{
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))
{
pSource->SendPlaySound(pData->uiSoundId, false);
}
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)
((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
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:
pSource->MonsterSay(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
break;
case CHAT_TYPE_YELL:
pSource->MonsterYell(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
break;
case CHAT_TYPE_TEXT_EMOTE:
pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0);
break;
case CHAT_TYPE_BOSS_EMOTE:
pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0, true);
break;
case CHAT_TYPE_WHISPER:
{
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID());
else
error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
}
break;
case CHAT_TYPE_BOSS_WHISPER:
{
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID(), true);
else
error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
}
break;
case CHAT_TYPE_ZONE_YELL:
pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
break;
}
}
//*********************************
//*** Functions used internally ***
void Script::RegisterSelf()
{
int id = GetScriptId(Name.c_str());
if(id)
{
m_scripts[id] = this;
++num_sc_scripts;
}
else if(Name.find("example") == std::string::npos)
{
error_db_log("CRASH ALERT! TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str());
delete this;
}
}
//********************************
//*** Functions to be Exported ***
//TRINITY_DLL_EXPORT
void ScriptMgr::OnLogin(Player *pPlayer)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnLogin) return;
tmpscript->pOnLogin(pPlayer);
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnLogout(Player *pPlayer)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnLogout) return;
tmpscript->pOnLogout(pPlayer);
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnPVPKill(Player *killer, Player *killed)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnPVPKill) return;
tmpscript->pOnPVPKill(killer, killed);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::OnSpellCast (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnSpellCast) return true;
return tmpscript->pOnSpellCast(pUnitTarget,pItemTarget,pGoTarget,i,spell);
}
//TRINITY_DLL_EXPORT
uint32 ScriptMgr::OnGetXP(Player *pPlayer, uint32 amount)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnGetXP) return amount;
return tmpscript->pOnGetXP(pPlayer,amount);
}
//TRINITY_DLL_EXPORT
uint32 ScriptMgr::OnGetMoney(Player *pPlayer, int32 amount)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnGetMoney) return amount;
return tmpscript->pOnGetMoney(pPlayer,amount);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::OnPlayerChat(Player *pPlayer, const char *text)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnPlayerChat) return true;
return tmpscript->pOnPlayerChat(pPlayer,text);
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnServerStartup()
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnServerStartup) return;
tmpscript->pOnServerStartup();
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnServerShutdown()
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnServerShutdown) return;
tmpscript->pOnServerShutdown();
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnAreaChange) return;
tmpscript->pOnAreaChange(pPlayer, pArea);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::OnItemClick (Player *pPlayer, Item *pItem)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnItemClick) return true;
return tmpscript->pOnItemClick(pPlayer,pItem);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::OnItemOpen (Player *pPlayer, Item *pItem)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnItemOpen) return true;
return tmpscript->pOnItemOpen(pPlayer,pItem);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::OnGoClick (Player *pPlayer, GameObject *pGameObject)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnGoClick) return true;
return tmpscript->pOnGoClick(pPlayer,pGameObject);
}
//TRINITY_DLL_EXPORT
void ScriptMgr::OnCreatureKill (Player *pPlayer, Creature *pCreature)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnCreatureKill) return;
tmpscript->pOnCreatureKill(pPlayer,pCreature);
}
//TRINITY_DLL_EXPORT
char const* ScriptMgr::ScriptsVersion()
{
return "Integrated Trinity Scripts";
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::AreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry)
{
Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)];
if (!tmpscript || !tmpscript->pAreaTrigger) return false;
return tmpscript->pAreaTrigger(pPlayer, atEntry);
}
//TRINITY_DLL_EXPORT
CreatureAI* ScriptMgr::GetAI(Creature* pCreature)
{
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
if (!tmpscript || !tmpscript->GetAI) return NULL;
return tmpscript->GetAI(pCreature);
}
//TRINITY_DLL_EXPORT
bool ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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 ScriptMgr::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* ScriptMgr::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);
}
+176
View File
@@ -0,0 +1,176 @@
/* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_SCRIPTMGR_H
#define SC_SCRIPTMGR_H
#include "Common.h"
#include "Platform/CompilerDefs.h"
#include "DBCStructure.h"
#ifndef _TRINITY_SCRIPT_CONFIG
# define _TRINITY_SCRIPT_CONFIG "trinitycore.conf"
#endif _TRINITY_SCRIPT_CONFIG
class Player;
class Creature;
class CreatureAI;
class InstanceData;
class Quest;
class Item;
class GameObject;
class SpellCastTargets;
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 "<Trinity Script Text Entry Missing!>"
struct Script
{
Script() :
pOnLogin(NULL), pOnLogout(NULL), pOnPVPKill(NULL), pOnSpellCast(NULL), pOnGetXP(NULL),
pOnGetMoney(NULL), pOnPlayerChat(NULL), pOnServerStartup(NULL), pOnServerShutdown(NULL),
pOnAreaChange(NULL), pOnItemClick(NULL), pOnItemOpen(NULL), pOnGoClick(NULL), pOnCreatureKill(NULL),
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
pGOSelect(NULL), pGOSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL), pItemExpire(NULL),
pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
GetAI(NULL), GetInstanceData(NULL)
{}
std::string Name;
//Methods to be scripted
void (*pOnLogin )(Player*);
void (*pOnLogout )(Player*);
void (*pOnPVPKill )(Player*, Player*);
bool (*pOnSpellCast )(Unit*, Item*, GameObject*, uint32, SpellEntry const*);
uint32 (*pOnGetXP )(Player*, uint32);
int32 (*pOnGetMoney )(Player*, int32);
bool (*pOnPlayerChat )(Player*, const char*);
void (*pOnServerStartup )();
void (*pOnServerShutdown )();
void (*pOnAreaChange )(Player*, AreaTableEntry const*);
bool (*pOnItemClick )(Player*, Item*);
bool (*pOnItemOpen )(Player*, Item*);
bool (*pOnGoClick )(Player*, GameObject*);
void (*pOnCreatureKill )(Player*, Creature*);
bool (*pGossipHello )(Player*, Creature*);
bool (*pQuestAccept )(Player*, Creature*, Quest const* );
bool (*pGossipSelect )(Player*, Creature*, uint32 , uint32 );
bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* );
bool (*pGOSelect )(Player*, GameObject*, uint32 , uint32 );
bool (*pGOSelectWithCode )(Player*, GameObject*, uint32 , uint32 , const char* );
bool (*pQuestSelect )(Player*, Creature*, Quest const* );
bool (*pQuestComplete )(Player*, Creature*, Quest const* );
uint32 (*pNPCDialogStatus )(Player*, Creature* );
uint32 (*pGODialogStatus )(Player*, GameObject * _GO );
bool (*pChooseReward )(Player*, Creature*, Quest const*, uint32 );
bool (*pItemHello )(Player*, Item*, Quest const* );
bool (*pGOHello )(Player*, GameObject* );
bool (*pAreaTrigger )(Player*, AreaTriggerEntry const* );
bool (*pItemQuestAccept )(Player*, Item *, Quest const* );
bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* );
bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 );
bool (*pItemUse )(Player*, Item*, SpellCastTargets const& );
bool (*pItemExpire )(Player*, ItemPrototype const *);
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();
};
class ScriptMgr
{
public:
ScriptMgr();
~ScriptMgr();
void ScriptsInit(char const* cfg_file = _TRINITY_SCRIPT_CONFIG);
void LoadDatabase();
char const* ScriptsVersion();
std::string GetConfigValueStr(char const* option);
int32 GetConfigValueInt32(char const* option);
float GetConfigValueFloat(char const* option);
//event handlers
void OnLogin(Player *pPlayer);
void OnLogout(Player *pPlayer);
void OnPVPKill(Player *killer, Player *killed);
bool OnSpellCast (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell);
uint32 OnGetXP(Player *pPlayer, uint32 amount);
uint32 OnGetMoney(Player *pPlayer, int32 amount);
bool OnPlayerChat(Player *pPlayer, const char *text);
void OnServerStartup();
void OnServerShutdown();
void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea);
bool OnItemClick (Player *pPlayer, Item *pItem);
bool OnItemOpen (Player *pPlayer, Item *pItem);
bool OnGoClick (Player *pPlayer, GameObject *pGameObject);
void OnCreatureKill (Player *pPlayer, Creature *pCreature);
bool GossipHello (Player * pPlayer, Creature* pCreature);
bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction);
bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode);
bool GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction);
bool GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction, const char* sCode);
bool QuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
bool QuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
bool QuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
bool ChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt);
uint32 NPCDialogStatus(Player* pPlayer, Creature* pCreature);
uint32 GODialogStatus(Player* pPlayer, GameObject* pGO);
bool ItemHello(Player* pPlayer, Item* pItem, Quest const* pQuest);
bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest);
bool GOHello(Player* pPlayer, GameObject* pGO);
bool GOQuestAccept(Player* pPlayer, GameObject* pGO, Quest const* pQuest);
bool GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQuest, uint32 opt);
bool AreaTrigger(Player* pPlayer,AreaTriggerEntry const* atEntry);
CreatureAI* GetAI(Creature* pCreature);
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets);
bool ItemExpire(Player* pPlayer, ItemPrototype const * pItemProto);
bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget);
InstanceData* CreateInstanceData(Map *map);
};
//Config file accessors
//std::string GetConfigValueStr(char const* option);
//int32 GetConfigValueInt32(char const* option);
//float GetConfigValueFloat(char const* option);
//Generic scripting text function
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit *pTarget = 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__ )
#define TRINITY_DLL_EXPORT extern "C"
#else
#define TRINITY_DLL_EXPORT extern "C" export
#endif
*/
#define sScriptMgr Trinity::Singleton<ScriptMgr>::Instance()
#endif
+258
View File
@@ -0,0 +1,258 @@
/*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "ScriptSystem.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("");
delete pResult;
}
else
{
error_log("TSCR: Missing `version`.`script_version` information.");
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());
delete pResult;
outstring_log("");
outstring_log(">> Loaded %u additional Script Texts data.", uiCount);
}
else
{
barGoLink bar(1);
bar.step();
outstring_log("");
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());
delete pResult;
outstring_log("");
outstring_log(">> Loaded %u additional Custom Texts data.", uiCount);
}
else
{
barGoLink bar(1);
bar.step();
outstring_log("");
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)
{
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();
pTemp.fX = pFields[2].GetFloat();
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);
}
else
{
barGoLink bar(1);
bar.step();
outstring_log("");
outstring_log(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
}
}
+102
View File
@@ -0,0 +1,102 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_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)
//ACTIVE or PASSIVE = Hostility to environment surroundings.
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;
uint32 uiPointId;
float fX;
float fY;
float fZ;
uint32 uiWaitTime;
};
struct StringTextData
{
uint32 uiSoundId;
uint8 uiType;
uint32 uiLanguage;
uint32 uiEmote;
};
#define pSystemMgr SystemMgr::Instance()
class SystemMgr
{
public:
SystemMgr();
~SystemMgr() {}
static SystemMgr& Instance();
//Maps and lists
typedef UNORDERED_MAP<int32, StringTextData> TextDataMap;
typedef UNORDERED_MAP<uint32, std::vector<ScriptPointMove> > 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<ScriptPointMove> const &GetPointMoveList(uint32 uiCreatureEntry) const
{
static std::vector<ScriptPointMove> 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
+772
View File
@@ -0,0 +1,772 @@
/* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "ScriptedPch.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();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
++i;
if(summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
summon->AI()->DoZoneInCombat();
}
}
void SummonList::DoAction(uint32 entry, uint32 info)
{
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
++i;
if(summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
summon->AI()->DoAction(info);
}
}
void SummonList::DespawnEntry(uint32 entry)
{
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
if(!summon)
erase(i++);
else if(summon->GetEntry() == entry)
{
erase(i++);
summon->setDeathState(JUST_DIED);
summon->RemoveCorpse();
}
else
++i;
}
}
void SummonList::DespawnAll()
{
while(!empty())
{
Creature *summon = Unit::GetCreature(*m_creature, *begin());
if(!summon)
erase(begin());
else
{
erase(begin());
if(summon->isSummon())
{
summon->DestroyForNearbyPlayers();
CAST_SUM(summon)->UnSummon();
}
else
summon->DisappearAndDie();
}
}
}
ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
m_creature(pCreature),
IsFleeing(false),
m_bCombatMovement(true),
m_uiEvadeCheckCooldown(2500)
{
m_heroicMode = m_creature->GetMap()->IsHeroic();
m_difficulty = Difficulty(m_creature->GetMap()->GetSpawnMode());
}
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
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
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 pTarget, uint32 uiPosition)
{
//ThreatList m_threatlist;
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostilReference*>::iterator itr = threatlist.begin();
std::list<HostilReference*>::reverse_iterator ritr = threatlist.rbegin();
if (uiPosition >= threatlist.size() || !threatlist.size())
return NULL;
switch (pTarget)
{
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)
{
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)
{
//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 ||
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_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 ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ||
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_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())
{
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<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::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)
{
if(pUnit)
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)
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<Trinity::MostHPMissingInRange> searcher(m_creature, pUnit, u_check);
m_creature->VisitNearbyObject(fRange, searcher);
return pUnit;
}
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float fRange)
{
std::list<Creature*> pList;
Trinity::FriendlyCCedInRange u_check(m_creature, fRange);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(m_creature, pList, u_check);
m_creature->VisitNearbyObject(fRange, searcher);
return pList;
}
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellid)
{
std::list<Creature*> pList;
Trinity::FriendlyMissingBuffInRange u_check(m_creature, fRange, uiSpellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(m_creature, pList, u_check);
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<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
CellLock<GridReadGuard> 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,
NPC_VOID_REAVER = 19516,
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)
{
if (m_uiEvadeCheckCooldown <= uiDiff)
m_uiEvadeCheckCooldown = 2500;
else
{
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)
if (fZ > 448.60f)
return false;
break;
case NPC_VOID_REAVER: // void reaver (calculate from center of room)
if (m_creature->GetDistance2d(432.59f, 371.93f) < 105.0f)
return false;
break;
case NPC_JAN_ALAI: // jan'alai (calculate by Z)
if (fZ > 12.0f)
return false;
break;
case NPC_SARTHARION: // sartharion (calculate box)
if (fX > 3218.86f && fX < 3275.69f && fY < 572.40f && fY > 484.68f)
return false;
break;
default:
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();
summons.DespawnAll();
if(instance)
{
instance->SetBossState(bossId, DONE);
instance->SaveToDB();
}
}
void BossAI::_EnterCombat()
{
me->setActive(true);
DoZoneInCombat();
if(instance)
instance->SetBossState(bossId, IN_PROGRESS);
}
void BossAI::TeleportCheaters()
{
float x, y, z;
me->GetPosition(x, y, z);
std::list<HostilReference*> &m_threatlist = me->getThreatManager().getThreatList();
for (std::list<HostilReference*>::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)
{
switch (itr->first)
{
case BOUNDARY_N:
if (me->GetPositionX() > itr->second)
return false;
break;
case BOUNDARY_S:
if (me->GetPositionX() < itr->second)
return false;
break;
case BOUNDARY_E:
if (me->GetPositionY() < itr->second)
return false;
break;
case BOUNDARY_W:
if (me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_NW:
if (me->GetPositionX() + me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_SE:
if (me->GetPositionX() + me->GetPositionY() < itr->second)
return false;
break;
case BOUNDARY_NE:
if (me->GetPositionX() - me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_SW:
if (me->GetPositionX() - me->GetPositionY() < itr->second)
return false;
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<GameObjectInfo*>(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)
{
spellInfo = GET_SPELL(i);
if(!spellInfo)
continue;
switch(i)
{
// Black Temple : Illidan : Parasitic Shadowfiend Passive
case 41013:
spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
break;
// Naxxramas : Gothik : Inform Inf range
case 27892:
case 27928:
case 27935:
case 27915:
case 27931:
case 27937:
spellInfo->rangeIndex = 13;
break;
// Ulduar : Flame Leviathan : Pursued
case 62374:
spellInfo->MaxAffectedTargets = 1;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_AREA_ENTRY_SRC;
spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_AREA_ENTRY_SRC;
break;
}
}
}
// SD2 grid searchers.
Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive)
{
return pSource->FindNearestCreature(uiEntry, fMaxSearchRange, bAlive);
}
GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
return pSource->FindNearestGameObject(uiEntry, fMaxSearchRange);
}
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
return pSource->GetCreatureListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
}
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
return pSource->GetGameObjectListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
}
+290
View File
@@ -0,0 +1,290 @@
/* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_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<Player*>(a))
#define CAST_CRE(a) (SCRIPT_CAST_TYPE<Creature*>(a))
#define CAST_SUM(a) (SCRIPT_CAST_TYPE<TempSummon*>(a))
#define CAST_PET(a) (SCRIPT_CAST_TYPE<Pet*>(a))
#define CAST_AI(a,b) (SCRIPT_CAST_TYPE<a*>(b))
#define GET_SPELL(a) (const_cast<SpellEntry*>(GetSpellStore()->LookupEntry(a)))
class ScriptedInstance;
class SummonList : public std::list<uint64>
{
public:
explicit SummonList(Creature* creature) : m_creature(creature) {}
void Summon(Creature *summon) { push_back(summon->GetGUID()); }
void Despawn(Creature *summon) { remove(summon->GetGUID()); }
void DespawnEntry(uint32 entry);
void DespawnAll();
void DoAction(uint32 entry, uint32 info);
void DoZoneInCombat(uint32 entry = 0);
private:
Creature *m_creature;
};
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
{
explicit ScriptedAI(Creature* pCreature);
virtual ~ScriptedAI() {}
//*************
//CreatureAI Functions
//*************
void AttackStartNoMove(Unit *pTarget);
// 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 *pTarget, 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;
//*************
//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<Creature*> DoFindFriendlyCC(float fRange);
//Returns a list of all friendly units missing a specific buff within range
std::list<Creature*> 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 pTarget, 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);
// return true for heroic mode. i.e.
// - for dungeon in mode 10-heroic,
// - for raid in mode 10-Heroic
// - for raid in mode 25-heroic
// DO NOT USE to check raid in mode 25-normal.
bool IsHeroic() { return m_heroicMode; }
// return the dungeon or raid difficulty
Difficulty getDifficulty() { return m_difficulty; }
template<class T> inline
const T& DUNGEON_MODE(const T& normal5, const T& heroic10)
{
switch(m_difficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
return normal5;
case DUNGEON_DIFFICULTY_HEROIC:
return heroic10;
}
return heroic10;
}
template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25)
{
switch(m_difficulty)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
return normal10;
case RAID_DIFFICULTY_25MAN_NORMAL:
return normal25;
}
return normal25;
}
template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25)
{
switch(m_difficulty)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
return normal10;
case RAID_DIFFICULTY_25MAN_NORMAL:
return normal25;
case RAID_DIFFICULTY_10MAN_HEROIC:
return heroic10;
case RAID_DIFFICULTY_25MAN_HEROIC:
return heroic25;
}
return heroic25;
}
private:
bool m_bCombatMovement;
uint32 m_uiEvadeCheckCooldown;
bool m_heroicMode;
Difficulty m_difficulty;
};
struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
{
Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {}
virtual ~Scripted_NoMovementAI() {}
//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);
virtual ~BossAI() {}
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))
return true;
EnterEvadeMode();
return false;
}
bool CheckBoundary(Unit *who);
void TeleportCheaters();
};
// SD2 grid searchers.
Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive = true);
GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange);
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
#endif
+506
View File
@@ -0,0 +1,506 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
/* ScriptData
SDName: Npc_EscortAI
SD%Complete: 100
SDComment:
SDCategory: Npc
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptedEscortAI.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),
m_uiPlayerCheckTimer(1000),
m_uiWPWaitTimer(2500),
m_uiEscortState(STATE_ESCORT_NONE),
m_bIsActiveAttacker(true),
m_bIsRunning(false),
DespawnAtEnd(true),
DespawnAtFar(true),
m_pQuestForEscort(NULL),
m_bCanInstantRespawn(false),
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))
{
//already fighting someone?
if (!m_creature->getVictim())
{
AttackStart(pWho);
return true;
}
else
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
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);
if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
{
if (!m_creature->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (m_creature->GetMap()->IsDungeon())
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
}
}
}
}
}
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())
{
if (Player* pMember = pRef->getSource())
{
if (pMember->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pMember->FailQuest(m_pQuestForEscort->GetQuestId());
}
}
}
else
{
if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pPlayer->FailQuest(m_pQuestForEscort->GetQuestId());
}
}
}
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);
ReturnToLastPoint();
debug_log("TSCR: EscortAI has left combat and is now returning to last point");
}
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())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance()))
{
return true;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance()))
return true;
}
}
return false;
}
void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
//Waypoint Updating
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (m_uiWPWaitTimer <= uiDiff)
{
//End of the line
if (CurrentWP == WaypointList.end())
{
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);
m_creature->Respawn();
}
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))
{
if (m_uiPlayerCheckTimer <= 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);
m_creature->Respawn();
}
else
m_creature->ForcedDespawn();
return;
}
m_uiPlayerCheckTimer = 1000;
}
else
m_uiPlayerCheckTimer -= uiDiff;
}
UpdateEscortAI(uiDiff);
}
void npc_escortAI::UpdateEscortAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
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;
}
else
{
//Make sure that we are still on the right waypoint
if (CurrentWP->id != 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)
{
// We got possessed in the middle of being escorted, store the point
// where we left off to come back to when possess is removed
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (apply)
m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z);
else
{
Returning = true;
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
}
}
}
*/
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;
wp.m_uiCreatureEntry = me->GetEntry();
wp.m_uiPointId = id;
wp.m_fX = x;
wp.m_fY = y;
wp.m_fZ = z;
wp.m_uiWaitTime = WaitTimeMs;
PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/
}
void npc_escortAI::FillPointMovementListForCreature()
{
std::vector<ScriptPointMove> const &pPointsEntries = pSystemMgr.GetPointMoveList(m_creature->GetEntry());
if (pPointsEntries.empty())
return;
std::vector<ScriptPointMove>::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)
{
if (!m_bIsRunning)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
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)
{
if (m_creature->getVictim())
{
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. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0);
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
RemoveEscortState(STATE_ESCORT_PAUSED);
}
+116
View File
@@ -0,0 +1,116 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_ESCORTAI_H
#define SC_ESCORTAI_H
#include "ScriptSystem.h"
#define DEFAULT_MAX_PLAYER_DISTANCE 50
struct Escort_Waypoint
{
Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w)
{
id = _id;
x = _x;
y = _y;
z = _z;
WaitTimeMs = _w;
}
uint32 id;
float x;
float y;
float z;
uint32 WaitTimeMs;
};
enum eEscortState
{
STATE_ESCORT_NONE = 0x000, //nothing in progress
STATE_ESCORT_ESCORTING = 0x001, //escort are in progress
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); }
virtual bool IsEscorted() { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
float GetMaxPlayerDistance() { return MaxPlayerDistance; }
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<Escort_Waypoint> WaypointList;
std::list<Escort_Waypoint>::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)
bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests.
bool DespawnAtEnd;
bool DespawnAtFar;
bool ScriptWP;
};
#endif
+387
View File
@@ -0,0 +1,387 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
/* ScriptData
SDName: FollowerAI
SD%Complete: 50
SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptedFollowerAI.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.
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))
{
//already fighting someone?
if (!m_creature->getVictim())
{
AttackStart(pWho);
return true;
}
else
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
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);
if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
{
if (!m_creature->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (m_creature->GetMap()->IsDungeon())
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
}
}
}
}
}
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())
{
if (Player* pMember = pRef->getSource())
{
if (pMember->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pMember->FailQuest(m_pQuestForFollow->GetQuestId());
}
}
}
else
{
if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pPlayer->FailQuest(m_pQuestForFollow->GetQuestId());
}
}
}
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;
m_creature->GetPosition(fPosX, fPosY, fPosZ);
m_creature->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ);
}
}
else
{
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())
{
if (m_uiUpdateFollowTimer <= uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
debug_log("TSCR: FollowerAI is set completed, despawns.");
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())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
bIsMaxRangeExceeded = false;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
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())
{
if (!HasFollowState(STATE_FOLLOW_PAUSED))
AddFollowState(STATE_FOLLOW_RETURNING);
}
else
m_creature->ForcedDespawn();
}
}
void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest)
{
if (m_creature->getVictim())
{
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))
{
if (pLeader->isAlive())
return pLeader;
else
{
if (Group* pGroup = pLeader->GetGroup())
{
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.");
m_uiLeaderGUID = pMember->GetGUID();
return pMember;
break;
}
}
}
}
}
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
{
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();
}
}
else
{
RemoveFollowState(STATE_FOLLOW_PAUSED);
if (Player* pLeader = GetLeaderForFollower())
m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
}
+67
View File
@@ -0,0 +1,67 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_FOLLOWERAI_H
#define SC_FOLLOWERAI_H
#include "ScriptSystem.h"
enum eFollowState
{
STATE_FOLLOW_NONE = 0x000,
STATE_FOLLOW_INPROGRESS = 0x001, //must always have this state for any follow
STATE_FOLLOW_RETURNING = 0x002, //when returning to combat start after being in combat
STATE_FOLLOW_PAUSED = 0x004, //disables following
STATE_FOLLOW_COMPLETE = 0x008, //follow is completed and may end
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
+191
View File
@@ -0,0 +1,191 @@
/* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_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"
#define GOSSIP_TEXT_WINDRIDER "The wind rider master"
#define GOSSIP_TEXT_GRYPHON "The gryphon master"
#define GOSSIP_TEXT_BATHANDLER "The bat handler"
#define GOSSIP_TEXT_HIPPOGRYPH "The hippogryph master"
#define GOSSIP_TEXT_ZEPPLINMASTER "The zeppelin master"
#define GOSSIP_TEXT_DEEPRUNTRAM "The Deeprun Tram"
#define GOSSIP_TEXT_FERRY "The Rut'theran Ferry"
#define GOSSIP_TEXT_FLIGHTMASTER "The flight master"
#define GOSSIP_TEXT_AUCTIONHOUSE "The auction house"
#define GOSSIP_TEXT_GUILDMASTER "The guild master"
#define GOSSIP_TEXT_INN "The inn"
#define GOSSIP_TEXT_MAILBOX "The mailbox"
#define GOSSIP_TEXT_STABLEMASTER "The stable master"
#define GOSSIP_TEXT_WEAPONMASTER "The weapon master"
#define GOSSIP_TEXT_OFFICERS "The officers' lounge"
#define GOSSIP_TEXT_BATTLEMASTER "The battlemaster"
#define GOSSIP_TEXT_BARBER "Barber"
#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"
#define GOSSIP_TEXT_PRIEST "Priest"
#define GOSSIP_TEXT_ROGUE "Rogue"
#define GOSSIP_TEXT_WARRIOR "Warrior"
#define GOSSIP_TEXT_PALADIN "Paladin"
#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"
#define GOSSIP_TEXT_ENCHANTING "Enchanting"
#define GOSSIP_TEXT_ENGINEERING "Engineering"
#define GOSSIP_TEXT_FIRSTAID "First Aid"
#define GOSSIP_TEXT_HERBALISM "Herbalism"
#define GOSSIP_TEXT_INSCRIPTION "Inscription"
#define GOSSIP_TEXT_JEWELCRAFTING "Jewelcrafting"
#define GOSSIP_TEXT_LEATHERWORKING "Leatherworking"
#define GOSSIP_TEXT_TAILORING "Tailoring"
#define GOSSIP_TEXT_MINING "Mining"
#define GOSSIP_TEXT_FISHING "Fishing"
#define GOSSIP_TEXT_SKINNING "Skinning"
enum eTradeskill
{
// Skill defines
TRADESKILL_ALCHEMY = 1,
TRADESKILL_BLACKSMITHING = 2,
TRADESKILL_COOKING = 3,
TRADESKILL_ENCHANTING = 4,
TRADESKILL_ENGINEERING = 5,
TRADESKILL_FIRSTAID = 6,
TRADESKILL_HERBALISM = 7,
TRADESKILL_LEATHERWORKING = 8,
TRADESKILL_POISONS = 9,
TRADESKILL_TAILORING = 10,
TRADESKILL_MINING = 11,
TRADESKILL_FISHING = 12,
TRADESKILL_SKINNING = 13,
TRADESKILL_JEWLCRAFTING = 14,
TRADESKILL_INSCRIPTION = 15,
TRADESKILL_LEVEL_NONE = 0,
TRADESKILL_LEVEL_APPRENTICE = 1,
TRADESKILL_LEVEL_JOURNEYMAN = 2,
TRADESKILL_LEVEL_EXPERT = 3,
TRADESKILL_LEVEL_ARTISAN = 4,
TRADESKILL_LEVEL_MASTER = 5,
TRADESKILL_LEVEL_GRAND_MASTER = 6,
// Gossip defines
GOSSIP_ACTION_TRADE = 1,
GOSSIP_ACTION_TRAIN = 2,
GOSSIP_ACTION_TAXI = 3,
GOSSIP_ACTION_GUILD = 4,
GOSSIP_ACTION_BATTLE = 5,
GOSSIP_ACTION_BANK = 6,
GOSSIP_ACTION_INN = 7,
GOSSIP_ACTION_HEAL = 8,
GOSSIP_ACTION_TABARD = 9,
GOSSIP_ACTION_AUCTION = 10,
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,
GOSSIP_SENDER_SEC_PROFTRAIN = 4,
GOSSIP_SENDER_SEC_CLASSTRAIN = 5,
GOSSIP_SENDER_SEC_BATTLEINFO = 6,
GOSSIP_SENDER_SEC_BANK = 7,
GOSSIP_SENDER_SEC_INN = 8,
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
// c - Sender(this is to identify the current Menu with this item)
// d - Action (identifys this Menu Item)
// e - Text to be displayed in pop up box
// 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
// c - Icon Id
// d - Flags
// 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)
#define SEND_BANKERLIST(a) GetSession()->SendShowBank(a)
#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
+194
View File
@@ -0,0 +1,194 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.sourceforge.net/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, 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 "ScriptedPch.h"
#include "ScriptedGuardAI.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 again 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))
{
//If we are within range melee the target
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
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();
}
}
else
{
//Only run this code if we arn't already casting
if (!m_creature->IsNonMeleeSpellCasted(false))
{
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)
{
//If we are currently moving stop us and set the movement generator
if ((*m_creature).GetMotionMaster()->GetCurrentMovementGeneratorType()!=IDLE_MOTION_TYPE)
{
(*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)
{
//Cancel our current spell and then mutate new movement generator
m_creature->InterruptNonMeleeSpells(false);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MoveChase(m_creature->getVictim());
}
}
}
}
void guardAI::DoReplyToTextEmote(uint32 em)
{
switch(em)
{
case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
case TEXTEMOTE_SALUTE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break;
case TEXTEMOTE_SHY: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break;
case TEXTEMOTE_RUDE:
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)
DoReplyToTextEmote(text_emote);
}
+45
View File
@@ -0,0 +1,45 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_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
+20
View File
@@ -0,0 +1,20 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_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
+6
View File
@@ -0,0 +1,6 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "ScriptedPch.h"
+37
View File
@@ -0,0 +1,37 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_PRECOMPILED_H
#define SC_PRECOMPILED_H
#include "ScriptMgr.h"
#include "Cell.h"
#include "CellImpl.h"
#include "GameEventMgr.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Unit.h"
#include "GameObject.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedInstance.h"
#include "CombatAI.h"
#include "PassiveAI.h"
#include "Chat.h"
#include "DBCStructure.h"
#include "DBCStores.h"
#ifdef WIN32
#include <windows.h>
/*BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return true;
}*/
#endif
#endif
+278
View File
@@ -0,0 +1,278 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, 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 "ScriptedPch.h"
#include "ScriptedSimpleAI.h"
SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c)
{
//Clear all data
Aggro_TextId[0] = 0;
Aggro_TextId[1] = 0;
Aggro_TextId[2] = 0;
Aggro_Sound[0] = 0;
Aggro_Sound[1] = 0;
Aggro_Sound[2] = 0;
Death_TextId[0] = 0;
Death_TextId[1] = 0;
Death_TextId[2] = 0;
Death_Sound[0] = 0;
Death_Sound[1] = 0;
Death_Sound[2] = 0;
Death_Spell = 0;
Death_Target_Type = 0;
Kill_TextId[0] = 0;
Kill_TextId[1] = 0;
Kill_TextId[2] = 0;
Kill_Sound[0] = 0;
Kill_Sound[1] = 0;
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
if (Spell[0].First_Cast >= 0)
Spell_Timer[0] = Spell[0].First_Cast;
else Spell_Timer[0] = 1000;
if (Spell[1].First_Cast >= 0)
Spell_Timer[1] = Spell[1].First_Cast;
else Spell_Timer[1] = 1000;
if (Spell[2].First_Cast >= 0)
Spell_Timer[2] = Spell[2].First_Cast;
else Spell_Timer[2] = 1000;
if (Spell[3].First_Cast >= 0)
Spell_Timer[3] = Spell[3].First_Cast;
else Spell_Timer[3] = 1000;
if (Spell[4].First_Cast >= 0)
Spell_Timer[4] = Spell[4].First_Cast;
else Spell_Timer[4] = 1000;
if (Spell[5].First_Cast >= 0)
Spell_Timer[5] = Spell[5].First_Cast;
else Spell_Timer[5] = 1000;
if (Spell[6].First_Cast >= 0)
Spell_Timer[6] = Spell[6].First_Cast;
else Spell_Timer[6] = 1000;
if (Spell[7].First_Cast >= 0)
Spell_Timer[7] = Spell[7].First_Cast;
else Spell_Timer[7] = 1000;
if (Spell[8].First_Cast >= 0)
Spell_Timer[8] = Spell[8].First_Cast;
else Spell_Timer[8] = 1000;
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 *pTarget = NULL;
switch (Kill_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
break;
case CAST_HOSTILE_LAST_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0);
break;
case CAST_HOSTILE_RANDOM:
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
break;
case CAST_KILLEDUNIT_VICTIM:
pTarget = victim;
break;
}
//Target is ok, cast a spell on it
if (pTarget)
DoCast(pTarget, 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 *pTarget = NULL;
switch (Death_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
break;
case CAST_HOSTILE_LAST_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0);
break;
case CAST_HOSTILE_RANDOM:
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
break;
case CAST_JUSTDIED_KILLER:
pTarget = killer;
break;
}
//Target is ok, cast a spell on it
if (pTarget)
DoCast(pTarget, 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 *pTarget = NULL;
switch (Spell[i].Cast_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
break;
case CAST_HOSTILE_LAST_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0);
break;
case CAST_HOSTILE_RANDOM:
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
break;
}
//Target is ok, cast a spell on it and then do our random yell
if (pTarget)
{
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(false);
DoCast(pTarget, 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, pTarget);
//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();
}
+71
View File
@@ -0,0 +1,71 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_SIMPLEAI_H
#define SC_SIMPLEAI_H
enum CastTarget
{
CAST_SELF = 0, //Self cast
CAST_HOSTILE_TARGET, //Our current target (ie: highest aggro)
CAST_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
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
int32 First_Cast; //Delay for first cast
uint32 Cooldown; //Cooldown between casts
uint32 CooldownRandomAddition; //Random addition to cooldown (in range from 0 - CooldownRandomAddition)
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
+3 -2
View File
@@ -52,6 +52,7 @@
#include "ScriptCalls.h"
#include "SpellAuraEffects.h"
#include "SpellId.h"
#include "ScriptMgr.h"
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
@@ -4297,7 +4298,7 @@ void Spell::HandleThreatSpells(uint32 spellId)
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
{
if (!Script->OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
if (!sScriptMgr.OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
return;
//effect has been handled, skip it
@@ -4467,7 +4468,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if (target->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
else if ((target->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
else if ((target->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
return SPELL_FAILED_TARGET_NO_POCKETS;
}
+4 -3
View File
@@ -38,6 +38,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "ScriptMgr.h"
class Aura;
//
@@ -2189,7 +2190,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
triggerTarget = target; //for druid dispel poison
target->CastSpell(triggerTarget, triggeredSpellInfo, true, 0, this, GetCasterGUID());
}
else if(target->GetTypeId()!=TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target))
else if(target->GetTypeId()!=TYPEID_UNIT || !sScriptMgr.EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target))
sLog.outError("AuraEffect::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
}
@@ -6007,13 +6008,13 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const * aurApp, uint8 mode
if(apply)
{
target->setFaction(GetMiscValue());
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId()==TYPEID_PLAYER)
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
else
{
target->RestoreFaction();
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId()==TYPEID_PLAYER)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
}
+5 -4
View File
@@ -63,6 +63,7 @@
#include "SkillDiscovery.h"
#include "Formulas.h"
#include "Vehicle.h"
#include "ScriptMgr.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -2145,11 +2146,11 @@ void Spell::EffectDummy(uint32 i)
// Script based implementation. Must be used only for not good for implementation in core spell effects
// So called only for not proccessed cases
if(gameObjTarget)
Script->EffectDummyGameObj(m_caster, m_spellInfo->Id, i, gameObjTarget);
sScriptMgr.EffectDummyGameObj(m_caster, m_spellInfo->Id, i, gameObjTarget);
else if(unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
Script->EffectDummyCreature(m_caster, m_spellInfo->Id, i, (Creature*)unitTarget);
sScriptMgr.EffectDummyCreature(m_caster, m_spellInfo->Id, i, (Creature*)unitTarget);
else if(itemTarget)
Script->EffectDummyItem(m_caster, m_spellInfo->Id, i, itemTarget);
sScriptMgr.EffectDummyItem(m_caster, m_spellInfo->Id, i, itemTarget);
}
void Spell::EffectTriggerSpellWithValue(uint32 i)
@@ -3254,7 +3255,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
if (gameObjTarget)
{
if (Script->GOHello(player, gameObjTarget))
if (sScriptMgr.GOHello(player, gameObjTarget))
return;
switch (gameObjTarget->GetGoType())
+3 -2
View File
@@ -32,6 +32,7 @@
#include "TemporarySummon.h"
#include "SpellAuras.h"
#include "CreatureAI.h"
#include "ScriptMgr.h"
void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
@@ -146,7 +147,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
}
//Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.
if(!Script->ItemUse(pUser,pItem,targets))
if(!sScriptMgr.ItemUse(pUser,pItem,targets))
{
// no script or script not process request by self
pUser->CastItemUseSpell(pItem,targets,cast_count,glyphIndex);
@@ -257,7 +258,7 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
if(!obj)
return;
if (Script->GOHello(_player, obj))
if (sScriptMgr.GOHello(_player, obj))
return;
obj->Use(_player);
+2 -2
View File
@@ -3563,8 +3563,8 @@ void SpellMgr::LoadSpellCustomAttr()
count++;
break;
case SPELL_EFFECT_PICKPOCKET:
mSpellCustomAttr[i] |= SPELL_ATTR_CU_PICKPOCKET;
break;
mSpellCustomAttr[i] |= SPELL_ATTR_CU_PICKPOCKET;
break;
case SPELL_EFFECT_TRIGGER_SPELL:
if (IsPositionTarget(spellInfo->EffectImplicitTargetA[j]) ||
spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION))
+1 -1
View File
@@ -827,7 +827,7 @@ inline bool IsProfessionSkill(uint32 skill)
#define SPELL_ATTR_CU_LINK_HIT 0x00000800
#define SPELL_ATTR_CU_LINK_AURA 0x00001000
#define SPELL_ATTR_CU_LINK_REMOVE 0x00002000
#define SPELL_ATTR_CU_PICKPOCKET 0x00004000
#define SPELL_ATTR_CU_PICKPOCKET 0x00004000
#define SPELL_ATTR_CU_EXCLUDE_SELF 0x00008000
#define SPELL_ATTR_CU_NEGATIVE_EFF0 0x00010000
#define SPELL_ATTR_CU_NEGATIVE_EFF1 0x00020000
+3 -4
View File
@@ -68,6 +68,7 @@
#include "CreatureGroups.h"
#include "Transports.h"
#include "ProgressBar.h"
#include "ScriptMgr.h"
INSTANTIATE_SINGLETON_1(World);
@@ -1680,9 +1681,7 @@ void World::SetInitialWorldSettings()
sLog.SetLogDB(false);
sLog.SetLogDBLater(false);
}
Script->OnServerStartup();
sScriptMgr.OnServerStartup();
sLog.outString("WORLD: World initialized");
}
@@ -2298,7 +2297,7 @@ void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
ShutdownMsg(true);
}
Script->OnServerShutdown();
sScriptMgr.OnServerShutdown();
}
/// Display a shutdown message to the user(s)
+2 -1
View File
@@ -42,6 +42,7 @@
#include "SocialMgr.h"
#include "zlib/zlib.h"
#include "ScriptCalls.h"
#include "ScriptMgr.h"
/// WorldSession constructor
WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
@@ -457,7 +458,7 @@ void WorldSession::LogoutPlayer(bool Save)
}
//Hook for OnLogout Event
Script->OnLogout(_player);
sScriptMgr.OnLogout(_player);
m_playerLogout = false;
m_playerSave = false;
+1 -1
View File
@@ -1 +1 @@
//#include "pchdef.h"
#include "pchdef.h"
+2
View File
@@ -10,3 +10,5 @@
#include "Opcodes.h"
#include "SharedDefines.h"
#include "ObjectMgr.h"
#include "ScriptedPch.h"