aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/conf_merge/confdiffmerge.php169
-rw-r--r--sql/updates/world/2014_05_18_00_world_misc.sql17
-rw-r--r--sql/updates/world/2014_05_18_01_world_misc.sql37
-rw-r--r--sql/updates/world/2014_05_18_02_world_gameobject.sql4
-rw-r--r--sql/updates/world/2014_05_18_03_world_misc.sql48
-rw-r--r--sql/updates/world/2014_05_18_04_world_misc.sql28
-rw-r--r--sql/updates/world/2014_05_19_00_world_misc.sql10
-rw-r--r--sql/updates/world/2014_05_19_01_world_misc.sql8
-rw-r--r--sql/updates/world/2014_05_23_00_world_spell_script_names.sql3
-rw-r--r--sql/updates/world/2014_05_23_01_world_trinity_string.sql3
-rw-r--r--sql/updates/world/2014_05_30_00_world_quest_update.sql1
-rw-r--r--sql/updates/world/2014_06_03_world_creature.sql1
-rw-r--r--sql/updates/world/2014_06_06_00_world_misc.sql92
-rw-r--r--sql/updates/world/2014_06_06_00_world_quest_template.sql4
-rw-r--r--sql/updates/world/2014_06_07_00_world_misc.sql31
-rw-r--r--sql/updates/world/2014_06_08_00_world_conditions.sql1
-rw-r--r--sql/updates/world/2014_06_08_01_world_gameobject.sql17
-rw-r--r--sql/updates/world/2014_06_08_02_world_gameobject.sql40
-rw-r--r--sql/updates/world/2014_06_08_03_world_gameobject.sql1
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp2
-rw-r--r--src/server/authserver/Authentication/AuthCodes.h2
-rw-r--r--src/server/authserver/Main.cpp16
-rw-r--r--src/server/collision/Maps/MapTree.cpp3
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp3
-rw-r--r--src/server/collision/Models/GameObjectModel.h3
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp6
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp4
-rw-r--r--src/server/game/AI/CreatureAI.cpp5
-rw-r--r--src/server/game/AI/CreatureAI.h1
-rw-r--r--src/server/game/AI/CreatureAIImpl.h353
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp12
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp10
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp12
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp2
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp12
-rw-r--r--src/server/game/Battlefield/Battlefield.h4
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp6
-rw-r--r--src/server/game/Battlegrounds/Battleground.h2
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp23
-rw-r--r--src/server/game/Calendar/CalendarMgr.h3
-rw-r--r--src/server/game/Chat/Channels/Channel.h2
-rw-r--r--src/server/game/DataStores/DBCStores.cpp2
-rw-r--r--src/server/game/DataStores/DBCStores.h1
-rw-r--r--src/server/game/DataStores/DBCStructure.h12
-rw-r--r--src/server/game/DataStores/DBCfmt.h1
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp6
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp9
-rw-r--r--src/server/game/Entities/Item/Item.cpp2
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp119
-rw-r--r--src/server/game/Entities/Player/Player.h22
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp701
-rw-r--r--src/server/game/Entities/Unit/Unit.h16
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp39
-rw-r--r--src/server/game/Guilds/Guild.cpp8
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp69
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp14
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp2
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp75
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp16
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp1
-rw-r--r--src/server/game/Handlers/PetHandler.cpp13
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp16
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp7
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp12
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp4
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp4
-rw-r--r--src/server/game/Instances/InstanceScript.h4
-rw-r--r--src/server/game/Maps/Map.cpp7
-rw-r--r--src/server/game/Maps/MapUpdater.cpp30
-rw-r--r--src/server/game/Miscellaneous/Language.h2
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h6
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp2
-rw-r--r--src/server/game/Server/Protocol/Opcodes.h19
-rw-r--r--src/server/game/Server/WorldSession.cpp281
-rw-r--r--src/server/game/Server/WorldSession.h22
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp117
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h12
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp90
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h3
-rw-r--r--src/server/game/Spells/Spell.cpp8
-rw-r--r--src/server/game/Spells/SpellEffects.cpp35
-rw-r--r--src/server/game/Spells/SpellInfo.cpp13
-rw-r--r--src/server/game/Spells/SpellMgr.cpp18
-rw-r--r--src/server/game/Spells/SpellScript.h4
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp13
-rw-r--r--src/server/game/Tickets/TicketMgr.cpp2
-rw-r--r--src/server/game/Warden/Warden.cpp2
-rw-r--r--src/server/game/Weather/Weather.cpp2
-rw-r--r--src/server/game/Weather/WeatherMgr.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp7
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp101
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp149
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp139
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp163
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp88
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp99
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp118
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp114
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp103
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp240
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp30
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp26
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp32
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp246
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp2
-rw-r--r--src/server/scripts/Events/childrens_week.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp12
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp32
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp72
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp22
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp10
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_durotar.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_ungoro_crater.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp4
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp20
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp10
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp18
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp5
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp28
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h2
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp12
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp52
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp16
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp22
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp35
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp18
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp11
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp212
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp44
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp10
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp2
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp20
-rw-r--r--src/server/scripts/Northrend/zone_crystalsong_forest.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp26
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp42
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp20
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp12
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp18
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp16
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp16
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp24
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp4
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp22
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp36
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp2
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp2
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp4
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp56
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp10
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp55
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp2
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp18
-rw-r--r--src/server/scripts/Spells/spell_item.cpp3
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp4
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp15
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp13
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp15
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp4
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp2
-rw-r--r--src/server/scripts/World/guards.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp68
-rw-r--r--src/server/shared/Containers.h28
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h8
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp2
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.h2
-rw-r--r--src/server/shared/Logging/Log.cpp15
-rw-r--r--src/server/shared/Logging/Log.h54
-rw-r--r--src/server/shared/Packets/ByteBuffer.cpp7
-rw-r--r--src/server/shared/Packets/ByteBuffer.h19
-rw-r--r--src/server/shared/Utilities/Util.h350
-rw-r--r--src/server/worldserver/Master.cpp18
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.cpp2
276 files changed, 3975 insertions, 2752 deletions
diff --git a/contrib/conf_merge/confdiffmerge.php b/contrib/conf_merge/confdiffmerge.php
new file mode 100644
index 00000000000..7bcaef5042e
--- /dev/null
+++ b/contrib/conf_merge/confdiffmerge.php
@@ -0,0 +1,169 @@
+<!--
+ @title Configuration file merger/differ.
+ @about This script allows you to diff two config files and select which value to pick between the two.
+ It will then give you an updated configuration file with the settings you chose.
+ How-to: a) Paste both versions of your config file, submit the form.
+ b) Select values you want to keep in the next form, then submit said form.
+ c) Copy the output'd config file and profit!
+ Note: if either one of your config file has custom values, make sure that it is set to be the NEW
+ config file on the first step (right hand textarea). This will be adressed at a later date.
+ @author Warpten
+ @date 05/17/2014
+ @license GNU GPL v2(GPL)
+ @version 0.0.1
+-->
+<!DOCTYPE html>
+<html>
+<head>
+ <title>&lt;world/auth&gt;server.conf diff</title>
+ <style type="text/css">
+ form * { font-family: Verdana; font-size: 11px; }
+ form#step1 { position: relative; width: 800px; }
+ form#step2 { width: 500px; }
+ form > div { position: absolute; width: 50%; height: 500px; }
+ form > div:nth-child(1) { right: 0px; }
+ textarea { width: 90%; height: 500px; }
+ h3 { display: block; margin: 3px; padding: auto; text-align: center; }
+ input.valueName { border: 0px; background-color: white; }
+ form > p { margin: 0; padding: 3px; border-bottom: 1px solid black; }
+ textarea#result { width: 1000px; }
+ </style>
+</head>
+
+<body>
+<?php
+
+function printIndent($string, $indent = 1)
+{
+ echo str_pad("\r\n" . $string, $indent, " ");
+}
+
+if (!isset($_POST['step']))
+{
+?>
+ <form action="" method="POST" id="step1">
+ <div>
+ <h3>Paste the new configuration file</h3>
+ <textarea name="leftFile"></textarea>
+ </div><div>
+ <h3>Paste the old configuration file</h3>
+ <textarea name="rightFile"></textarea>
+ <input type="submit" value="Compare files" />
+ </div>
+ <input type="hidden" name="step" value="0" />
+ </form>
+<?php
+}
+else if ($_POST['step'] == 0)
+{
+ if (@empty($_POST['leftFile']) || @empty($_POST['rightFile']))
+ printf("You did not provide either the old or the new configuration file.<br />");
+
+ define('EOL', "\n\n");
+ $settingsData = array();
+
+ // Process them
+ $newFile = explode(EOL, $_POST['leftFile']);
+ $oldFile = explode(EOL, $_POST['rightFile']);
+
+ for ($i = 0, $o = count($oldFile); $i < $o; ++$i)
+ {
+ $oldFile[$i] = explode(PHP_EOL, $oldFile[$i]);
+ for ($j = 0, $p = count($oldFile[$i]); $j < $p; ++$j)
+ {
+ $currentLine = $oldFile[$i][$j];
+ if (preg_match("#^([A-Z.]+) = (?:\"?)(.*)(?:\"?)$#iU", $currentLine, $data) !== false)
+ if (strlen($data[1]) != 0)
+ $settingsData[$data[1]]["oldValue"] = str_replace('"', '', trim($data[2]));
+ }
+ }
+
+ for ($i = 0, $o = count($newFile); $i < $o; ++$i)
+ {
+ $newFile[$i] = explode(PHP_EOL, $newFile[$i]);
+ for ($j = 0, $p = count($newFile[$i]); $j < $p; ++$j)
+ {
+ $currentLine = $newFile[$i][$j];
+ if (preg_match("#^([A-Z.]+) = (?:\"?)(.*)(?:\"?)$#iU", $currentLine, $data) !== false)
+ if (strlen($data[1]) != 0)
+ $settingsData[$data[1]]["newValue"] = str_replace('"', '', trim($data[2]));
+ }
+ }
+
+ printIndent("<p>Please select values you want to keep. Note the script will default to new values, unless said <i>new</i> value does not exist.<br />You also can take advantage of this form and edit fields.</p>", 1);
+ printIndent('<form action="" method="POST" id="step2">', 1);
+
+ foreach ($settingsData as $itemName => &$values)
+ {
+ $displayOld = isset($values['oldValue']) ? $values['oldValue'] : "Value missing";
+ $displayNew = isset($values['newValue']) ? $values['newValue'] : "Value missing";
+
+ if ($displayOld == $displayNew)
+ continue;
+
+ $line = '<p><input type="text" class="valueName" name="nameCross[]" value="' . $itemName . '" />';
+ $line .= '<input type="radio" name="optionSelector[' . $itemName . ']" value="oldValue" ' . ($displayOld != "Value missing" ? "checked" : "") . '/>';
+ $line .= '<input type="text" name="oldValue[]" value="' . $displayOld . '" /> ';
+ $line .= '<input type="radio" name="optionSelector[' . $itemName . ']" value="newValue" ' . ($displayNew != "Value missing" ? "checked" : "") . '/>';
+ $line .= '<input type="text" name="newValue[]" value="' . $displayNew . '" /></p>';
+ printIndent($line, 2);
+ }
+ printIndent('<input type="hidden" name="step" value="1" />', 2);
+ printIndent('<input type="submit" value="Gief resulting configuration file" />', 2);
+ printIndent('<input type="hidden" name="file" value="' . htmlspecialchars($_POST['rightFile']) . '" />', 2);
+ printIndent('</form>', 1);
+}
+else if ($_POST['step'] == 1)
+{
+ $errors = array();
+
+ $confFile = $_POST['file'];
+
+ foreach ($_POST['optionSelector'] as $valueName => &$keyName)
+ {
+ $definiteValueIndex = -1;
+ foreach ($_POST['nameCross'] as $index => &$key)
+ {
+ if ($key == $valueName)
+ {
+ $definiteValueIndex = $index;
+ break;
+ }
+ }
+
+ if ($definiteValueIndex == -1)
+ {
+ // TODO: Handle custom values that get lost
+ continue;
+ }
+
+ $newStr = $_POST[$keyName][$definiteValueIndex];
+ $oldStr = $_POST[$keyName == "oldValue" ? "newValue" : "oldValue"][$definiteValueIndex];
+ if (!ctype_digit($newStr))
+ $newStr = '"' . $newStr . '"';
+ if (!ctype_digit($oldStr))
+ $oldStr = '"' . $oldStr . '"';
+
+ $newValueString = $valueName . " = " . $newStr;
+ $oldValueString = $valueName . " = " . $oldStr;
+ $confFile = str_replace($oldValueString, $newValueString, $confFile);
+ }
+ echo "<p>Here is your new configuration file:</p>";
+ echo '<form><textarea id="result">';
+ printf('%s', $confFile);
+ echo '</textarea></form>';
+
+ if (!empty($errors))
+ {
+ echo "<p>The following errors happened during processing:</p><ul><li>";
+ echo implode("</li><li>", $errors);
+ echo "</li>";
+ }
+}
+?>
+
+<script type="text/javascript">
+
+</script>
+</body>
+</html>
diff --git a/sql/updates/world/2014_05_18_00_world_misc.sql b/sql/updates/world/2014_05_18_00_world_misc.sql
new file mode 100644
index 00000000000..fe0b59dc32f
--- /dev/null
+++ b/sql/updates/world/2014_05_18_00_world_misc.sql
@@ -0,0 +1,17 @@
+--
+UPDATE `creature_template` SET `npcflag`=3, `AIName`='SmartAI' WHERE `entry`=37120;
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=10910 AND `id`=1;
+INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`) VALUES
+(10910, 1, 'I must ask that you reforge Shadow''s Edge for me, Highlord Mograine.', 37855, 1, 1);
+
+DELETE FROM `smart_scripts` WHERE `entryorguid`=37120;
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
+(37120, 0, 0, 0, 62, 0, 100, 0, 10910, 1, 0, 0, 11, 72995, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Gossip Option 1 Selected - Cast Shadow''s Edge'),
+(37120, 0, 1, 0, 62, 0, 100, 0, 10910, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Gossip Option 1 Selected - Close Gossip');
+
+DELETE FROM `conditions` WHERE `SourceGroup`=10910;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(15, 10910, 1, 0, 0, 8, 0, 24912, 0, 0, 1, 0, 0, '', 'Highlord Darion Mograine: Hide Gossip option if player has quest 24912 rewarded'),
+(15, 10910, 1, 0, 0, 8, 0, 24743, 0, 0, 0, 0, 0, '', 'Highlord Darion Mograine: Show Gossip option if player has quest 24743 rewarded'),
+(15, 10910, 1, 0, 0, 2, 0, 49888, 1, 0, 1, 0, 0, '', 'Highlord Darion Mograine: Show Gossip option if player does not have Shadow''s Edge');
diff --git a/sql/updates/world/2014_05_18_01_world_misc.sql b/sql/updates/world/2014_05_18_01_world_misc.sql
new file mode 100644
index 00000000000..66df66dc7b5
--- /dev/null
+++ b/sql/updates/world/2014_05_18_01_world_misc.sql
@@ -0,0 +1,37 @@
+--
+SET @ENTRY := 27914;
+UPDATE `creature_template` SET `gossip_menu_id`=9619, `npcflag`=129 WHERE `entry`=@ENTRY;
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=9619;
+INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
+(9619, 0, 0, 'How does this work?', 27298, 1, 1, 9620, 0, 0, 0, '', 0),
+(9619, 1, 1, 'Show me what you have to trade.', 27299, 3, 128, 0, 0, 0, 0, '', 0);
+
+DELETE FROM `gossip_menu` WHERE `entry` IN (9619,9620) AND `text_id` IN (13005,13006);
+INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES
+(9619, 13005),
+(9620, 13006);
+
+DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES
+(@ENTRY, 0, 0, 'I have arrived. Shall we set to work, then?', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27295),
+(@ENTRY, 1, 0, 'Ah, more essence to capture...', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27336),
+(@ENTRY, 2, 0, 'Here is your share.', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27341);
+
+DELETE FROM `npc_text` WHERE `ID` IN (13005,13006);
+INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `prob0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `prob1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `prob2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `prob3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `prob4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `prob5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `prob6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `prob7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES
+(13005, 'How may this one help you, $gsir:madame;?', '', 27296, 0, 1, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 18019),
+(13006, 'My business partner slays things; I drain a portion of their essence... a pittance, really; the slightest of slivers. It won''t be missed.$B$BStill, to fulfil my portion of the contract, I pay in Ethereal Credits.$B$BOne may redeem these credits for items I sell at any time. I''m bound to have something that will interest you...', '', 27300, 0, 1, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 18019);
+
+DELETE FROM `npc_vendor` WHERE `entry`=@ENTRY;
+INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `incrtime`, `ExtendedCost`) VALUES
+(@ENTRY, 0, 38308, 0, 0, 2411), -- Ethereal Essence Sphere
+(@ENTRY, 1, 38300, 0, 0, 2411), -- Diluted Ethereum Essence
+(@ENTRY, 2, 38294, 0, 0, 2412), -- Ethereal Liqueur
+(@ENTRY, 3, 38291, 0, 0, 2408), -- Ethereal Mutagen
+(@ENTRY, 4, 38163, 0, 0, 2408), -- Soul-Trader's Head Wrap
+(@ENTRY, 5, 38160, 0, 0, 2410), -- Soul-trader's Bindings
+(@ENTRY, 6, 38286, 0, 0, 2407), -- Soul-Trader's Pauldrons
+(@ENTRY, 7, 38285, 0, 0, 2408), -- Soul-Trader's Waistband
+(@ENTRY, 8, 38161, 0, 0, 2409), -- Soul-Trader's Gloves
+(@ENTRY, 9, 38162, 0, 0, 2409); -- Soul-Trader's Boots
diff --git a/sql/updates/world/2014_05_18_02_world_gameobject.sql b/sql/updates/world/2014_05_18_02_world_gameobject.sql
new file mode 100644
index 00000000000..0d3357de2a1
--- /dev/null
+++ b/sql/updates/world/2014_05_18_02_world_gameobject.sql
@@ -0,0 +1,4 @@
+--
+UPDATE `gameobject` SET `position_x`=914.3752, `position_y`=-146.9912, `position_z`=-49.75655, `orientation`=3.68265, `VerifiedBuild`=15595 WHERE `guid`=43097;
+UPDATE `gameobject` SET `position_x`=915.7144, `position_y`=-149.2887, `position_z`=-49.75705, `orientation`=3.647741, `VerifiedBuild`=15595 WHERE `guid`=43098;
+UPDATE `gameobject` SET `position_x`=917.0272, `position_y`=-151.5825, `position_z`=-49.75756, `orientation`=3.647741, `VerifiedBuild`=15595 WHERE `guid`=43099;
diff --git a/sql/updates/world/2014_05_18_03_world_misc.sql b/sql/updates/world/2014_05_18_03_world_misc.sql
new file mode 100644
index 00000000000..86d018dd7b0
--- /dev/null
+++ b/sql/updates/world/2014_05_18_03_world_misc.sql
@@ -0,0 +1,48 @@
+--
+-- Nesingwary Lackey Ear (35188) drop chance fix by nelegalno
+-- Needed for Can't Get Ear-nough... (11867) "turn in only" repeatable quest
+SET @EAR := 35188;
+
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance` = ABS(`ChanceOrQuestChance`) WHERE `item`=@EAR;
+
+-- Clam Master K
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25800 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25800,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Clam Master K only if Ears of Our Enemies quest taken"),
+(1,25800,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Clam Master K only if Ears of Our Enemies quest rewarded");
+
+-- Loot Crazed Poacher
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25806 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25806,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Poacher only if Ears of Our Enemies quest taken"),
+(1,25806,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Poacher only if Ears of Our Enemies quest rewarded");
+
+-- Loot Crazed Diver
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25836 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25836,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Diver only if Ears of Our Enemies quest taken"),
+(1,25836,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Diver only if Ears of Our Enemies quest rewarded");
+
+-- Northsea Mercenary
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25839 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25839,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Mercenary only if Ears of Our Enemies quest taken"),
+(1,25839,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Mercenary only if Ears of Our Enemies quest rewarded");
+
+-- Northsea Thug
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25843 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25843,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Thug only if Ears of Our Enemies quest taken"),
+(1,25843,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Thug only if Ears of Our Enemies quest rewarded");
+
+ -- Minion of Kaw
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25880 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25880,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Minion of Kaw only if Ears of Our Enemies quest taken"),
+(1,25880,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Minion of Kaw only if Ears of Our Enemies quest rewarded");
+
+ -- Loot Crazed Hunter
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25979 AND `SourceEntry`=@EAR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,25979,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Hunter only if Ears of Our Enemies quest taken"),
+(1,25979,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Hunter only if Ears of Our Enemies quest rewarded");
diff --git a/sql/updates/world/2014_05_18_04_world_misc.sql b/sql/updates/world/2014_05_18_04_world_misc.sql
new file mode 100644
index 00000000000..89dc227f7ca
--- /dev/null
+++ b/sql/updates/world/2014_05_18_04_world_misc.sql
@@ -0,0 +1,28 @@
+--
+SET @CGUID := 68279; -- set by TDB team (3)
+SET @OGUID := 6134; -- set by TDB team (2)
+
+DELETE FROM `spell_area` WHERE `spell`=71314;
+INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES
+(71314, 4862, 24559, 24562, 0, 0, 2, 1, 74, 11);
+
+DELETE FROM `creature_addon` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2;
+INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
+(@CGUID+0, 0, 0, 0x10000, 0x1, 0, '71312'),
+(@CGUID+1, 0, 0, 0x10000, 0x1, 0, '71312'),
+(@CGUID+2, 0, 0, 0x10000, 0x1, 0, '71312');
+
+DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
+(@CGUID+0, 36657, 571, 1, 1, 5630.028, 2082.906, 798.1375, 0, 120, 0, 0), -- Sunreaver War Mage (Area: 210)
+(@CGUID+1, 36642, 571, 1, 1, 5630.374, 2087.88, 798.1375, 6.213372, 120, 0, 0), -- Myralion Sunblaze (Area: 210)
+(@CGUID+2, 36657, 571, 1, 1, 5631.038, 2092.561, 798.1375, 6.143559, 120, 0, 0); -- Sunreaver War Mage (Area: 210)
+
+DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+1;
+INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES
+(@OGUID+0, 202192, 571, 1, 1, 5628.946, 2079.644, 798.0542, 0.6457717, 0, 0, 0, 1, 120, 255, 1), -- Sunreaver Banner (Area: 210)
+(@OGUID+1, 202192, 571, 1, 1, 5630.607, 2096.247, 798.0542, 5.881761, 0, 0, 0, 1, 120, 255, 1); -- Sunreaver Banner (Area: 210)
+
+DELETE FROM `gameobject_template` WHERE `entry`=202192;
+INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES
+(202192, 5, 6794, 'Sunreaver Banner', '', '', '', 0, 0, 0.8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 16992);
diff --git a/sql/updates/world/2014_05_19_00_world_misc.sql b/sql/updates/world/2014_05_19_00_world_misc.sql
new file mode 100644
index 00000000000..7879aca132d
--- /dev/null
+++ b/sql/updates/world/2014_05_19_00_world_misc.sql
@@ -0,0 +1,10 @@
+--
+UPDATE `smart_scripts` SET `event_phase_mask`=0 WHERE `entryorguid`=24539 AND `source_type`=0 AND `id` IN(5,6) AND `link`=0;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=2453900 AND `source_type`=9 AND `id`=5 AND `link`=0;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=2453901 AND `source_type`=9 AND `id`=4 AND `link`=0;
+UPDATE `smart_scripts` SET `event_param3`=0, `event_param4`=0 WHERE `entryorguid`=24539 AND `source_type`=0 AND `id`=4 AND `link`=0;
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=24539;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(22, 6, 24539, 0, 0, 38, 1, 50, 4, 0, 0, 0, 0, '', 'Silvermoon Harry - Only run SAI if silvermoon harry hp at 50% or lower'),
+(22, 6, 24539, 0, 0, 9, 0, 11464, 0, 0, 0, 0, 0, '', 'Silvermoon Harry - Only run SAI if player has gambling debt taken');
diff --git a/sql/updates/world/2014_05_19_01_world_misc.sql b/sql/updates/world/2014_05_19_01_world_misc.sql
new file mode 100644
index 00000000000..d25e73f245e
--- /dev/null
+++ b/sql/updates/world/2014_05_19_01_world_misc.sql
@@ -0,0 +1,8 @@
+--
+DELETE FROM `smart_scripts` WHERE `entryorguid`=26737 AND `source_type`=0 AND `id`=5;
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
+(26737, 0, 5, 0, 25, 0, 100, 0, 0, 0, 0, 0, 19, 537133824, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Crazed Mana-Surge - On Reset - Remove Unit Flags (UNK_29 / STUNNED / IMMUNE TO NPC / IMMUNE TO PC)');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=26737;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(22, 6, 26737, 0, 0, 1, 1, 29266, 0, 0, 1, 0, 0, '', 'Crazed Mana Surge only run SAI if Crazed mana surge does not have aura Permanent Feign Death');
diff --git a/sql/updates/world/2014_05_23_00_world_spell_script_names.sql b/sql/updates/world/2014_05_23_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..22d792e6f72
--- /dev/null
+++ b/sql/updates/world/2014_05_23_00_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`=69232;
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(69232,'spell_tyrannus_rimefang_icy_blast');
diff --git a/sql/updates/world/2014_05_23_01_world_trinity_string.sql b/sql/updates/world/2014_05_23_01_world_trinity_string.sql
new file mode 100644
index 00000000000..e05d36f601c
--- /dev/null
+++ b/sql/updates/world/2014_05_23_01_world_trinity_string.sql
@@ -0,0 +1,3 @@
+DELETE FROM `trinity_string` WHERE `entry`=11008;
+INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
+(11008, 'InhabitType: %u');
diff --git a/sql/updates/world/2014_05_30_00_world_quest_update.sql b/sql/updates/world/2014_05_30_00_world_quest_update.sql
new file mode 100644
index 00000000000..a44baf75074
--- /dev/null
+++ b/sql/updates/world/2014_05_30_00_world_quest_update.sql
@@ -0,0 +1 @@
+UPDATE `quest_template` SET `NextQuestId`=1106,`ExclusiveGroup`=-1104 WHERE `Id` IN (1104,1105);
diff --git a/sql/updates/world/2014_06_03_world_creature.sql b/sql/updates/world/2014_06_03_world_creature.sql
new file mode 100644
index 00000000000..81953785fd5
--- /dev/null
+++ b/sql/updates/world/2014_06_03_world_creature.sql
@@ -0,0 +1 @@
+UPDATE `creature` SET `phaseMask`=1 WHERE `id`=21347;
diff --git a/sql/updates/world/2014_06_06_00_world_misc.sql b/sql/updates/world/2014_06_06_00_world_misc.sql
new file mode 100644
index 00000000000..a1d4dd621c0
--- /dev/null
+++ b/sql/updates/world/2014_06_06_00_world_misc.sql
@@ -0,0 +1,92 @@
+
+UPDATE creature_template SET ScriptName="npc_imp_in_a_ball" WHERE entry=23224;
+
+SET @COUNT := 0;
+DELETE FROM creature_text WHERE entry=23224;
+INSERT INTO creature_text (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, unless I have anything to do with it.', 15, 0, 100, 0, 0, 0, '', 21157),
+(23224, 0, @COUNT := @COUNT + 1, 'I see that happening sometime between tomorrow and the next decade. Definitely.', 15, 0, 100, 0, 0, 0, '', 21158),
+(23224, 0, @COUNT := @COUNT + 1, 'Looks good for you...and bad for me.', 15, 0, 100, 0, 0, 0, '', 21160),
+(23224, 0, @COUNT := @COUNT + 1, 'I\'ve consulted my fellow imps, and we think YES, except for that one imp.', 15, 0, 100, 0, 0, 0, '', 21161),
+(23224, 0, @COUNT := @COUNT + 1, 'The outlook is positive, but I\'m still negative.', 15, 0, 100, 0, 0, 0, '', 21162),
+(23224, 0, @COUNT := @COUNT + 1, 'It pains me to say this, but "Yes".', 15, 0, 100, 0, 0, 0, '', 21163),
+(23224, 0, @COUNT := @COUNT + 1, 'When dwarves fly! They do? Then yes!', 15, 0, 100, 0, 0, 0, '', 21164),
+(23224, 0, @COUNT := @COUNT + 1, 'Sure, but you\'re not going to like it.', 15, 0, 100, 0, 0, 0, '', 21165),
+(23224, 0, @COUNT := @COUNT + 1, 'Be quiet \'bout what you hear and see around here, $r.', 15, 0, 100, 0, 0, 0, '', 21166),
+(23224, 0, @COUNT := @COUNT + 1, 'Unfortunately... yes.', 15, 0, 100, 0, 0, 0, '', 21169),
+(23224, 0, @COUNT := @COUNT + 1, 'I can\'t see why not, although, I can\'t see a lot of things right now.', 15, 0, 100, 0, 0, 0, '', 21170),
+(23224, 0, @COUNT := @COUNT + 1, 'I would bet your soul on it.', 15, 0, 100, 0, 0, 0, '', 21171),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, but if anyone asks... It wasn\'t me who told you.', 15, 0, 100, 0, 0, 0, '', 21172),
+(23224, 0, @COUNT := @COUNT + 1, 'Didn\'t you already ask that once? Yes already!', 15, 0, 100, 0, 0, 0, '', 21173),
+(23224, 0, @COUNT := @COUNT + 1, 'Please... Is Kil\'jaeden red?', 15, 0, 100, 0, 0, 0, '', 21175),
+(23224, 0, @COUNT := @COUNT + 1, 'Yeah, sure. You just keep thinking that.', 15, 0, 100, 0, 0, 0, '', 21176),
+(23224, 0, @COUNT := @COUNT + 1, 'I suppose.', 15, 0, 100, 0, 0, 0, '', 21177),
+(23224, 0, @COUNT := @COUNT + 1, 'Definitely.', 15, 0, 100, 0, 0, 0, '', 21178),
+(23224, 0, @COUNT := @COUNT + 1, 'Jump three times and dance for ten minutes and it will definitely happen!', 15, 0, 100, 0, 0, 0, '', 21179),
+(23224, 0, @COUNT := @COUNT + 1, 'Word on the peninsula is YES!', 15, 0, 100, 0, 0, 0, '', 21180),
+(23224, 0, @COUNT := @COUNT + 1, 'Oh, that one\'s for sure.', 15, 0, 100, 0, 0, 0, '', 21181),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, but not in the way you imagine.', 15, 0, 100, 0, 0, 0, '', 21182),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, yes, a thousand times, yes already!', 15, 0, 100, 0, 0, 0, '', 21183),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, now stop pestering me!', 15, 0, 100, 0, 0, 0, '', 21184),
+(23224, 0, @COUNT := @COUNT + 1, 'The answer will be a yes if you let me out of here.', 15, 0, 100, 0, 0, 0, '', 21185),
+(23224, 0, @COUNT := @COUNT + 1, 'It\'s as sure as the warts on my backside!', 15, 0, 100, 0, 0, 0, '', 21186),
+(23224, 0, @COUNT := @COUNT + 1, 'The answer is yes in here, I don\'t see why it would be any different out there.', 15, 0, 100, 0, 0, 0, '', 21187),
+(23224, 0, @COUNT := @COUNT + 1, 'Three words - "ab - so - lutely"!', 15, 0, 100, 0, 0, 0, '', 21188),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, but I hoped I would never have to answer that.', 15, 0, 100, 0, 0, 0, '', 21189),
+(23224, 0, @COUNT := @COUNT + 1, 'Ask me again later - I\'m trying to scratch my nose and it\'s hard to concentrate.', 15, 0, 100, 0, 0, 0, '', 21190),
+(23224, 0, @COUNT := @COUNT + 1, 'Why should I answer that? Do you tell fortunes when people shake YOU?', 15, 0, 100, 0, 0, 0, '', 21191),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, it will rain. That\'s not what you asked? Too bad!', 15, 0, 100, 0, 0, 0, '', 21192),
+(23224, 0, @COUNT := @COUNT + 1, 'I\'m sorry, I can only speak Demonic.', 15, 0, 100, 0, 0, 0, '', 21193),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes! I mean no! I mean... which answer gets me out of here?', 15, 0, 100, 0, 0, 0, '', 21194),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes, No, Maybe so.', 15, 0, 100, 0, 0, 0, '', 21195),
+(23224, 0, @COUNT := @COUNT + 1, 'It won\'t matter, you\'ll be dead by tomorrow.', 15, 0, 100, 0, 0, 0, '', 21196),
+(23224, 0, @COUNT := @COUNT + 1, 'You should be asking "Is that rogue behind me going to kill me?"', 15, 0, 100, 0, 0, 0, '', 21197),
+(23224, 0, @COUNT := @COUNT + 1, 'It\'s times like these that I wish I had a longer cooldown.', 15, 0, 100, 0, 0, 0, '', 21198),
+(23224, 0, @COUNT := @COUNT + 1, '%s shrugs. Who knows?', 15, 0, 100, 0, 0, 0, '', 21199),
+(23224, 0, @COUNT := @COUNT + 1, 'It\'s like my mother always said: [Demonic] "Razxx khaj jhashxx xashjx."', 15, 0, 100, 0, 0, 0, '', 21205),
+(23224, 0, @COUNT := @COUNT + 1, '%s is ignoring you.', 15, 0, 100, 0, 0, 0, '', 21206),
+(23224, 0, @COUNT := @COUNT + 1, 'Why me? Why not a goblin, or a gnome...', 15, 0, 100, 0, 0, 0, '', 21207),
+(23224, 0, @COUNT := @COUNT + 1, 'What happens in the twisting nether, stays in the twisting nether.', 15, 0, 100, 0, 0, 0, '', 21208),
+(23224, 0, @COUNT := @COUNT + 1, 'Avoid taking unnecessary gambles. Your lucky numbers are two, two and half, and eleven-teen.', 15, 0, 100, 0, 0, 0, '', 21209),
+(23224, 0, @COUNT := @COUNT + 1, 'Wouldn\'t you like to know?', 15, 0, 100, 0, 0, 0, '', 21210),
+(23224, 0, @COUNT := @COUNT + 1, 'Oh, oh, oh! I can see this one clearly... Nah, lost it.', 15, 0, 100, 0, 0, 0, '', 21211),
+(23224, 0, @COUNT := @COUNT + 1, 'This was NOT in my contract!', 15, 0, 100, 0, 0, 0, '', 21212),
+(23224, 0, @COUNT := @COUNT + 1, 'XRA RAHKI MAZIZRA!', 15, 0, 100, 0, 0, 0, '', 21213),
+(23224, 0, @COUNT := @COUNT + 1, '4 8 15 16 23 42', 15, 0, 100, 0, 0, 0, '', 21214),
+(23224, 0, @COUNT := @COUNT + 1, 'Are you making fun of me?', 15, 0, 100, 0, 0, 0, '', 21215),
+(23224, 0, @COUNT := @COUNT + 1, 'What kind of imp do you think I am?', 15, 0, 100, 0, 0, 0, '', 21216),
+(23224, 0, @COUNT := @COUNT + 1, 'Say please.', 15, 0, 100, 0, 0, 0, '', 21217),
+(23224, 0, @COUNT := @COUNT + 1, 'Want to trade places?', 15, 0, 100, 0, 0, 0, '', 21218),
+(23224, 0, @COUNT := @COUNT + 1, 'Do you ask this question to everything that\'s trapped in a ball?', 15, 0, 100, 0, 0, 0, '', 21219),
+(23224, 0, @COUNT := @COUNT + 1, 'Hey! You try arranging furniture with some jerk shaking your house!', 15, 0, 100, 0, 0, 0, '', 21220),
+(23224, 0, @COUNT := @COUNT + 1, 'I can make that happen. Just sign below the dotted line...', 15, 0, 100, 0, 0, 0, '', 21221),
+(23224, 0, @COUNT := @COUNT + 1, 'Reply hazy and slightly damp. Dry thoroughly and try again.', 15, 0, 100, 0, 0, 0, '', 21222),
+(23224, 0, @COUNT := @COUNT + 1, 'Concentrate (on releasing me from this infernal prison) and try again later.', 15, 0, 100, 0, 0, 0, '', 21223),
+(23224, 0, @COUNT := @COUNT + 1, 'Please insert 25 silver pieces and try again.', 15, 0, 100, 0, 0, 0, '', 21224),
+(23224, 0, @COUNT := @COUNT + 1, 'Are you my pal, Danny?', 15, 0, 100, 0, 0, 0, '', 21225),
+(23224, 0, @COUNT := @COUNT + 1, 'You remember the time you tried to drill that hole in your head?', 15, 0, 100, 0, 0, 0, '', 21226),
+(23224, 0, @COUNT := @COUNT + 1, 'Oh that\'s right, don\'t make any effort to make your own fortune!', 15, 0, 100, 0, 0, 0, '', 21227),
+(23224, 0, @COUNT := @COUNT + 1, 'Two words - imp-possible!', 15, 0, 100, 0, 0, 0, '', 21228),
+(23224, 0, @COUNT := @COUNT + 1, 'You need Arcane Intellect, because that answer is obvious! NO!', 15, 0, 100, 0, 0, 0, '', 21229),
+(23224, 0, @COUNT := @COUNT + 1, 'Not on your life!', 15, 0, 100, 0, 0, 0, '', 21230),
+(23224, 0, @COUNT := @COUNT + 1, 'I don\'t have to be a fortune-telling imp to know the answer to that one - NO!', 15, 0, 100, 0, 0, 0, '', 21231),
+(23224, 0, @COUNT := @COUNT + 1, 'The odds are 32.33 (repeating of course) percent chance of success.', 15, 0, 100, 0, 0, 0, '', 21232),
+(23224, 0, @COUNT := @COUNT + 1, 'When Blackrock freezes over!', 15, 0, 100, 0, 0, 0, '', 21233),
+(23224, 0, @COUNT := @COUNT + 1, 'Hahahaha, you\'re kidding right?', 15, 0, 100, 0, 0, 0, '', 21234),
+(23224, 0, @COUNT := @COUNT + 1, 'Inconceivable!', 15, 0, 100, 0, 0, 0, '', 21235),
+(23224, 0, @COUNT := @COUNT + 1, 'My sources say "no". Before the torture, that is.', 15, 0, 100, 0, 0, 0, '', 21236),
+(23224, 0, @COUNT := @COUNT + 1, 'That\'s about as likely as me getting out of this ball.', 15, 0, 100, 0, 0, 0, '', 21237),
+(23224, 0, @COUNT := @COUNT + 1, 'You picked the wrong time to shake me today, buddy! Prepare for disappointment.', 15, 0, 100, 0, 0, 0, '', 21238),
+(23224, 0, @COUNT := @COUNT + 1, 'Not unless you\'re some kind of super-person. And don\'t kid yourself, you\'re not.', 15, 0, 100, 0, 0, 0, '', 21239),
+(23224, 0, @COUNT := @COUNT + 1, 'That\'s about as likely as me getting a date with a succubus.', 15, 0, 100, 0, 0, 0, '', 21240),
+(23224, 0, @COUNT := @COUNT + 1, 'My fortune telling powers are immeasurable - your chances are though: NO CHANCE', 15, 0, 100, 0, 0, 0, '', 21241),
+(23224, 0, @COUNT := @COUNT + 1, 'NO - and don\'t try shaking me again for a better answer!', 15, 0, 100, 0, 0, 0, '', 21242),
+(23224, 0, @COUNT := @COUNT + 1, 'Yes is my answer...', 15, 0, 100, 0, 0, 0, '', 21243),
+(23224, 0, @COUNT := @COUNT + 1, '...NOT!', 15, 0, 100, 0, 0, 0, '', 21244),
+(23224, 0, @COUNT := @COUNT + 1, 'I\'m gonna have to give this one the big N-O.', 15, 0, 100, 0, 0, 0, '', 21245),
+(23224, 0, @COUNT := @COUNT + 1, 'The outlook is very bad - for YOU that is! Haha, take it!', 15, 0, 100, 0, 0, 0, '', 21246),
+(23224, 0, @COUNT := @COUNT + 1, 'Survey says: BZZZT!', 15, 0, 100, 0, 0, 0, '', 21247);
+
+DELETE FROM spell_linked_spell WHERE spell_trigger=40527 AND spell_effect=40528;
+INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
+(40527, 40528, 0, 'Imp in a Bottle');
diff --git a/sql/updates/world/2014_06_06_00_world_quest_template.sql b/sql/updates/world/2014_06_06_00_world_quest_template.sql
new file mode 100644
index 00000000000..6d174f9a7b0
--- /dev/null
+++ b/sql/updates/world/2014_06_06_00_world_quest_template.sql
@@ -0,0 +1,4 @@
+--
+UPDATE `quest_template` SET `RequestItemsText` = 'Supposedly this Malcin is outside Razorfen Downs. There''s no question - he has to die.$b$bMy contacts in Orgrimmar tell me their scouts have found signs of the Plague down there. The quilboar are showing signs of being plagued, too; they''re much more powerful. Whatever the Scourge are doing down there needs to end. Now.$b$bFind this Malcin and kill him. Report back here when he''s dead.' WHERE `id` = 14353;
+UPDATE `quest_template` SET `OfferRewardText` = 'Good work, $C!$b$bYou''ve done the Horde proud by stopping the Scourge from setting down roots on our soil. An act like that deserves a reward, and the Forsaken have enough lying around that I''m sure they can spare a few things.$b$bWe may not know everything they''ve done in the Downs, but we''ll find out. They can''t slink around in the dark forever.' WHERE `id` = 14353;
+UPDATE `quest_template` SET `OfferRewardText` = 'I''m sure Sylvanas will be glad to have that problem taken care of, $N. The task I gave you wasn''t easy, but here you stand, victorious. That commands respect, and what you''ve done won''t be forgotten.' WHERE `id` = 14355;
diff --git a/sql/updates/world/2014_06_07_00_world_misc.sql b/sql/updates/world/2014_06_07_00_world_misc.sql
new file mode 100644
index 00000000000..ff09f8f552e
--- /dev/null
+++ b/sql/updates/world/2014_06_07_00_world_misc.sql
@@ -0,0 +1,31 @@
+UPDATE `creature_template` SET `gossip_menu_id`=3310 WHERE `entry`=11216;
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id` in(3310,3309,3308,3307,3306,3305,3304,3303,3302,3301);
+INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
+(3310, 0, 0, 'The pleasure is mine, madam. Might I ask what it is that you are doing here?', 6645, 1, 1, 3309, 0, 0, 0, '', 0),
+(3310, 1, 0, 'Eva, I have lost the Spectral Essence. I need another.', 6799, 1, 1, 0, 0, 0, 0, '', 0),
+(3309, 0, 0, 'Until what, Eva? I must know.', 6647, 1, 1, 3308, 0, 0, 0, '', 0),
+(3308, 0, 0, 'What do you mean?', 6649, 1, 1, 3307, 0, 0, 0, '', 0),
+(3307, 0, 0, 'Why didn''t you just leave?', 6651, 1, 1, 3306, 0, 0, 0, '', 0),
+(3306, 0, 0, 'So what happened?', 6653, 1, 1, 3305, 0, 0, 0, '', 0),
+(3305, 0, 0, 'No restraints? Just a circle?', 6655, 1, 1, 3304, 0, 0, 0, '', 0),
+(3304, 0, 0, 'Tell me more', 6657, 1, 1, 3303, 0, 0, 0, '', 0),
+(3303, 0, 0, 'This is an atrocity.', 6659, 1, 1, 3302, 0, 0, 0, '', 0),
+(3302, 0, 0, 'I feel sick', 6661, 1, 1, 3301, 0, 0, 0, '', 0),
+(3301, 0, 0, 'What can I do to help?', 45678, 1, 1, 0, 0, 0, 0, '', 0);
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (3310);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(15, 3310, 0, 0, 0, 8, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not rewarded'),
+(15, 3310, 0, 0, 0, 9, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not taken'),
+(15, 3310, 0, 0, 0, 28, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not complete'),
+(15, 3310, 1, 0, 0, 8, 0, 5384, 0, 0, 0, 0, 0, '', 'Gossip Option requires Kirtonos the Herald Rewarded'),
+(15, 3310, 1, 0, 0, 2, 0, 13544, 1, 0, 1, 0, 0, '', 'Gossip Option requires Player does not have Spectral Essence');
+
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (11216);
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN(11216) AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(11216,0,0,1,62,0,100,0,3310,1,0,0,85,17672,2,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - On Gossip Option 1 Selected - Cast Summon Spectral Essence'),
+(11216,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - Link - Close Gossip'),
+(11216,0,3,4,62,0,100,0,3301,0,0,0,7,5382,0,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - On Gossip Option 0 Selected - Add Quest Doctor Theolen Krastinov, the Butcher'),
+(11216,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - Link - Close Gossip');
diff --git a/sql/updates/world/2014_06_08_00_world_conditions.sql b/sql/updates/world/2014_06_08_00_world_conditions.sql
new file mode 100644
index 00000000000..a0a885d5def
--- /dev/null
+++ b/sql/updates/world/2014_06_08_00_world_conditions.sql
@@ -0,0 +1 @@
+UPDATE `conditions` SET `ConditionTypeOrReference`=2,`ConditionValue2`=1,`NegativeCondition`=1 WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9422 AND `ConditionTypeOrReference`=26 AND `ConditionValue1`=36734;
diff --git a/sql/updates/world/2014_06_08_01_world_gameobject.sql b/sql/updates/world/2014_06_08_01_world_gameobject.sql
new file mode 100644
index 00000000000..844d32ed393
--- /dev/null
+++ b/sql/updates/world/2014_06_08_01_world_gameobject.sql
@@ -0,0 +1,17 @@
+UPDATE `gameobject` SET `phaseMask`=1 WHERE `id` IN (192161, 192162);
+UPDATE `gameobject` SET `phaseMask`=9 WHERE `id`=193985;
+UPDATE `gameobject` SET `phaseMask`=12 WHERE `id` IN (190791, 190792, 190793, 190919, 190920, 190921, 190922, 190923, 190924, 190925, 190926, 190927, 190928, 190929);
+UPDATE `gameobject` SET `phaseMask`=19 WHERE `id` IN (190799, 190859, 190860, 190861, 190862, 190863, 190864, 190865, 190866, 190867, 190868, 190869, 190870, 190871, 190872, 190873, 190874, 190875, 190876, 190877, 190878, 190879, 190880, 190881, 190882, 190883, 190884, 190885, 190886, 190887, 190888, 190889, 190890, 190891, 190892, 190893, 190898, 190899, 190900, 190901, 190902, 190903, 190904, 190905, 190906, 190907, 190908, 190909, 190910, 190911, 190930, 190931, 190932, 190933, 190934);
+UPDATE `gameobject` SET `phaseMask`=32 WHERE `id` IN (192273, 192274, 192406, 192407, 192416, 192417, 192418, 192433);
+UPDATE `gameobject` SET `phaseMask`=35 WHERE `id` IN (190800, 191166, 191167, 191169, 191171, 191172, 191173, 191178, 191191);
+UPDATE `gameobject` SET `phaseMask`=51 WHERE `id`=190789;
+UPDATE `gameobject` SET `phaseMask`=64 WHERE `id` IN (192269, 192277, 192278, 192414, 192429, 193110, 193111, 193112, 193113, 193114, 193115, 193116, 193117, 193118, 193119, 193120, 193121, 193122, 193123);
+UPDATE `gameobject` SET `phaseMask`=66 WHERE `id`=192579;
+UPDATE `gameobject` SET `phaseMask`=128 WHERE `id` IN (191261, 191262, 191263, 191264, 191265, 191266, 191267, 191268, 191269, 191270, 191271);
+UPDATE `gameobject` SET `phaseMask`=129 WHERE `id` IN (192575, 192578);
+UPDATE `gameobject` SET `phaseMask`=193 WHERE `id` IN (192576, 192577);
+UPDATE `gameobject` SET `phaseMask`=198 WHERE `id` IN (192934, 192935, 192936, 192937, 192938, 192953, 192954, 192955, 192956, 192957, 192981);
+UPDATE `gameobject` SET `phaseMask`=204 WHERE `id` IN (190801, 190802, 190804, 190805, 190806, 190807, 190808, 190809, 190810, 190811, 190812, 190813, 190814, 190815, 190894, 190895, 190896, 190912, 190913, 190935, 191165, 191168, 191170, 191174, 191175, 191176, 191177, 191190);
+UPDATE `gameobject` SET `phaseMask`=257 WHERE `id`=192038;
+UPDATE `gameobject` SET `phaseMask`=510 WHERE `id` IN (192958, 192959, 192960, 192961, 192962, 192963, 192964, 192965, 192966, 192967, 192968, 192969, 192970, 192971, 192972, 192973, 192974, 192975, 192976, 192977, 192978, 192979, 192980, 192982, 192983, 192985, 192986, 192987, 192988, 192989, 192990, 192991, 192992, 192993, 192994, 192995, 192996, 192997, 192999, 193000, 193001, 193002);
+UPDATE `gameobject` SET `phaseMask`=511 WHERE `id` IN (192522, 192787);
diff --git a/sql/updates/world/2014_06_08_02_world_gameobject.sql b/sql/updates/world/2014_06_08_02_world_gameobject.sql
new file mode 100644
index 00000000000..5b5bfa9a90c
--- /dev/null
+++ b/sql/updates/world/2014_06_08_02_world_gameobject.sql
@@ -0,0 +1,40 @@
+SET @OGUID := 75166;
+
+DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+28;
+INSERT INTO `gameobject` (`guid`, `id`, `map`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`) VALUES
+(@OGUID+0, 192252, 571, 128, 5154.37, 2853.23, 409.183, 3.14159, 0, 0, 1, 0), -- Alliance Banner
+(@OGUID+1, 192253, 571, 128, 5154.42, 2828.93, 409.189, 3.14159, 0, 0, 1, 0), -- Alliance Banner
+(@OGUID+2, 192266, 571, 64, 4452.8, 2639, 358.552, 1.4748, 0, 0, -0.672366, 0.740219), -- Alliance Banner
+(@OGUID+3, 192267, 571, 128, 4452.76, 2639.14, 358.444, 1.67552, 0, 0, 0.743145, 0.66913), -- Horde Banner
+(@OGUID+4, 192268, 571, 128, 4526.51, 2810.18, 390.986, 3.26377, 0, 0, 0.998135, -0.061049), -- Horde Banner
+(@OGUID+5, 192270, 571, 64, 4424.71, 2975.6, 367.387, 1.69297, 0, 0, 0.748955, 0.662621), -- Alliance Banner
+(@OGUID+6, 192271, 571, 128, 4424.74, 2975.6, 367.227, 1.7017, 0, 0, 0.75184, 0.659346), -- Horde Banner
+(@OGUID+7, 192272, 571, 16, 4417.93, 2324.81, 371.219, 3.09796, 0, 0, 0.999762, 0.021815), -- Horde Banner
+(@OGUID+8, 192275, 571, 16, 4424.03, 3286.61, 371.418, 3.14159, 0, 0, 1, 0), -- Horde Banner
+(@OGUID+9, 192276, 571, 128, 4572.94, 3475.42, 362.805, 1.37881, 0, 0, 0.636078, 0.771625), -- Horde Banner
+(@OGUID+10, 192279, 571, 128, 4433.92, 3534.2, 359.942, 1.91113, 0, 0, -0.816641, 0.577146), -- Horde Banner
+(@OGUID+11, 192408, 571, 16, 4399.64, 3231.54, 368.898, 1.49226, 0, 0, 0.678801, 0.734322), -- Horde Banner
+(@OGUID+12, 192409, 571, 32, 4399.59, 3231.43, 369.216, 1.67552, 0, 0, -0.743145, 0.66913), -- Alliance Banner
+(@OGUID+13, 192415, 571, 64, 4517.79, 2716.99, 387.57, 1.53589, 0, 0, -0.694658, 0.71934), -- Alliance Banner
+(@OGUID+14, 192423, 571, 64, 4563.73, 2171.15, 367.68, 1.30027, 0, 0, 0.605294, 0.796002), -- Alliance Banner
+(@OGUID+15, 192424, 571, 128, 4563.7, 2171.03, 367.607, 1.82387, 0, 0, -0.79069, 0.612217), -- Horde Banner
+(@OGUID+16, 192430, 571, 64, 4434.56, 2883.45, 406.025, 0.759216, 0, 0, 0.370557, 0.92881), -- Alliance Banner
+(@OGUID+17, 192431, 571, 64, 4349.9, 2885.56, 406.105, 1.6057, 0, 0, 0.71934, 0.694658), -- Alliance Banner
+(@OGUID+18, 192432, 571, 16, 4401.62, 3377.48, 363.12, 1.53589, 0, 0, 0.694658, 0.71934), -- Horde Banner
+(@OGUID+19, 192440, 571, 128, 4438.38, 3361.01, 371.814, 0.0348707, 0, 0, -0.017452, 0.999848), -- Horde Banner
+(@OGUID+20, 192441, 571, 16, 4448.15, 3235.61, 370.617, 1.56207, 0, 0, -0.704015, 0.710185), -- Horde Banner
+(@OGUID+21, 192442, 571, 128, 4350.04, 2885.61, 406.329, 1.58825, 0, 0, 0.713251, 0.700909), -- Horde Banner
+(@OGUID+22, 192443, 571, 128, 4434.33, 2883.24, 406.346, 0.767944, 0, 0, 0.374607, 0.927184), -- Horde Banner
+(@OGUID+23, 192444, 571, 128, 4464.17, 2855.32, 406.391, 0.802851, 0, 0, 0.390731, 0.920505), -- Horde Banner
+(@OGUID+24, 192449, 571, 128, 4517.75, 2717.23, 387.812, 1.53589, 0, 0, -0.694658, 0.71934), -- Horde Banner
+(@OGUID+25, 192450, 571, 128, 4387.59, 2719.9, 390.201, 1.51843, 0, 0, -0.688354, 0.725375), -- Horde Banner
+(@OGUID+26, 192451, 571, 16, 4408.65, 2422.67, 377.454, 1.58825, 0, 0, 0.713251, 0.700909), -- Horde Banner
+(@OGUID+27, 192452, 571, 128, 4416.8, 2414.04, 377.487, 0.00895035, 0, 0, 0.004363, 0.99999), -- Horde Banner
+(@OGUID+28, 192453, 571, 16, 4417.56, 2301.07, 377.43, 0.017442, 0, 0, 0.008727, 0.999962); -- Horde Banner
+
+
+UPDATE `gameobject` SET `position_x`=4526.46, `position_y`=2810.18, `position_z`=391.2, `orientation`=3.28995 WHERE `id`=192269; -- Horde Banner
+UPDATE `gameobject` SET `position_x`=4991.04, `position_y`=2525.72, `position_z`=340.366, `orientation`=4.04916 WHERE `id`=192290; -- Horde Banner
+UPDATE `gameobject` SET `position_x`=4991.08, `position_y`=2525.76, `position_z`=340.918, `orientation`=4.04044 WHERE `id`=192291; -- Alliance Banner
+UPDATE `gameobject` SET `position_x`=5352.15, `position_y`=3054.77, `position_z`=444.61, `orientation`=1.57952 WHERE `id`=192376; -- Horde Banner
+UPDATE `gameobject` SET `position_x`=4408.57, `position_y`=2422.61, `position_z`=377.179, `orientation`=1.58825 WHERE `id`=192416; -- Alliance Banner
diff --git a/sql/updates/world/2014_06_08_03_world_gameobject.sql b/sql/updates/world/2014_06_08_03_world_gameobject.sql
new file mode 100644
index 00000000000..8fe57fa39b5
--- /dev/null
+++ b/sql/updates/world/2014_06_08_03_world_gameobject.sql
@@ -0,0 +1 @@
+DELETE FROM `gameobject` WHERE `guid` IN (66459, 66460, 66461, 66462, 66463, 66464, 66465, 66466, 66467, 66468, 66469, 66470, 66478, 66479, 66516, 66518, 66520, 66600, 66601, 66602, 66603, 66604, 66605, 66606, 66607, 66608, 66609, 66610, 74688, 74690, 74696, 74698, 74702, 74704, 74706, 74712, 74714, 74720, 74722, 74724, 74726, 74728, 74730, 74732, 74734, 74736, 74738, 74740, 74742, 74744, 74746, 74748, 74750, 74752, 74754, 74756, 74758, 74760, 74762, 74764, 74766, 74768, 74770, 74772);
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
index bb278dd6653..55517884b8e 100644
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ b/src/server/authserver/Authentication/AuthCodes.cpp
@@ -79,4 +79,4 @@ namespace AuthHelper
return NULL;
}
-};
+}
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
index 5e6522f8981..97b4779da0e 100644
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ b/src/server/authserver/Authentication/AuthCodes.h
@@ -92,6 +92,6 @@ namespace AuthHelper
bool IsAcceptedClientBuild(int build);
bool IsPostBCAcceptedClientBuild(int build);
bool IsPreBCAcceptedClientBuild(int build);
-};
+}
#endif
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index d1b2b614037..be6623c7fa3 100644
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -179,24 +179,24 @@ extern int main(int argc, char** argv)
Handler.register_handler(SIGTERM, &SignalTERM);
#if defined(_WIN32) || defined(__linux__)
-
+
///- Handle affinity for multiple processors and process priority
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
#ifdef _WIN32 // Windows
-
+
HANDLE hProcess = GetCurrentProcess();
if (affinity > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
-
+
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
// remove non accessible processors
ULONG_PTR currentAffinity = affinity & appAff;
-
+
if (!currentAffinity)
TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff);
else if (SetProcessAffinityMask(hProcess, currentAffinity))
@@ -205,7 +205,7 @@ extern int main(int argc, char** argv)
TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity);
}
}
-
+
if (highPriority)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
@@ -213,9 +213,9 @@ extern int main(int argc, char** argv)
else
TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class.");
}
-
+
#else // Linux
-
+
if (affinity > 0)
{
cpu_set_t mask;
@@ -242,7 +242,7 @@ extern int main(int argc, char** argv)
else
TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
}
-
+
#endif
#endif
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index bb57079c389..d592d795125 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -157,8 +157,7 @@ namespace VMAP
{
float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe
- if (maxDist == std::numeric_limits<float>::max() ||
- maxDist == std::numeric_limits<float>::infinity())
+ if (maxDist == std::numeric_limits<float>::max() || !std::isfinite(maxDist))
return false;
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 1b99e282132..de97943bb37 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -140,6 +140,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
}
#endif
+ owner = &go;
return true;
}
@@ -161,7 +162,7 @@ GameObjectModel* GameObjectModel::Create(const GameObject& go)
bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const
{
- if (!(phasemask & ph_mask))
+ if (!(phasemask & ph_mask) || !owner->isSpawned())
return false;
float time = ray.intersectionTime(iBound);
diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h
index 6088b924343..99c9b1337b3 100644
--- a/src/server/collision/Models/GameObjectModel.h
+++ b/src/server/collision/Models/GameObjectModel.h
@@ -44,8 +44,9 @@ class GameObjectModel /*, public Intersectable*/
float iInvScale;
float iScale;
VMAP::WorldModel* iModel;
+ GameObject const* owner;
- GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL) { }
+ GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL), owner(NULL) { }
bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info);
public:
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index e2eeaf880ad..7c640f9a66d 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -89,7 +89,8 @@ void PetAI::UpdateAI(uint32 diff)
if (me->GetVictim() && me->EnsureVictim()->IsAlive())
{
// is only necessary to stop casting, the pet must not exit combat
- if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me))
+ if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL) && // ignore channeled spells (Pin, Seduction)
+ me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;
@@ -459,9 +460,6 @@ void PetAI::DoAttack(Unit* target, bool chase)
if (me->Attack(target, true))
{
- if (Unit* owner = me->GetOwner())
- owner->SetInCombatWith(target);
-
// Play sound to let the player know the pet is attacking something it picked on its own
if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
me->SendPetAIReaction(me->GetGUID());
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 9631b75fe06..cb32740e068 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -103,7 +103,7 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetTypeId() == TYPEID_PLAYER)
me->AddAura(spellid, unit);
}
@@ -117,7 +117,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetTypeId() == TYPEID_PLAYER)
me->CastSpell(unit, spellid, triggered);
}
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index dd8b42deb9f..ac9de00cd10 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -43,6 +43,11 @@ void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= NULL*/)
sCreatureTextMgr->SendChat(me, id, whisperTarget);
}
+void CreatureAI::TalkToMap(uint8 id, WorldObject const* whisperTarget /*= NULL*/)
+{
+ sCreatureTextMgr->SendChat(me, id, whisperTarget, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
+}
+
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/)
{
if (!creature)
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 6357ac33f1e..209995d359d 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -79,6 +79,7 @@ class CreatureAI : public UnitAI
public:
void Talk(uint8 id, WorldObject const* whisperTarget = NULL);
+ void TalkToMap(uint8 id, WorldObject const* whisperTarget = NULL);
explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { }
virtual ~CreatureAI() { }
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index 7447e290ba9..838171a544e 100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -311,359 +311,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c
}
}
-class EventMap
-{
- /**
- * Internal storage type.
- * Key: Time as uint32 when the event should occur.
- * Value: The event data as uint32.
- *
- * Structure of event data:
- * - Bit 0 - 15: Event Id.
- * - Bit 16 - 23: Group
- * - Bit 24 - 31: Phase
- * - Pattern: 0xPPGGEEEE
- */
- typedef std::multimap<uint32, uint32> EventStore;
-
- public:
- EventMap() : _time(0), _phase(0) { }
-
- /**
- * @name Reset
- * @brief Removes all scheduled events and resets time and phase.
- */
- void Reset()
- {
- _eventMap.clear();
- _time = 0;
- _phase = 0;
- }
-
- /**
- * @name Update
- * @brief Updates the timer of the event map.
- * @param time Value to be added to time.
- */
- void Update(uint32 time)
- {
- _time += time;
- }
-
- /**
- * @name GetTimer
- * @return Current timer value.
- */
- uint32 GetTimer() const
- {
- return _time;
- }
-
- /**
- * @name GetPhaseMask
- * @return Active phases as mask.
- */
- uint8 GetPhaseMask() const
- {
- return _phase;
- }
-
- /**
- * @name Empty
- * @return True, if there are no events scheduled.
- */
- bool Empty() const
- {
- return _eventMap.empty();
- }
-
- /**
- * @name SetPhase
- * @brief Sets the phase of the map (absolute).
- * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
- */
- void SetPhase(uint8 phase)
- {
- if (!phase)
- _phase = 0;
- else if (phase <= 8)
- _phase = (1 << (phase - 1));
- }
-
- /**
- * @name AddPhase
- * @brief Activates the given phase (bitwise).
- * @param phase Phase which should be activated. Values: 1 - 8
- */
- void AddPhase(uint8 phase)
- {
- if (phase && phase <= 8)
- _phase |= (1 << (phase - 1));
- }
-
- /**
- * @name RemovePhase
- * @brief Deactivates the given phase (bitwise).
- * @param phase Phase which should be deactivated. Values: 1 - 8.
- */
- void RemovePhase(uint8 phase)
- {
- if (phase && phase <= 8)
- _phase &= ~(1 << (phase - 1));
- }
-
- /**
- * @name ScheduleEvent
- * @brief Creates new event entry in map.
- * @param eventId The id of the new event.
- * @param time The time in milliseconds until the event occurs.
- * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
- * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
- */
- void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
- {
- if (group && group <= 8)
- eventId |= (1 << (group + 15));
-
- if (phase && phase <= 8)
- eventId |= (1 << (phase + 23));
-
- _eventMap.insert(EventStore::value_type(_time + time, eventId));
- }
-
- /**
- * @name RescheduleEvent
- * @brief Cancels the given event and reschedules it.
- * @param eventId The id of the event.
- * @param time The time in milliseconds until the event occurs.
- * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
- * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
- */
- void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
- {
- CancelEvent(eventId);
- ScheduleEvent(eventId, time, group, phase);
- }
-
- /**
- * @name RepeatEvent
- * @brief Cancels the closest event and reschedules it.
- * @param time Time until the event occurs.
- */
- void RepeatEvent(uint32 time)
- {
- if (Empty())
- return;
-
- uint32 eventId = _eventMap.begin()->second;
- _eventMap.erase(_eventMap.begin());
- ScheduleEvent(eventId, time);
- }
-
- /**
- * @name PopEvent
- * @brief Remove the first event in the map.
- */
- void PopEvent()
- {
- if (!Empty())
- _eventMap.erase(_eventMap.begin());
- }
-
- /**
- * @name ExecuteEvent
- * @brief Returns the next event to execute and removes it from map.
- * @return Id of the event to execute.
- */
- uint32 ExecuteEvent()
- {
- while (!Empty())
- {
- EventStore::iterator itr = _eventMap.begin();
-
- if (itr->first > _time)
- return 0;
- else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
- _eventMap.erase(itr);
- else
- {
- uint32 eventId = (itr->second & 0x0000FFFF);
- _eventMap.erase(itr);
- return eventId;
- }
- }
-
- return 0;
- }
-
- /**
- * @name GetEvent
- * @brief Returns the next event to execute.
- * @return Id of the event to execute.
- */
- uint32 GetEvent()
- {
- while (!Empty())
- {
- EventStore::iterator itr = _eventMap.begin();
-
- if (itr->first > _time)
- return 0;
- else if (_phase && (itr->second & 0xFF000000) && !(itr->second & (_phase << 24)))
- _eventMap.erase(itr);
- else
- return (itr->second & 0x0000FFFF);
- }
-
- return 0;
- }
-
- /**
- * @name DelayEvents
- * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
- * @param delay Amount of delay.
- */
- void DelayEvents(uint32 delay)
- {
- _time = delay < _time ? _time - delay : 0;
- }
-
- /**
- * @name DelayEvents
- * @brief Delay all events of the same group.
- * @param delay Amount of delay.
- * @param group Group of the events.
- */
- void DelayEvents(uint32 delay, uint32 group)
- {
- if (!group || group > 8 || Empty())
- return;
-
- EventStore delayed;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (itr->second & (1 << (group + 15)))
- {
- delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
- _eventMap.erase(itr++);
- }
- else
- ++itr;
- }
-
- _eventMap.insert(delayed.begin(), delayed.end());
- }
-
- /**
- * @name CancelEvent
- * @brief Cancels all events of the specified id.
- * @param eventId Event id to cancel.
- */
- void CancelEvent(uint32 eventId)
- {
- if (Empty())
- return;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (eventId == (itr->second & 0x0000FFFF))
- _eventMap.erase(itr++);
- else
- ++itr;
- }
- }
-
- /**
- * @name CancelEventGroup
- * @brief Cancel events belonging to specified group.
- * @param group Group to cancel.
- */
- void CancelEventGroup(uint32 group)
- {
- if (!group || group > 8 || Empty())
- return;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (itr->second & (1 << (group + 15)))
- _eventMap.erase(itr++);
- else
- ++itr;
- }
- }
-
- /**
- * @name GetNextEventTime
- * @brief Returns closest occurence of specified event.
- * @param eventId Wanted event id.
- * @return Time of found event.
- */
- uint32 GetNextEventTime(uint32 eventId) const
- {
- if (Empty())
- return 0;
-
- for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
- if (eventId == (itr->second & 0x0000FFFF))
- return itr->first;
-
- return 0;
- }
-
- /**
- * @name GetNextEventTime
- * @return Time of next event.
- */
- uint32 GetNextEventTime() const
- {
- return Empty() ? 0 : _eventMap.begin()->first;
- }
-
- /**
- * @name IsInPhase
- * @brief Returns wether event map is in specified phase or not.
- * @param phase Wanted phase.
- * @return True, if phase of event map contains specified phase.
- */
- bool IsInPhase(uint8 phase)
- {
- return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
- }
-
- private:
- /**
- * @name _time
- * @brief Internal timer.
- *
- * This does not represent the real date/time value.
- * It's more like a stopwatch: It can run, it can be stopped,
- * it can be resetted and so on. Events occur when this timer
- * has reached their time value. Its value is changed in the
- * Update method.
- */
- uint32 _time;
-
- /**
- * @name _phase
- * @brief Phase mask of the event map.
- *
- * Contains the phases the event map is in. Multiple
- * phases from 1 to 8 can be set with SetPhase or
- * AddPhase. RemovePhase deactives a phase.
- */
- uint8 _phase;
-
- /**
- * @name _eventMap
- * @brief Internal event storage map. Contains the scheduled events.
- *
- * See typedef at the beginning of the class for more
- * details.
- */
- EventStore _eventMap;
-};
-
enum AITarget
{
AITARGET_SELF,
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index c205dd908c7..06820b03218 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -37,7 +37,7 @@ void SummonList::DoZoneInCombat(uint32 entry)
{
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
{
- Creature* summon = Unit::GetCreature(*me, *i);
+ Creature* summon = ObjectAccessor::GetCreature(*me, *i);
++i;
if (summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
@@ -51,7 +51,7 @@ void SummonList::DespawnEntry(uint32 entry)
{
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
{
- Creature* summon = Unit::GetCreature(*me, *i);
+ Creature* summon = ObjectAccessor::GetCreature(*me, *i);
if (!summon)
i = storage_.erase(i);
else if (summon->GetEntry() == entry)
@@ -68,7 +68,7 @@ void SummonList::DespawnAll()
{
while (!storage_.empty())
{
- Creature* summon = Unit::GetCreature(*me, storage_.front());
+ Creature* summon = ObjectAccessor::GetCreature(*me, storage_.front());
storage_.pop_front();
if (summon)
summon->DespawnOrUnsummon();
@@ -79,7 +79,7 @@ void SummonList::RemoveNotExisting()
{
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
{
- if (Unit::GetCreature(*me, *i))
+ if (ObjectAccessor::GetCreature(*me, *i))
++i;
else
i = storage_.erase(i);
@@ -90,7 +90,7 @@ bool SummonList::HasEntry(uint32 entry) const
{
for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i)
{
- Creature* summon = Unit::GetCreature(*me, *i);
+ Creature* summon = ObjectAccessor::GetCreature(*me, *i);
if (summon && summon->GetEntry() == entry)
return true;
}
@@ -271,7 +271,7 @@ void ScriptedAI::DoResetThreat()
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index cee6ba3c379..c9f7f342183 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -98,7 +98,7 @@ public:
Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); )
{
- Creature* summon = Unit::GetCreature(*me, *i++);
+ Creature* summon = ObjectAccessor::GetCreature(*me, *i++);
if (summon && summon->IsAIEnabled)
summon->AI()->DoAction(info);
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 098f3130fed..ecaa20284d7 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -437,8 +437,11 @@ void SmartAI::EnterEvadeMode()
}
else if (mFollowGuid)
{
- if (Unit* target = me->GetUnit(*me, mFollowGuid))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
+
+ // evade is not cleared in MoveFollow, so we can't keep it
+ me->ClearUnitState(UNIT_STATE_EVADE);
}
else
me->GetMotionMaster()->MoveTargetedHome();
@@ -618,10 +621,7 @@ void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
if (mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
- {
- damage = 0;
- me->SetHealth(mInvincibilityHpLevel);
- }
+ damage = me->GetHealth() - mInvincibilityHpLevel; // damage should not be nullified, because of player damage req.
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index dff9ddbaf2f..2647368559c 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -429,7 +429,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
{
- if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
{
me->getThreatManager().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i",
@@ -2602,7 +2602,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
- if (Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
l->push_back(temp);
}
break;
@@ -3462,16 +3462,10 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
void SmartScript::OnMoveInLineOfSight(Unit* who)
{
- ProcessEventsFor(SMART_EVENT_OOC_LOS, who);
-
if (!me)
return;
- if (me->GetVictim())
- return;
-
- ProcessEventsFor(SMART_EVENT_IC_LOS, who);
-
+ ProcessEventsFor(me->IsInCombat() ? SMART_EVENT_IC_LOS : SMART_EVENT_OOC_LOS, who);
}
/*
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index d8f61a22314..773e169e5c2 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -517,7 +517,7 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea
return false;
}
- rbac::RBACData rbac(accountId, "", realmId);
+ rbac::RBACData rbac(accountId, "", realmId, GetSecurity(accountId));
rbac.LoadFromDB();
bool hasPermission = rbac.HasPermission(permissionId);
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 96f13dcd0ac..3f9c6cf0617 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -54,7 +54,7 @@ Battlefield::Battlefield()
m_uiKickAfkPlayersTimer = 1000;
- m_LastResurectTimer = 30 * IN_MILLISECONDS;
+ m_LastResurrectTimer = 30 * IN_MILLISECONDS;
m_StartGroupingTimer = 0;
m_StartGrouping = false;
StalkerGuid = 0;
@@ -184,15 +184,15 @@ bool Battlefield::Update(uint32 diff)
}
- if (m_LastResurectTimer <= diff)
+ if (m_LastResurrectTimer <= diff)
{
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
if (GetGraveyardById(i))
m_GraveyardList[i]->Resurrect();
- m_LastResurectTimer = RESURRECTION_INTERVAL;
+ m_LastResurrectTimer = RESURRECTION_INTERVAL;
}
else
- m_LastResurectTimer -= diff;
+ m_LastResurrectTimer -= diff;
return objective_changed;
}
@@ -632,7 +632,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
- uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
+ uint32 time = m_LastResurrectTimer; // resurrect every 30 seconds
data << guid << time;
ASSERT(player && player->GetSession());
@@ -711,7 +711,7 @@ void BfGraveyard::Resurrect()
if (Creature* spirit = m_Bf->GetCreature(m_SpiritGuide[m_ControlTeam]))
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
- // Resurect player
+ // Resurrect player
player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
player->ResurrectPlayer(1.0f);
player->CastSpell(player, 6962, true);
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 6c9e653c510..296c48b0697 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -173,7 +173,7 @@ class BfGraveyard
// Check if this graveyard has a spirit guide
bool HasNpc(uint64 guid);
- // Check if a player is in this graveyard's ressurect queue
+ // Check if a player is in this graveyard's resurrect queue
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
// Get the graveyard's ID.
@@ -383,7 +383,7 @@ class Battlefield : public ZoneScript
// Graveyard variables
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
- uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
+ uint32 m_LastResurrectTimer; // Timer for resurrect player every 30 sec
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
bool m_StartGrouping; // bool for know if all players in area has been invited
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 97320373e16..ca48ffb3a14 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -269,7 +269,7 @@ void Battleground::Update(uint32 diff)
}
else
{
- _ProcessRessurect(diff);
+ _ProcessResurrect(diff);
if (sBattlegroundMgr->GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
_ProcessProgress(diff);
else if (m_PrematureCountDown)
@@ -334,10 +334,10 @@ inline void Battleground::_ProcessOfflineQueue()
}
}
-inline void Battleground::_ProcessRessurect(uint32 diff)
+inline void Battleground::_ProcessResurrect(uint32 diff)
{
// *********************************************************
- // *** BATTLEGROUND RESSURECTION SYSTEM ***
+ // *** BATTLEGROUND RESURRECTION SYSTEM ***
// *********************************************************
// this should be handled by spell system
m_LastResurrectTime += diff;
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 2cbf8bd0918..4256e2fc094 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -556,7 +556,7 @@ class Battleground
Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const;
void _ProcessOfflineQueue();
- void _ProcessRessurect(uint32 diff);
+ void _ProcessResurrect(uint32 diff);
void _ProcessProgress(uint32 diff);
void _ProcessLeave(uint32 diff);
void _ProcessJoin(uint32 diff);
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 52ed50f3948..a4cb972e625 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -17,7 +17,6 @@
#include "CalendarMgr.h"
#include "QueryResult.h"
-#include "DatabaseEnv.h"
#include "Log.h"
#include "Player.h"
#include "GuildMgr.h"
@@ -128,6 +127,12 @@ void CalendarMgr::AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType s
void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite)
{
+ SQLTransaction dummy;
+ AddInvite(calendarEvent, invite, dummy);
+}
+
+void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans)
+{
if (!calendarEvent->IsGuildAnnouncement())
SendCalendarEventInvite(*invite);
@@ -137,7 +142,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite
if (!calendarEvent->IsGuildAnnouncement())
{
_invites[invite->GetEventId()].push_back(invite);
- UpdateInvite(invite);
+ UpdateInvite(invite, trans);
}
}
@@ -221,7 +226,6 @@ void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover
void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
{
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
stmt->setUInt64(0, calendarEvent->GetEventId());
stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
@@ -232,13 +236,17 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
stmt->setUInt32(6, uint32(calendarEvent->GetEventTime()));
stmt->setUInt32(7, calendarEvent->GetFlags());
stmt->setUInt32(8, calendarEvent->GetTimeZoneTime()); // correct?
- trans->Append(stmt);
- CharacterDatabase.CommitTransaction(trans);
+ CharacterDatabase.Execute(stmt);
}
void CalendarMgr::UpdateInvite(CalendarInvite* invite)
{
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ SQLTransaction dummy;
+ UpdateInvite(invite, dummy);
+}
+
+void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
+{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE);
stmt->setUInt64(0, invite->GetInviteId());
stmt->setUInt64(1, invite->GetEventId());
@@ -248,8 +256,7 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite)
stmt->setUInt32(5, uint32(invite->GetStatusTime()));
stmt->setUInt8(6, invite->GetRank());
stmt->setString(7, invite->GetText());
- trans->Append(stmt);
- CharacterDatabase.CommitTransaction(trans);
+ CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h
index da185d519d5..8f44b013e5c 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -20,6 +20,7 @@
#include <ace/Singleton.h>
#include "Common.h"
+#include "DatabaseEnv.h"
#include "WorldPacket.h"
enum CalendarMailAnswers
@@ -305,8 +306,10 @@ class CalendarMgr
void UpdateEvent(CalendarEvent* calendarEvent);
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
+ void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
void UpdateInvite(CalendarInvite* invite);
+ void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
void RemoveAllPlayerEventsAndInvites(uint64 guid);
void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 9ad6877d929..115e340762e 100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -25,7 +25,7 @@
#include "Common.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
#include "WorldPacket.h"
class Player;
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 9b0465a4536..44f03b6978d 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -139,6 +139,7 @@ DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt);
DBCStorage <OverrideSpellDataEntry> sOverrideSpellDataStore(OverrideSpellDatafmt);
+DBCStorage <PowerDisplayEntry> sPowerDisplayStore(PowerDisplayfmt);
DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt);
DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt);
@@ -391,6 +392,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sOverrideSpellDataStore, dbcPath, "OverrideSpellData.dbc");
+ LoadDBC(availableDbcLocales, bad_dbc_files, sPowerDisplayStore, dbcPath, "PowerDisplay.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc");
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index b77db950541..fe775dfda19 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -141,6 +141,7 @@ extern DBCStorage <MapEntry> sMapStore;
extern MapDifficultyMap sMapDifficultyMap;
extern DBCStorage <MovieEntry> sMovieStore;
extern DBCStorage <OverrideSpellDataEntry> sOverrideSpellDataStore;
+extern DBCStorage <PowerDisplayEntry> sPowerDisplayStore;
extern DBCStorage <QuestSortEntry> sQuestSortStore;
extern DBCStorage <QuestXPEntry> sQuestXPStore;
extern DBCStorage <QuestFactionRewEntry> sQuestFactionRewardStore;
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index abe7bde4bf5..5d6c8c7aa89 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1398,6 +1398,16 @@ struct OverrideSpellDataEntry
//uint32 unk0; // 11
};
+struct PowerDisplayEntry
+{
+ uint32 Id; // 0
+ uint32 PowerType; // 1
+ //char* Name; // 2
+ //uint32 R; // 3
+ //uint32 G; // 4
+ //uint32 B; // 5
+};
+
struct PvPDifficultyEntry
{
//uint32 id; // 0 m_ID
@@ -1982,7 +1992,7 @@ struct VehicleEntry
uint32 m_uiLocomotionType; // 34
float m_msslTrgtImpactTexRadius; // 35
uint32 m_uiSeatIndicatorType; // 36
- uint32 m_powerType; // 37, new in 3.1
+ uint32 m_powerDisplayId; // 37, new in 3.1
// 38, new in 3.1
// 39, new in 3.1
};
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 35a8eecb708..222353467f4 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -91,6 +91,7 @@ char const OverrideSpellDatafmt[] = "niiiiiiiiiix";
char const QuestFactionRewardfmt[] = "niiiiiiiiii";
char const QuestSortEntryfmt[] = "nxxxxxxxxxxxxxxxxx";
char const QuestXPfmt[] = "niiiiiiiiii";
+char const PowerDisplayfmt[] = "nixxxx";
char const PvPDifficultyfmt[] = "diiiii";
char const RandomPropertiesPointsfmt[] = "niiiiiiiiiiiiiii";
char const ScalingStatDistributionfmt[] = "niiiiiiiiiiiiiiiiiiiii";
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 36997eb884a..90527912efd 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -111,11 +111,11 @@ uint32 CreatureTemplate::GetFirstValidModelId() const
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
- if (Unit* victim = Unit::GetUnit(m_owner, m_victim))
+ if (Unit* victim = ObjectAccessor::GetUnit(m_owner, m_victim))
{
while (!m_assistants.empty())
{
- Creature* assistant = Unit::GetCreature(m_owner, *m_assistants.begin());
+ Creature* assistant = ObjectAccessor::GetCreature(m_owner, *m_assistants.begin());
m_assistants.pop_front();
if (assistant && assistant->CanAssistTo(&m_owner, victim))
@@ -569,7 +569,7 @@ void Creature::Update(uint32 diff)
if (getPowerType() == POWER_ENERGY)
{
- if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE)
+ if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerDisplayId != POWER_PYRITE)
Regenerate(POWER_ENERGY);
}
else
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 40488df9ef3..370696474ae 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -561,7 +561,7 @@ void GameObject::Update(uint32 diff)
CastSpell(NULL, goInfo->trap.spellId);
SetLootState(GO_JUST_DEACTIVATED);
}
- else if (Unit* target = Unit::GetUnit(*this, m_lootStateUnitGUID))
+ else if (Unit* target = ObjectAccessor::GetUnit(*this, m_lootStateUnitGUID))
{
// Some traps do not have a spell but should be triggered
if (goInfo->trap.spellId)
@@ -1100,7 +1100,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
SwitchDoorOrButton(true, alternative);
SetLootState(GO_ACTIVATED, user);
- m_cooldownTime = time(NULL) + time_to_restore;
+ m_cooldownTime = time_to_restore ? (time(NULL) + time_to_restore) : 0;
}
void GameObject::SetGoArtKit(uint8 kit)
@@ -1404,6 +1404,7 @@ void GameObject::Use(Unit* user)
// prevent removing GO at spell cancel
RemoveFromOwner();
SetOwnerGUID(player->GetGUID());
+ SetSpellId(0); // prevent removing unintended auras at Unit::RemoveGameObject
/// @todo find reasonable value for fishing hole search
GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
@@ -2013,6 +2014,10 @@ void GameObject::SetLootState(LootState state, Unit* unit)
m_lootStateUnitGUID = unit ? unit->GetGUID() : 0;
AI()->OnStateChanged(state, unit);
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
+
+ if (GetGoType() == GAMEOBJECT_TYPE_DOOR) // only set collision for doors on SetGoState
+ return;
+
if (m_model)
{
bool collision = false;
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index ee389ed7311..4573b85c7f3 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -27,7 +27,7 @@
#include "ScriptMgr.h"
#include "ConditionMgr.h"
#include "Player.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
void AddItemsSetItem(Player* player, Item* item)
{
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index eb4e2fcf2ee..768f5907c19 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -30,7 +30,7 @@
#include "Unit.h"
#include "Util.h"
#include "Group.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
#define PET_XP_FACTOR 0.05f
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e7d14d68377..b73a542a92b 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -144,6 +144,8 @@ enum CharacterCustomizeFlags
static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 };
+uint32 const MAX_MONEY_AMOUNT = static_cast<uint32>(std::numeric_limits<int32>::max());
+
// == PlayerTaxi ================================================
PlayerTaxi::PlayerTaxi()
@@ -688,6 +690,8 @@ Player::Player(WorldSession* session): Unit(true)
m_areaUpdateId = 0;
m_team = 0;
+ m_needsZoneUpdate = false;
+
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
clearResurrectRequestData();
@@ -5936,32 +5940,33 @@ float Player::OCTRegenMPPerSpirit()
void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
{
+ float oldRating = m_baseRatingValue[cr];
m_baseRatingValue[cr]+=(apply ? value : -value);
-
// explicit affected values
- switch (cr)
- {
- case CR_HASTE_MELEE:
- {
- float RatingChange = value * GetRatingMultiplier(cr);
- ApplyAttackTimePercentMod(BASE_ATTACK, RatingChange, apply);
- ApplyAttackTimePercentMod(OFF_ATTACK, RatingChange, apply);
- break;
- }
- case CR_HASTE_RANGED:
- {
- float RatingChange = value * GetRatingMultiplier(cr);
- ApplyAttackTimePercentMod(RANGED_ATTACK, RatingChange, apply);
- break;
- }
- case CR_HASTE_SPELL:
- {
- float RatingChange = value * GetRatingMultiplier(cr);
- ApplyCastTimePercentMod(RatingChange, apply);
- break;
+ if (cr == CR_HASTE_MELEE || cr == CR_HASTE_RANGED || cr == CR_HASTE_SPELL)
+ {
+ float const mult = GetRatingMultiplier(cr);
+ float const oldVal = oldRating * mult;
+ float const newVal = m_baseRatingValue[cr] * mult;
+ switch (cr)
+ {
+ case CR_HASTE_MELEE:
+ ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(BASE_ATTACK, newVal, true);
+ ApplyAttackTimePercentMod(OFF_ATTACK, newVal, true);
+ break;
+ case CR_HASTE_RANGED:
+ ApplyAttackTimePercentMod(RANGED_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(RANGED_ATTACK, newVal, true);
+ break;
+ case CR_HASTE_SPELL:
+ ApplyCastTimePercentMod(oldVal, false);
+ ApplyCastTimePercentMod(newVal, true);
+ break;
+ default: // shut up compiler warnings
+ break;
}
- default:
- break;
}
UpdateRating(cr);
@@ -6755,6 +6760,15 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
//AURA_INTERRUPT_FLAG_JUMP not sure
+ // Update player zone if needed
+ if (m_needsZoneUpdate)
+ {
+ uint32 newZone, newArea;
+ GetZoneAndAreaId(newZone, newArea);
+ UpdateZone(newZone, newArea);
+ m_needsZoneUpdate = false;
+ }
+
// group update
if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
@@ -7478,6 +7492,19 @@ void Player::UpdateArea(uint32 newArea)
}
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
+
+ uint32 const areaRestFlag = (GetTeam() == ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE;
+ if (area && area->flags & areaRestFlag)
+ {
+ SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
+ SetRestType(REST_TYPE_IN_FACTION_AREA);
+ InnEnter(time(0), GetMapId(), 0, 0, 0);
+ }
+ else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_FACTION_AREA)
+ {
+ RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
+ SetRestType(REST_TYPE_NO);
+ }
}
void Player::UpdateZone(uint32 newZone, uint32 newArea)
@@ -7563,8 +7590,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
SetRestType(REST_TYPE_NO);
}
}
- else // Recently left a capital city
+ else if (GetRestType() != REST_TYPE_IN_FACTION_AREA) // handled in UpdateArea
{
+ // Recently left a capital city
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_NO);
}
@@ -8199,7 +8227,12 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType att
{
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
if (unitModType == TOTAL_VALUE)
- ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
+ {
+ if (aura->GetAmount() > 0)
+ ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
+ else
+ ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, aura->GetAmount(), apply);
+ }
}
}
@@ -16350,12 +16383,8 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count)
uint16 curitemcount = q_status.ItemCount[j];
if (curitemcount < reqitemcount)
{
- uint16 additemcount = curitemcount + count <= reqitemcount ? count : reqitemcount - curitemcount;
- q_status.ItemCount[j] += additemcount;
-
+ q_status.ItemCount[j] = std::min<uint16>(q_status.ItemCount[j] + count, reqitemcount);
m_QuestStatusSave[questid] = true;
-
- SendQuestUpdateAddItem(qInfo, j, additemcount);
}
if (CanCompleteQuest(questid))
CompleteQuest(questid);
@@ -16373,9 +16402,11 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
uint32 questid = GetQuestSlotQuestId(i);
if (!questid)
continue;
+
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
if (!qInfo)
continue;
+
if (!qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
continue;
@@ -16387,18 +16418,17 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
QuestStatusData& q_status = m_QuestStatus[questid];
uint32 reqitemcount = qInfo->RequiredItemCount[j];
- uint16 curitemcount;
- if (q_status.Status != QUEST_STATUS_COMPLETE)
- curitemcount = q_status.ItemCount[j];
- else
- curitemcount = GetItemCount(entry, true);
- if (curitemcount < reqitemcount + count)
- {
- uint16 remitemcount = curitemcount <= reqitemcount ? count : count + reqitemcount - curitemcount;
- q_status.ItemCount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount;
+ uint16 curitemcount = q_status.ItemCount[j];
- m_QuestStatusSave[questid] = true;
+ if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows
+ curitemcount = GetItemCount(entry, false);
+ uint16 newItemCount = (count > curitemcount) ? 0 : curitemcount - count;
+ newItemCount = std::min<uint16>(newItemCount, reqitemcount);
+ if (newItemCount != q_status.ItemCount[j])
+ {
+ q_status.ItemCount[j] = newItemCount;
+ m_QuestStatusSave[questid] = true;
IncompleteQuest(questid);
}
return;
@@ -22645,7 +22675,7 @@ bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
- if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
+ if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
SetMoney(GetMoney() + amount);
else
{
@@ -23925,7 +23955,7 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const
return GetBaseSkillValue(skill);
}
-void Player::ResurectUsingRequestData()
+void Player::ResurrectUsingRequestData()
{
/// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation());
@@ -26726,3 +26756,8 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
return pet;
}
+
+bool Player::IsLoading() const
+{
+ return GetSession()->PlayerLoading();
+}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 92691c3fd45..aeac9db98aa 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -29,6 +29,7 @@
#include "SpellMgr.h"
#include "Unit.h"
+#include <limits>
#include <string>
#include <vector>
@@ -728,9 +729,10 @@ class InstanceSave;
enum RestType
{
- REST_TYPE_NO = 0,
- REST_TYPE_IN_TAVERN = 1,
- REST_TYPE_IN_CITY = 2
+ REST_TYPE_NO = 0,
+ REST_TYPE_IN_TAVERN = 1,
+ REST_TYPE_IN_CITY = 2,
+ REST_TYPE_IN_FACTION_AREA = 3 // used with AREA_FLAG_REST_ZONE_*
};
enum TeleportToOptions
@@ -824,7 +826,8 @@ enum PlayerDelayedOperations
// Player summoning auto-decline time (in secs)
#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
-#define MAX_MONEY_AMOUNT (0x7FFFFFFF-1)
+// Maximum money amount : 2^31 - 1
+extern uint32 const MAX_MONEY_AMOUNT;
struct InstancePlayerBind
{
@@ -1652,9 +1655,9 @@ class Player : public Unit, public GridObject<Player>
void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana);
void clearResurrectRequestData() { setResurrectRequestData(0, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
- bool isRessurectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; }
- bool isRessurectRequested() const { return m_resurrectGUID != 0; }
- void ResurectUsingRequestData();
+ bool isResurrectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; }
+ bool isResurrectRequested() const { return m_resurrectGUID != 0; }
+ void ResurrectUsingRequestData();
uint8 getCinematic() { return m_cinematic; }
void setCinematic(uint8 cine) { m_cinematic = cine; }
@@ -1672,6 +1675,7 @@ class Player : public Unit, public GridObject<Player>
void UpdatePvP(bool state, bool override=false);
void UpdateZone(uint32 newZone, uint32 newArea);
void UpdateArea(uint32 newArea);
+ void SetNeedsZoneUpdate(bool needsUpdate) { m_needsZoneUpdate = needsUpdate; }
void UpdateZoneDependentAuras(uint32 zone_id); // zones
void UpdateAreaDependentAuras(uint32 area_id); // subzones
@@ -2299,6 +2303,8 @@ class Player : public Unit, public GridObject<Player>
std::string GetMapAreaAndZoneString();
std::string GetCoordsMapAreaAndZoneString();
+ bool IsLoading() const;
+
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;
@@ -2559,6 +2565,8 @@ class Player : public Unit, public GridObject<Player>
uint8 m_grantableLevels;
+ bool m_needsZoneUpdate;
+
private:
// internal common parts for CanStore/StoreItem functions
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index 8c8e470f80b..25315a30da1 100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -19,7 +19,7 @@
#include "SocialMgr.h"
#include "DatabaseEnv.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
#include "WorldPacket.h"
#include "Player.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ef3a0493823..b5ea898dc00 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -774,7 +774,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (damagetype != NODAMAGE && damage)
{
- if (victim != this && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back
+ if (victim != this && victim->GetTypeId() == TYPEID_PLAYER && // does not support creature push_back
+ (!spellProto || !(spellProto->AttributesEx7 & SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE)))
{
if (damagetype != DOT)
if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
@@ -977,86 +978,90 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
uint32 crTypeMask = victim->GetCreatureTypeMask();
- if (IsDamageReducedByArmor(damageSchoolMask, spellInfo))
- damage = CalcArmorReducedDamage(victim, damage, spellInfo, attackType);
-
- bool blocked = false;
- // Per-school calc
- switch (spellInfo->DmgClass)
+ // Spells with SPELL_ATTR4_FIXED_DAMAGE ignore resilience because their damage is based off another spell's damage.
+ if (!(spellInfo->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
{
- // Melee and Ranged Spells
- case SPELL_DAMAGE_CLASS_RANGED:
- case SPELL_DAMAGE_CLASS_MELEE:
+ if (IsDamageReducedByArmor(damageSchoolMask, spellInfo))
+ damage = CalcArmorReducedDamage(victim, damage, spellInfo, attackType);
+
+ bool blocked = false;
+ // Per-school calc
+ switch (spellInfo->DmgClass)
{
- // Physical Damage
- if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
+ // Melee and Ranged Spells
+ case SPELL_DAMAGE_CLASS_RANGED:
+ case SPELL_DAMAGE_CLASS_MELEE:
{
- // Get blocked status
- blocked = isSpellBlocked(victim, spellInfo, attackType);
- }
+ // Physical Damage
+ if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
+ {
+ // Get blocked status
+ blocked = isSpellBlocked(victim, spellInfo, attackType);
+ }
- if (crit)
- {
- damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
-
- // Calculate crit bonus
- uint32 crit_bonus = damage;
- // Apply crit_damage bonus for melee spells
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
- damage += crit_bonus;
-
- // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
- float critPctDamageMod = 0.0f;
- if (attackType == RANGED_ATTACK)
- critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE);
- else
- critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE);
+ if (crit)
+ {
+ damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
+
+ // Calculate crit bonus
+ uint32 crit_bonus = damage;
+ // Apply crit_damage bonus for melee spells
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ damage += crit_bonus;
+
+ // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
+ float critPctDamageMod = 0.0f;
+ if (attackType == RANGED_ATTACK)
+ critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE);
+ else
+ critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE);
- // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
- critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()) - 1.0f) * 100;
+ // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
+ critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()) - 1.0f) * 100;
- // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
- critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
+ // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
+ critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
- if (critPctDamageMod != 0)
- AddPct(damage, critPctDamageMod);
- }
+ if (critPctDamageMod != 0)
+ AddPct(damage, critPctDamageMod);
+ }
- // Spell weapon based damage CAN BE crit & blocked at same time
- if (blocked)
- {
- damageInfo->blocked = victim->GetShieldBlockValue();
- // double blocked amount if block is critical
- if (victim->isBlockCritical())
- damageInfo->blocked += damageInfo->blocked;
- if (damage < int32(damageInfo->blocked))
- damageInfo->blocked = uint32(damage);
- damage -= damageInfo->blocked;
- }
+ // Spell weapon based damage CAN BE crit & blocked at same time
+ if (blocked)
+ {
+ damageInfo->blocked = victim->GetShieldBlockValue();
+ // double blocked amount if block is critical
+ if (victim->isBlockCritical())
+ damageInfo->blocked += damageInfo->blocked;
+ if (damage < int32(damageInfo->blocked))
+ damageInfo->blocked = uint32(damage);
+ damage -= damageInfo->blocked;
+ }
- if (attackType != RANGED_ATTACK)
- ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE);
- else
- ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED);
- break;
- }
- // Magical Attacks
- case SPELL_DAMAGE_CLASS_NONE:
- case SPELL_DAMAGE_CLASS_MAGIC:
- {
- // If crit add critical bonus
- if (crit)
- {
- damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
- damage = SpellCriticalDamageBonus(spellInfo, damage, victim);
+ if (attackType != RANGED_ATTACK)
+ ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE);
+ else
+ ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED);
+ break;
}
+ // Magical Attacks
+ case SPELL_DAMAGE_CLASS_NONE:
+ case SPELL_DAMAGE_CLASS_MAGIC:
+ {
+ // If crit add critical bonus
+ if (crit)
+ {
+ damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
+ damage = SpellCriticalDamageBonus(spellInfo, damage, victim);
+ }
- ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL);
- break;
+ ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL);
+ break;
+ }
+ default:
+ break;
}
- default:
- break;
}
// Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
@@ -1834,14 +1839,15 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
dmgInfo.AbsorbDamage(splitDamage);
- uint32 splitted = splitDamage;
uint32 split_absorb = 0;
- DealDamageMods(caster, splitted, &split_absorb);
+ DealDamageMods(caster, splitDamage, &split_absorb);
- SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
+ SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitDamage, schoolMask, split_absorb, 0, false, 0, false);
- CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
+ CleanDamage cleanDamage = CleanDamage(splitDamage, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
+ DealDamage(caster, splitDamage, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
+ // break 'Fear' and similar auras
+ caster->ProcDamageAndSpellFor(true, this, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_NORMAL_HIT, BASE_ATTACK, (*itr)->GetSpellInfo(), splitDamage);
}
}
@@ -3379,6 +3385,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
return;
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
+ aura->HandleAuraSpecificPeriodics(aurApp, caster);
// apply effects of the aura
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -8153,23 +8160,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (GetTypeId() != TYPEID_PLAYER)
return false;
+ float averageDmg = 0;
// now compute approximate weapon damage by formula from wowwiki.com
- Item* item = NULL;
if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
- item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
+ averageDmg = (GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)) / 2;
else
- item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
+ averageDmg = (GetFloatValue(UNIT_FIELD_MINDAMAGE) + GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
- // dunno if it's really needed but will prevent any possible crashes
- if (!item)
- return false;
-
- ItemTemplate const* weapon = item->GetTemplate();
-
- float weaponDPS = weapon->getDPS();
- float attackPower = GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f;
- float weaponSpeed = float(weapon->Delay) / 1000.0f;
- basepoints0 = int32((weaponDPS + attackPower) * weaponSpeed);
+ basepoints0 = int32(averageDmg);
break;
}
// Persistent Shield (Scarab Brooch trinket)
@@ -9842,49 +9840,167 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)
return pdamage;
- // small exception for Deep Wounds, can't find any general rule
- // should ignore ALL damage mods, they already calculated in trigger spell
- if (spellProto->Id == 12721) // Deep Wounds
- return pdamage;
-
// For totems get damage bonus from owner
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
if (Unit* owner = GetOwner())
return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype);
- // Done total percent damage auras
- float DoneTotalMod = 1.0f;
float ApCoeffMod = 1.0f;
int32 DoneTotal = 0;
+ // done scripted mod (take it from owner)
+ Unit const* owner = GetOwner() ? GetOwner() : this;
+ AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ {
+ if (!(*i)->IsAffectedOnSpell(spellProto))
+ continue;
+
+ switch ((*i)->GetMiscValue())
+ {
+ case 4418: // Increased Shock Damage
+ case 4554: // Increased Lightning Damage
+ case 4555: // Improved Moonfire
+ case 5142: // Increased Lightning Damage
+ case 5147: // Improved Consecration / Libram of Resurgence
+ case 5148: // Idol of the Shooting Star
+ case 6008: // Increased Lightning Damage
+ case 8627: // Totem of Hex
+ {
+ DoneTotal += (*i)->GetAmount();
+ break;
+ }
+ }
+ }
+
+ // Custom scripted damage
+ switch (spellProto->SpellFamilyName)
+ {
+ case SPELLFAMILY_DEATHKNIGHT:
+ // Impurity (dummy effect)
+ if (GetTypeId() == TYPEID_PLAYER)
+ {
+ PlayerSpellMap playerSpells = ToPlayer()->GetSpellMap();
+ for (PlayerSpellMap::const_iterator itr = playerSpells.begin(); itr != playerSpells.end(); ++itr)
+ {
+ if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
+ continue;
+ switch (itr->first)
+ {
+ case 49220:
+ case 49633:
+ case 49635:
+ case 49636:
+ case 49638:
+ if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
+ AddPct(ApCoeffMod, proto->Effects[0].CalcValue());
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ // Done fixed damage bonus auras
+ int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
+ // Pets just add their bonus damage to their spell damage
+ // note that their spell damage is just gain of their own auras
+ if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
+ DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
+
+ // Check for table values
+ float coeff = 0;
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
+ if (bonus)
+ {
+ if (damagetype == DOT)
+ {
+ coeff = bonus->dot_damage;
+ if (bonus->ap_dot_bonus > 0)
+ {
+ WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
+ float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
+ APbonus += GetTotalAttackPowerValue(attType);
+ DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
+ }
+ }
+ else
+ {
+ coeff = bonus->direct_damage;
+ if (bonus->ap_bonus > 0)
+ {
+ WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
+ float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
+ APbonus += GetTotalAttackPowerValue(attType);
+ DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
+ }
+ }
+ }
+ // Default calculation
+ if (DoneAdvertisedBenefit)
+ {
+ if (!bonus || coeff < 0)
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
+
+ float factorMod = CalculateLevelPenalty(spellProto) * stack;
+
+ if (Player* modOwner = GetSpellModOwner())
+ {
+ coeff *= 100.0f;
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ coeff /= 100.0f;
+ }
+ DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
+ }
+
+ // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
+ float tmpDamage = (int32(pdamage) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellDamagePctDone(victim, spellProto, damagetype));
+ // apply spellmod to Done damage (flat and pct)
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
+
+ return uint32(std::max(tmpDamage, 0.0f));
+}
+
+float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, DamageEffectType damagetype) const
+{
+ if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
+ return 1.0f;
+
+ // Some spells don't benefit from pct done mods
+ if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)
+ return 1.0f;
+
+ // For totems pct done mods are calculated when its calculation is run on the player in SpellDamageBonusDone.
+ if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
+ return 1.0f;
+
+ // Done total percent damage auras
+ float DoneTotalMod = 1.0f;
+
// Pet damage?
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
- // Some spells don't benefit from pct done mods
- if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162)))
+ AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
- AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
- {
- if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
- continue;
+ if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
+ continue;
- if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
- {
- if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPct(DoneTotalMod, (*i)->GetAmount());
- else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPct(DoneTotalMod, (*i)->GetAmount());
- else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPct(DoneTotalMod, (*i)->GetAmount());
- }
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
+ {
+ if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+ else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
}
uint32 creatureTypeMask = victim->GetCreatureTypeMask();
- // Add flat bonus from spell damage versus
- DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask);
+
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
@@ -9898,7 +10014,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// done scripted mod (take it from owner)
Unit const* owner = GetOwner() ? GetOwner() : this;
- AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!(*i)->IsAffectedOnSpell(spellProto))
@@ -9955,18 +10071,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
- case 4418: // Increased Shock Damage
- case 4554: // Increased Lightning Damage
- case 4555: // Improved Moonfire
- case 5142: // Increased Lightning Damage
- case 5147: // Improved Consecration / Libram of Resurgence
- case 5148: // Idol of the Shooting Star
- case 6008: // Increased Lightning Damage
- case 8627: // Totem of Hex
- {
- DoneTotal += (*i)->GetAmount();
- break;
- }
// Tundra Stalker
// Merciless Combat
case 7277:
@@ -10132,14 +10236,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
break;
}
}
- // Drain Soul - increased damage for targets under 25 % HP
- if (spellProto->SpellFamilyFlags[0] & 0x00004000)
- if (HasAura(100001))
- DoneTotalMod *= 4;
// Shadow Bite (15% increase from each dot)
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
AddPct(DoneTotalMod, 15 * count);
+
+ // Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
+ if (spellProto->SpellFamilyFlags[0] & 0x00004000 && !victim->HealthAbovePct(25))
+ DoneTotalMod *= 4;
break;
case SPELLFAMILY_HUNTER:
// Steady Shot
@@ -10154,101 +10258,15 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2721, 0))
AddPct(DoneTotalMod, aurEff->GetAmount());
- // Sigil of the Vengeful Heart
- if (spellProto->SpellFamilyFlags[0] & 0x2000)
- if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
- AddPct(DoneTotal, aurEff->GetAmount());
-
// Glacier Rot
if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 196, 0))
if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
AddPct(DoneTotalMod, aurEff->GetAmount());
-
- // Impurity (dummy effect)
- if (GetTypeId() == TYPEID_PLAYER)
- {
- PlayerSpellMap playerSpells = ToPlayer()->GetSpellMap();
- for (PlayerSpellMap::const_iterator itr = playerSpells.begin(); itr != playerSpells.end(); ++itr)
- {
- if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
- continue;
- switch (itr->first)
- {
- case 49220:
- case 49633:
- case 49635:
- case 49636:
- case 49638:
- {
- if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
- AddPct(ApCoeffMod, proto->Effects[0].CalcValue());
- }
- break;
- }
- }
- }
break;
}
- // Done fixed damage bonus auras
- int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
- // Pets just add their bonus damage to their spell damage
- // note that their spell damage is just gain of their own auras
- if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
- DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
-
- // Check for table values
- float coeff = 0;
- SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
- if (bonus)
- {
- if (damagetype == DOT)
- {
- coeff = bonus->dot_damage;
- if (bonus->ap_dot_bonus > 0)
- {
- WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
- float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
- APbonus += GetTotalAttackPowerValue(attType);
- DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
- }
- }
- else
- {
- coeff = bonus->direct_damage;
- if (bonus->ap_bonus > 0)
- {
- WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
- float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
- APbonus += GetTotalAttackPowerValue(attType);
- DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
- }
- }
- }
- // Default calculation
- if (DoneAdvertisedBenefit)
- {
- if (!bonus || coeff < 0)
- coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
-
- float factorMod = CalculateLevelPenalty(spellProto) * stack;
-
- if (Player* modOwner = GetSpellModOwner())
- {
- coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
- coeff /= 100.0f;
- }
- DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
- }
-
- float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod;
- // apply spellmod to Done damage (flat and pct)
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
-
- return uint32(std::max(tmpDamage, 0.0f));
+ return DoneTotalMod;
}
uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) const
@@ -10260,18 +10278,15 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
float TakenTotalMod = 1.0f;
float TakenTotalCasterMod = 0.0f;
- // get all auras from caster that allow the spell to ignore resistance (sanctified wrath)
- AuraEffectList const& IgnoreResistAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
- for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i)
+ // Mod damage from spell mechanic
+ if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
{
- if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
- TakenTotalCasterMod += (float((*i)->GetAmount()));
+ AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
+ for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
+ if (mechanicMask & uint32(1 << ((*i)->GetMiscValue())))
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
- // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
- // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
- TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
-
//.. taken pct: dummy auras
AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
@@ -10291,45 +10306,51 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
break;
}
}
+ // Spells with SPELL_ATTR4_FIXED_DAMAGE should only benefit from mechanic damage mod auras.
+ if (!(spellProto->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
+ {
+ // get all auras from caster that allow the spell to ignore resistance (sanctified wrath)
+ AuraEffectList const& IgnoreResistAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
+ for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i)
+ {
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
+ TakenTotalCasterMod += (float((*i)->GetAmount()));
+ }
- // From caster spells
- AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
- for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
- if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPct(TakenTotalMod, (*i)->GetAmount());
+ // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
+ // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
+ TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
- // Mod damage from spell mechanic
- if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
- {
- AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
- for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
- if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
+ // From caster spells
+ AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
+ for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
+ if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
AddPct(TakenTotalMod, (*i)->GetAmount());
- }
- int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
+ int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
- // Check for table values
- float coeff = 0;
- SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
- if (bonus)
- coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
+ // Check for table values
+ float coeff = 0;
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
+ if (bonus)
+ coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
- // Default calculation
- if (TakenAdvertisedBenefit)
- {
- if (!bonus || coeff < 0)
- coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
-
- float factorMod = CalculateLevelPenalty(spellProto) * stack;
- // level penalty still applied on Taken bonus - is it blizzlike?
- if (Player* modOwner = GetSpellModOwner())
+ // Default calculation
+ if (TakenAdvertisedBenefit)
{
- coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
- coeff /= 100.0f;
+ if (!bonus || coeff < 0)
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
+
+ float factorMod = CalculateLevelPenalty(spellProto) * stack;
+ // level penalty still applied on Taken bonus - is it blizzlike?
+ if (Player* modOwner = GetSpellModOwner())
+ {
+ coeff *= 100.0f;
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ coeff /= 100.0f;
+ }
+ TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
}
- TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod);
}
float tmpDamage = 0.0f;
@@ -10403,16 +10424,21 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const
return TakenAdvertisedBenefit;
}
-bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
+bool Unit::IsSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
+{
+ return roll_chance_f(GetUnitSpellCriticalChance(victim, spellProto, schoolMask, attackType));
+}
+
+float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
{
//! Mobs can't crit with spells. Player Totems can
//! Fire Elemental (from totem) can too - but this part is a hack and needs more research
- if (IS_CREATURE_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
- return false;
+ if (IS_CRE_OR_VEH_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
+ return 0.0f;
// not critting spell
if ((spellProto->AttributesEx2 & SPELL_ATTR2_CANT_CRIT))
- return false;
+ return 0.0f;
float crit_chance = 0.0f;
switch (spellProto->DmgClass)
@@ -10428,7 +10454,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
case 71646: // Item - Bauble of True Blood 25m
break;
default:
- return false;
+ return 0.0f;
}
// Do not add a break here, case fallthrough is intentional! Adding a break will make above spells unable to crit.
case SPELL_DAMAGE_CLASS_MAGIC:
@@ -10530,7 +10556,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
else if (spellProto->GetCategory() == 19)
{
if (victim->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD)
- return true;
+ return 100.0f;
break;
}
break;
@@ -10540,7 +10566,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, GetGUID()))
if (victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE) > -100)
- return true;
+ return 100.0f;
break;
}
break;
@@ -10588,17 +10614,14 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
break;
}
default:
- return false;
+ return 0.0f;
}
// percent done
// only players use intelligence for critical chance computations
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
- crit_chance = crit_chance > 0.0f ? crit_chance : 0.0f;
- if (roll_chance_f(crit_chance))
- return true;
- return false;
+ return crit_chance > 0.0f ? crit_chance : 0.0f;
}
uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim)
@@ -10682,14 +10705,8 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
return healamount;
- float DoneTotalMod = 1.0f;
int32 DoneTotal = 0;
- // Healing done percent
- AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
- for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
- AddPct(DoneTotalMod, (*i)->GetAmount());
-
// done scripted mod (take it from owner)
Unit const* owner = GetOwner() ? GetOwner() : this;
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
@@ -10704,43 +10721,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
DoneTotal += (*i)->GetAmount();
break;
- case 21: // Test of Faith
- case 6935:
- case 6918:
- if (victim->HealthBelowPct(50))
- AddPct(DoneTotalMod, (*i)->GetAmount());
- break;
- case 7798: // Glyph of Regrowth
- {
- if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0))
- AddPct(DoneTotalMod, (*i)->GetAmount());
- break;
- }
- case 8477: // Nourish Heal Boost
- {
- int32 stepPercent = (*i)->GetAmount();
- int32 modPercent = 0;
- AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
- for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
- {
- Aura const* aura = itr->second->GetBase();
- if (aura->GetCasterGUID() != GetGUID())
- continue;
- SpellInfo const* m_spell = aura->GetSpellInfo();
- if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID ||
- !(m_spell->SpellFamilyFlags[1] & 0x00000010 || m_spell->SpellFamilyFlags[0] & 0x50))
- continue;
- modPercent += stepPercent * aura->GetStackAmount();
- }
- AddPct(DoneTotalMod, modPercent);
- break;
- }
- case 7871: // Glyph of Lesser Healing Wave
- {
- if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
- AddPct(DoneTotalMod, (*i)->GetAmount());
- break;
- }
default:
break;
}
@@ -10813,8 +10793,8 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal = 0;
}
- // use float as more appropriate for negative values and percent applying
- float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
+ // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
+ float heal = float(int32(healamount) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellHealingPctDone(victim, spellProto));
// apply spellmod to Done amount
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
@@ -10822,6 +10802,77 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
return uint32(std::max(heal, 0.0f));
}
+float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
+{
+ // For totems pct done mods are calculated when its calculation is run on the player in SpellHealingBonusDone.
+ if (GetTypeId() == TYPEID_UNIT && IsTotem())
+ return 1.0f;
+
+ // No bonus healing for potion spells
+ if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
+ return 1.0f;
+
+ float DoneTotalMod = 1.0f;
+
+ // Healing done percent
+ AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
+ for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+
+ // done scripted mod (take it from owner)
+ Unit const* owner = GetOwner() ? GetOwner() : this;
+ AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ {
+ if (!(*i)->IsAffectedOnSpell(spellProto))
+ continue;
+ switch ((*i)->GetMiscValue())
+ {
+ case 21: // Test of Faith
+ case 6935:
+ case 6918:
+ if (victim->HealthBelowPct(50))
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+ break;
+ case 7798: // Glyph of Regrowth
+ {
+ if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0))
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+ break;
+ }
+ case 8477: // Nourish Heal Boost
+ {
+ int32 stepPercent = (*i)->GetAmount();
+ int32 modPercent = 0;
+ AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
+ for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
+ {
+ Aura const* aura = itr->second->GetBase();
+ if (aura->GetCasterGUID() != GetGUID())
+ continue;
+ SpellInfo const* m_spell = aura->GetSpellInfo();
+ if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID ||
+ !(m_spell->SpellFamilyFlags[1] & 0x00000010 || m_spell->SpellFamilyFlags[0] & 0x50))
+ continue;
+ modPercent += stepPercent * aura->GetStackAmount();
+ }
+ AddPct(DoneTotalMod, modPercent);
+ break;
+ }
+ case 7871: // Glyph of Lesser Healing Wave
+ {
+ if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
+ AddPct(DoneTotalMod, (*i)->GetAmount());
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ return DoneTotalMod;
+}
+
uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) const
{
float TakenTotalMod = 1.0f;
@@ -11108,8 +11159,7 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons
// Check for immune to application of harmful magical effects
AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
- if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff
- ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
+ if (((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
!spellInfo->IsPositiveEffect(index)) // Harmful
return true;
}
@@ -11178,7 +11228,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
// Some spells don't benefit from pct done mods
if (spellProto)
- if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162)))
+ if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS))
{
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
@@ -12990,21 +13040,6 @@ float Unit::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spell
return spellInfo->GetMinRange(!IsHostileTo(target));
}
-Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
-{
- return ObjectAccessor::GetUnit(object, guid);
-}
-
-Player* Unit::GetPlayer(WorldObject& object, uint64 guid)
-{
- return ObjectAccessor::GetPlayer(object, guid);
-}
-
-Creature* Unit::GetCreature(WorldObject& object, uint64 guid)
-{
- return object.GetMap()->GetCreature(guid);
-}
-
uint32 Unit::GetCreatureType() const
{
if (GetTypeId() == TYPEID_PLAYER)
@@ -15250,8 +15285,8 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// update get killing blow achievements, must be done before setDeathState to be able to require auras on target
// and before Spirit of Redemption as it also removes auras
- if (player)
- player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
+ if (Player* killerPlayer = GetCharmerOrOwnerPlayerOrPlayerItself())
+ killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
// if talent known but not triggered (check priest class for speedup check)
bool spiritOfRedemption = false;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 9926403f7af..dbb463585f0 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1972,13 +1972,15 @@ class Unit : public WorldObject
Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo);
Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL);
- int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const;
- int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const;
+ int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const;
+ int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const;
uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const;
+ float SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, DamageEffectType damagetype) const;
uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const;
- int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const;
- int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const;
+ int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const;
+ int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const;
uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const;
+ float SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const;
uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const;
uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL);
@@ -1986,7 +1988,8 @@ class Unit : public WorldObject
bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK);
bool isBlockCritical();
- bool isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
+ bool IsSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
+ float GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
uint32 SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim);
uint32 SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim);
@@ -2028,9 +2031,6 @@ class Unit : public WorldObject
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ }
- static Unit* GetUnit(WorldObject& object, uint64 guid);
- static Player* GetPlayer(WorldObject& object, uint64 guid);
- static Creature* GetCreature(WorldObject& object, uint64 guid);
MotionMaster* GetMotionMaster() { return i_motionMaster; }
const MotionMaster* GetMotionMaster() const { return i_motionMaster; }
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index fae4f0c6b6a..4c3724a8860 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -76,42 +76,9 @@ Vehicle::~Vehicle()
void Vehicle::Install()
{
- if (Creature* creature = _me->ToCreature())
- {
- switch (_vehicleInfo->m_powerType)
- {
- case POWER_STEAM:
- case POWER_HEAT:
- case POWER_BLOOD:
- case POWER_OOZE:
- case POWER_WRATH:
- _me->setPowerType(POWER_ENERGY);
- _me->SetMaxPower(POWER_ENERGY, 100);
- break;
- case POWER_PYRITE:
- _me->setPowerType(POWER_ENERGY);
- _me->SetMaxPower(POWER_ENERGY, 50);
- break;
- default:
- for (uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
- {
- if (!creature->m_spells[i])
- continue;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[i]);
- if (!spellInfo)
- continue;
-
- if (spellInfo->PowerType == POWER_ENERGY && spellInfo->CalcPowerCost(_me, spellInfo->GetSchoolMask()) > 0)
- {
- _me->setPowerType(POWER_ENERGY);
- _me->SetMaxPower(POWER_ENERGY, 100);
- break;
- }
- }
- break;
- }
- }
+ if (_me->GetTypeId() == TYPEID_UNIT)
+ if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(_vehicleInfo->m_powerDisplayId))
+ _me->setPowerType(Powers(powerDisplay->PowerType));
_status = STATUS_INSTALLED;
if (GetBase()->GetTypeId() == TYPEID_UNIT)
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index f448fbb9f19..db0a196dec6 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -754,7 +754,7 @@ int32 Guild::Member::GetBankWithdrawValue(uint8 tabId) const
{
// Guild master has unlimited amount.
if (IsRank(GR_GUILDMASTER))
- return tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED;
+ return static_cast<int32>(tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED);
return m_bankWithdraw[tabId];
}
@@ -1760,7 +1760,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
{
//clamp amount to MAX_MONEY_AMOUNT, Players can't hold more than that anyway
- amount = std::min(amount, uint32(MAX_MONEY_AMOUNT));
+ amount = std::min(amount, MAX_MONEY_AMOUNT);
if (m_bankMoney < amount) // Not enough money in bank
return false;
@@ -2581,7 +2581,7 @@ inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId)
{
uint8 rankId = member->GetRankId();
if (rankId == GR_GUILDMASTER)
- return GUILD_WITHDRAW_SLOT_UNLIMITED;
+ return static_cast<int32>(GUILD_WITHDRAW_SLOT_UNLIMITED);
if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != 0)
{
int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId);
@@ -2598,7 +2598,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const
{
uint8 rankId = member->GetRankId();
if (rankId == GR_GUILDMASTER)
- return GUILD_WITHDRAW_MONEY_UNLIMITED;
+ return static_cast<int32>(GUILD_WITHDRAW_MONEY_UNLIMITED);
if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != 0)
{
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 45d4d221d06..0a797f0e008 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -235,27 +235,42 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
recvData.ReadPackedTime(unkPackedTime);
recvData >> flags;
- CalendarEvent calendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
+ // prevent events in the past
+ // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
+ if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
+ {
+ recvData.rfinish();
+ return;
+ }
+
+ CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
- if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
+ if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
if (Player* creator = ObjectAccessor::FindPlayer(guid))
- calendarEvent.SetGuildId(creator->GetGuildId());
+ calendarEvent->SetGuildId(creator->GetGuildId());
- if (calendarEvent.IsGuildAnnouncement())
+ if (calendarEvent->IsGuildAnnouncement())
{
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite invite(0, calendarEvent.GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ CalendarInvite invite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
// WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
// of storage of the pointer as it will lead to memory corruption
- sCalendarMgr->AddInvite(&calendarEvent, &invite);
+ sCalendarMgr->AddInvite(calendarEvent, &invite);
}
else
{
uint32 inviteCount;
recvData >> inviteCount;
- for (uint32 i = 0; i < inviteCount; ++i)
+ SQLTransaction trans;
+ if (inviteCount > 1)
+ trans = CharacterDatabase.BeginTransaction();
+
+ // client limits the amount of players to be invited to 100
+ const uint32 MaxPlayerInvites = 100;
+
+ for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
{
uint64 invitee = 0;
uint8 status = 0;
@@ -264,12 +279,15 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
recvData >> status >> rank;
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent.GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
- sCalendarMgr->AddInvite(&calendarEvent, invite);
+ CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
+ sCalendarMgr->AddInvite(calendarEvent, invite, trans);
}
+
+ if (inviteCount > 1)
+ CharacterDatabase.CommitTransaction(trans);
}
- sCalendarMgr->AddEvent(new CalendarEvent(calendarEvent, calendarEvent.GetEventId()), CALENDAR_SENDTYPE_ADD);
+ sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
@@ -294,6 +312,14 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
recvData.ReadPackedTime(timeZoneTime);
recvData >> flags;
+ // prevent events in the past
+ // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
+ if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
+ {
+ recvData.rfinish();
+ return;
+ }
+
TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
@@ -336,24 +362,37 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
- uint32 time;
+ uint32 eventTime;
recvData >> eventId >> inviteId;
- recvData.ReadPackedTime(time);
+ recvData.ReadPackedTime(eventTime);
TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
- "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time);
+ "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime);
+
+ // prevent events in the past
+ // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
+ if (time_t(eventTime) < (time(NULL) - time_t(86400L)))
+ {
+ recvData.rfinish();
+ return;
+ }
if (CalendarEvent* oldEvent = sCalendarMgr->GetEvent(eventId))
{
CalendarEvent* newEvent = new CalendarEvent(*oldEvent, sCalendarMgr->GetFreeEventId());
- newEvent->SetEventTime(time_t(time));
+ newEvent->SetEventTime(time_t(eventTime));
sCalendarMgr->AddEvent(newEvent, CALENDAR_SENDTYPE_COPY);
CalendarInviteStore invites = sCalendarMgr->GetEventInvites(eventId);
+ SQLTransaction trans;
+ if (invites.size() > 1)
+ trans = CharacterDatabase.BeginTransaction();
for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
- sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()));
+ sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()), trans);
+ if (invites.size() > 1)
+ CharacterDatabase.CommitTransaction(trans);
// should we change owner when somebody makes a copy of event owned by another person?
}
else
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index f4ea4971190..d4af17ca78b 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -243,8 +243,6 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
{
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, false);
-
// remove expired bans
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
CharacterDatabase.Execute(stmt);
@@ -681,7 +679,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
data << uint8(CHAR_CREATE_SUCCESS);
SendPacket(&data);
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
std::string IP_str = GetRemoteAddress();
TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
@@ -758,15 +755,14 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
-
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
}
void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
{
if (PlayerLoading() || GetPlayer() != NULL)
{
- TC_LOG_ERROR("network", "Player tryes to login again, AccountId = %d", GetAccountId());
+ TC_LOG_ERROR("network", "Player tries to login again, AccountId = %d", GetAccountId());
+ KickPlayer();
return;
}
@@ -1168,7 +1164,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName)
{
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
if (!result)
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
@@ -1426,8 +1421,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
stmt->setUInt32(0, GUID_LOPART(guid));
// TODO: Make async with callback
- // TODO 2: Allow opcode at end of callback
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -1682,8 +1675,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
uint8 playerClass = nameData->m_class;
uint8 level = nameData->m_level;
- // TO Do: Make async and allow opcode on callback
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
+ // TO Do: Make async
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES);
stmt->setUInt32(0, lowGuid);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index e0b29523a3a..eccf7a6fd38 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -269,7 +269,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
Player* receiver = sObjectAccessor->FindPlayerByName(to);
- if (!receiver || (!receiver->isAcceptWhispers() && receiver->GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
+ if (!receiver || (lang != LANG_ADDON && !receiver->isAcceptWhispers() && receiver->GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
{
SendPlayerNotFoundNotice(to);
return;
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index c4b4b35bf37..3ef99cc2fc1 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -85,6 +85,18 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
return;
}
+ if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
+ if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot);
uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot);
@@ -137,6 +149,18 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
return;
}
+ if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
+ if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
_player->SwapItem(src, dst);
}
@@ -470,19 +494,6 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
}
-void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket& recvData)
-{
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_PAGE_TEXT_QUERY");
-
- uint32 itemid;
- uint64 guid;
-
- recvData >> itemid >> guid;
-
- TC_LOG_INFO("network", "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
- itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
-}
-
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
@@ -871,15 +882,11 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
uint64 guid;
recvPacket >> guid;
- // cheating protection
- /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
- Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
- if (!creature)
+ if (!CanUseBank(guid))
{
- TC_LOG_DEBUG("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
}
- */
uint32 slot = _player->GetBankBagSlotCount();
@@ -925,6 +932,12 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
recvPacket >> srcbag >> srcslot;
TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
+ if (!CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
if (!pItem)
return;
@@ -956,6 +969,12 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
recvPacket >> srcbag >> srcslot;
TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
+ if (!CanUseBank())
+ {
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ return;
+ }
+
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
if (!pItem)
return;
@@ -1454,3 +1473,21 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
SendPacket(&data);
}
+
+bool WorldSession::CanUseBank(uint64 bankerGUID) const
+{
+ // bankerGUID parameter is optional, set to 0 by default.
+ if (!bankerGUID)
+ bankerGUID = m_currentBankerGUID;
+
+ bool isUsingBankCommand = (bankerGUID == GetPlayer()->GetGUID() && bankerGUID == m_currentBankerGUID);
+
+ if (!isUsingBankCommand)
+ {
+ Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(bankerGUID, UNIT_NPC_FLAG_BANKER);
+ if (!creature)
+ return false;
+ }
+
+ return true;
+} \ No newline at end of file
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 1b04c89b338..c4ff2581e75 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -186,11 +186,6 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message");
- time_t now = time(NULL);
- if (now - timeLastWhoCommand < 5)
- return;
- else timeLastWhoCommand = now;
-
uint32 matchcount = 0;
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
@@ -505,10 +500,9 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone);
- // use server size data
- uint32 newzone, newarea;
- GetPlayer()->GetZoneAndAreaId(newzone, newarea);
- GetPlayer()->UpdateZone(newzone, newarea);
+ // use server side data, but only after update the player position. See Player::UpdatePosition().
+ GetPlayer()->SetNeedsZoneUpdate(true);
+
//GetPlayer()->SendInitWorldStates(true, newZone);
}
@@ -793,10 +787,10 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData)
return;
}
- if (!GetPlayer()->isRessurectRequestedBy(guid))
+ if (!GetPlayer()->isResurrectRequestedBy(guid))
return;
- GetPlayer()->ResurectUsingRequestData();
+ GetPlayer()->ResurrectUsingRequestData();
}
void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 0c2eae849b8..5fc6ada6fb2 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -496,7 +496,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData)
if (GetPlayer()->IsInWorld())
{
if (_player->m_mover->GetGUID() != guid)
- TC_LOG_ERROR("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
+ TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
}
}
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index fc14797ea94..d8a518a24db 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -100,6 +100,7 @@ void WorldSession::SendShowBank(uint64 guid)
{
WorldPacket data(SMSG_SHOW_BANK, 8);
data << guid;
+ m_currentBankerGUID = guid;
SendPacket(&data);
}
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 616ea9c7326..3cc445ff81b 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -74,13 +74,13 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
if (!pet)
{
- TC_LOG_ERROR("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
return;
}
if (pet != GetPlayer()->GetFirstControlled())
{
- TC_LOG_ERROR("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
return;
}
@@ -144,7 +144,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- TC_LOG_ERROR("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
+ TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId());
return;
}
@@ -868,7 +868,10 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
uint32 talentId, talentRank;
- for (uint32 i = 0; i < talentsCount; ++i)
+ // Client has max 24 talents, rounded up : 30
+ uint32 const MaxTalentsCount = 30;
+
+ for (uint32 i = 0; i < talentsCount && i < MaxTalentsCount; ++i)
{
recvData >> talentId >> talentRank;
@@ -876,4 +879,6 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
}
_player->SendTalentsInfoData(true);
+
+ recvData.rfinish();
}
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index de08392b86a..dbcfb1c4970 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -405,19 +405,23 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData)
uint32 count;
recvData >> count; // quest count, max=25
- if (count >= MAX_QUEST_LOG_SIZE)
+ if (count > MAX_QUEST_LOG_SIZE)
{
recvData.rfinish();
return;
}
- WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count);
- data << uint32(count); // count
-
+ // Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times
+ std::unordered_set<uint32> questIds;
for (uint32 i = 0; i < count; ++i)
+ questIds.insert(recvData.read<uint32>()); // quest id
+
+ WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4 + (4 + 4)*questIds.size());
+ data << uint32(questIds.size()); // count
+
+ for (auto itr = questIds.begin(); itr != questIds.end(); ++itr)
{
- uint32 questId;
- recvData >> questId; // quest id
+ uint32 questId = *itr;
bool questOk = false;
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index fe893314b87..f90dfef2684 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -45,7 +45,10 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
uint32 talentId, talentRank;
- for (uint32 i = 0; i < talentsCount; ++i)
+ // Client has max 44 talents for tree for 3 trees, rounded up : 150
+ uint32 const MaxTalentsCount = 150;
+
+ for (uint32 i = 0; i < talentsCount && i < MaxTalentsCount; ++i)
{
recvPacket >> talentId >> talentRank;
@@ -53,6 +56,8 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
}
_player->SendTalentsInfoData(false);
+
+ recvPacket.rfinish();
}
void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 688d7e58b6c..a2aa426c096 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -187,6 +187,8 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
uint32 mainSurvey; // GMSurveyCurrentSurvey.dbc, column 1 (all 9) ref to GMSurveySurveys.dbc
recvData >> mainSurvey;
+ std::unordered_set<uint32> surveyIds;
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
// sub_survey1, r1, comment1, sub_survey2, r2, comment2, sub_survey3, r3, comment3, sub_survey4, r4, comment4, sub_survey5, r5, comment5, sub_survey6, r6, comment6, sub_survey7, r7, comment7, sub_survey8, r8, comment8, sub_survey9, r9, comment9, sub_survey10, r10, comment10,
for (uint8 i = 0; i < 10; i++)
{
@@ -200,12 +202,16 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
std::string comment; // comment ("Usage: GMSurveyAnswerSubmit(question, rank, comment)")
recvData >> comment;
+ // make sure the same sub survey is not added to DB twice
+ if (!surveyIds.insert(subSurveyId).second)
+ continue;
+
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SUBSURVEY);
stmt->setUInt32(0, nextSurveyID);
stmt->setUInt32(1, subSurveyId);
stmt->setUInt32(2, rank);
stmt->setString(3, comment);
- CharacterDatabase.Execute(stmt);
+ trans->Append(stmt);
}
std::string comment; // just a guess
@@ -217,7 +223,9 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
stmt->setUInt32(2, mainSurvey);
stmt->setString(3, comment);
- CharacterDatabase.Execute(stmt);
+ trans->Append(stmt);
+
+ CharacterDatabase.CommitTransaction(trans);
}
void WorldSession::HandleReportLag(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 1fe4718d7ae..884c4a83b15 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -299,14 +299,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}
- if (_player->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
+ if (_player->GetMoney() >= MAX_MONEY_AMOUNT - his_trade->GetMoney())
{
_player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
my_trade->SetAccepted(false, true);
return;
}
- if (trader->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
+ if (trader->GetMoney() >= MAX_MONEY_AMOUNT - my_trade->GetMoney())
{
trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
his_trade->SetAccepted(false, true);
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index 3973b23eab4..b3fa240e2d2 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -96,7 +96,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
if (!accessory)
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
- else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), accessory))
+ else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory))
{
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
if (vehicle->HasEmptySeat(seatId))
@@ -114,7 +114,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
if (vehicle_base->GetGUID() == guid)
GetPlayer()->ChangeSeat(seatId);
- else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), guid))
+ else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), guid))
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
if (vehicle->HasEmptySeat(seatId))
vehUnit->HandleSpellClick(GetPlayer(), seatId);
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 3050443edc0..9e11c566c22 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -243,7 +243,7 @@ AI* GetInstanceAI(T* obj, char const* scriptName)
return new AI(obj);
return NULL;
-};
+}
template<class AI, class T>
AI* GetInstanceAI(T* obj)
@@ -253,6 +253,6 @@ AI* GetInstanceAI(T* obj)
return new AI(obj);
return NULL;
-};
+}
#endif // TRINITY_INSTANCE_DATA_H
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index ba271235330..d3be33cb441 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2854,10 +2854,9 @@ bool InstanceMap::CanEnter(Player* player)
return false;
}
- // cannot enter while an encounter is in progress on raids
- /*Group* group = player->GetGroup();
- if (!player->IsGameMaster() && group && group->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
- if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress())
+ // cannot enter while an encounter is in progress
+ // allow if just loading
+ if (!player->IsLoading() && IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress())
{
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
return false;
diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp
index f3a5a66bf66..dd697719d54 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -6,34 +6,6 @@
#include <ace/Guard_T.h>
#include <ace/Method_Request.h>
-class WDBThreadStartReq1 : public ACE_Method_Request
-{
- public:
-
- WDBThreadStartReq1()
- {
- }
-
- virtual int call()
- {
- return 0;
- }
-};
-
-class WDBThreadEndReq1 : public ACE_Method_Request
-{
- public:
-
- WDBThreadEndReq1()
- {
- }
-
- virtual int call()
- {
- return 0;
- }
-};
-
class MapUpdateRequest : public ACE_Method_Request
{
private:
@@ -67,7 +39,7 @@ MapUpdater::~MapUpdater()
int MapUpdater::activate(size_t num_threads)
{
- return m_executor.start((int)num_threads, new WDBThreadStartReq1, new WDBThreadEndReq1);
+ return m_executor.start((int)num_threads);
}
int MapUpdater::deactivate()
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index eabc15d6ee7..34871085157 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -1224,6 +1224,8 @@ enum TrinityStrings
LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD = 11006,
LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007,
+ LANG_NPCINFO_INHABIT_TYPE = 11008
+
// NOT RESERVED IDS 12000-1999999999
// `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
// For other tables maybe 2000010000-2147483647 (max index)
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index b52e640afc7..4ec1d5750a4 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -427,7 +427,7 @@ enum SpellAttr4
SPELL_ATTR4_UNK5 = 0x00000020, // 5
SPELL_ATTR4_NOT_STEALABLE = 0x00000040, // 6 although such auras might be dispellable, they cannot be stolen
SPELL_ATTR4_TRIGGERED = 0x00000080, // 7 spells forced to be triggered
- SPELL_ATTR4_FIXED_DAMAGE = 0x00000100, // 8 ignores taken percent damage mods?
+ SPELL_ATTR4_FIXED_DAMAGE = 0x00000100, // 8 Ignores resilience and any (except mechanic related) damage or % damage taken auras on target.
SPELL_ATTR4_TRIGGER_ACTIVATE = 0x00000200, // 9 initially disabled / trigger activate from event (Execute, Riposte, Deep Freeze end other)
SPELL_ATTR4_SPELL_VS_EXTEND_COST = 0x00000400, // 10 Rogue Shiv have this flag
SPELL_ATTR4_UNK11 = 0x00000800, // 11
@@ -533,7 +533,7 @@ enum SpellAttr7
SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // 3 Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS
SPELL_ATTR7_UNK4 = 0x00000010, // 4 Only 47883 (Soulstone Resurrection) and test spell.
SPELL_ATTR7_SUMMON_PLAYER_TOTEM = 0x00000020, // 5 Only Shaman player totems.
- SPELL_ATTR7_UNK6 = 0x00000040, // 6 Dark Surge, Surge of Light, Burning Breath triggers (boss spells).
+ SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE = 0x00000040, // 6 Does not cause spell pushback on damage
SPELL_ATTR7_UNK7 = 0x00000080, // 7 66218 (Launch) spell.
SPELL_ATTR7_HORDE_ONLY = 0x00000100, // 8 Teleports, mounts and other spells.
SPELL_ATTR7_ALLIANCE_ONLY = 0x00000200, // 9 Teleports, mounts and other spells.
@@ -1129,7 +1129,7 @@ enum SpellCustomErrors
SPELL_CUSTOM_ERROR_95 = 95, // ""
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_RECRUITS = 96, // You already have the max number of recruits.
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_VOLUNTEERS = 97, // You already have the max number of volunteers.
- SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESSURECT = 98, // Frostmourne has rendered you unable to ressurect.
+ SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESURRECT = 98, // Frostmourne has rendered you unable to resurrect.
SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99 // You can't mount while affected by that shapeshift.
};
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 69e677bd89d..46b73e74068 100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -24,7 +24,7 @@
#include "World.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000};
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index e581d7d1544..7b07abdf962 100644
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -25,12 +25,6 @@
#include "Common.h"
-// Note: this include need for be sure have full definition of class WorldSession
-// if this class definition not complete then VS for x64 release use different size for
-// struct OpcodeHandler in this header and Opcode.cpp and get totally wrong data from
-// table opcodeTable in source when Opcode.h included but WorldSession.h not included
-#include "WorldSession.h"
-
/// List of Opcodes
enum Opcodes
{
@@ -1366,8 +1360,15 @@ enum PacketProcessing
PROCESS_THREADSAFE //packet is thread-safe - process it in Map::Update()
};
+class WorldSession;
class WorldPacket;
+#if defined(__GNUC__)
+#pragma pack(1)
+#else
+#pragma pack(push, 1)
+#endif
+
struct OpcodeHandler
{
char const* name;
@@ -1378,6 +1379,12 @@ struct OpcodeHandler
extern OpcodeHandler opcodeTable[NUM_MSG_TYPES];
+#if defined(__GNUC__)
+#pragma pack()
+#else
+#pragma pack(pop)
+#endif
+
/// Lookup opcode name for human understandable logging
inline const char* LookupOpcodeName(uint16 id)
{
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 89242bada6e..f8df683d90c 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -121,8 +121,10 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8
m_TutorialsChanged(false),
recruiterId(recruiter),
isRecruiter(isARecruiter),
- timeLastWhoCommand(0),
- _RBACData(NULL)
+ _RBACData(NULL),
+ expireTime(60000), // 1 min after socket loss, session is deleted
+ forceExit(false),
+ m_currentBankerGUID(0)
{
memset(m_Tutorials, 0, sizeof(m_Tutorials));
@@ -277,12 +279,13 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
//! loop caused by re-enqueueing the same packets over and over again, we stop updating this session
//! and continue updating others. The re-enqueued packets will be handled in the next Update call for this session.
uint32 processedPackets = 0;
+ time_t currentTime = time(NULL);
while (m_Socket && !m_Socket->IsClosed() &&
!_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket &&
_recvQueue.next(packet, updater))
{
- if (!AntiDOS.EvaluateOpcode(*packet))
+ if (!AntiDOS.EvaluateOpcode(*packet, currentTime))
{
KickPlayer();
}
@@ -419,8 +422,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
- m_Socket->RemoveReference();
- m_Socket = NULL;
+ expireTime -= expireTime > diff ? diff : expireTime;
+ if (expireTime < diff || forceExit)
+ {
+ m_Socket->RemoveReference();
+ m_Socket = NULL;
+ }
}
if (!m_Socket)
@@ -446,7 +453,6 @@ void WorldSession::LogoutPlayer(bool save)
DoLootRelease(lguid);
///- If the player just died before logging out, make him appear as a ghost
- //FIXME: logout must be delayed in case lost connection with client in time of combat
if (_player->GetDeathTimer())
{
_player->getHostileRefManager().deleteReferences();
@@ -569,7 +575,6 @@ void WorldSession::LogoutPlayer(bool save)
m_playerLogout = false;
m_playerSave = false;
m_playerRecentlyLogout = true;
- AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true);
LogoutRequest(0);
}
@@ -577,7 +582,10 @@ void WorldSession::LogoutPlayer(bool save)
void WorldSession::KickPlayer()
{
if (m_Socket)
+ {
m_Socket->CloseSocket();
+ forceExit = true;
+ }
}
void WorldSession::SendNotification(const char *format, ...)
@@ -1236,14 +1244,39 @@ void WorldSession::InvalidateRBACData()
_RBACData = NULL;
}
-bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const
+bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) const
{
- if (IsOpcodeAllowed(p.GetOpcode()))
- return true;
+ PacketCounter& packetCounter = _PacketThrottlingMap[p.GetOpcode()];
+ if (packetCounter.lastReceiveTime != time)
+ {
+ packetCounter.lastReceiveTime = time;
+ packetCounter.amountCounter = 0;
+ }
- // Opcode not allowed, let the punishment begin
- TC_LOG_INFO("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)",
- Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size());
+ uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode());
+
+ bool dosTriggered = false;
+ // Check if player is flooding some packets
+ if (++packetCounter.amountCounter > maxPacketCounterAllowed)
+ {
+ dosTriggered = true;
+ TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Ping: %u, Character: %s, flooding packet (opc: %s (0x%X), count: %u)",
+ Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(),
+ opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter);
+ }
+
+ // Then check if player is sending packets not allowed
+ if (!IsOpcodeAllowed(p.GetOpcode()))
+ {
+ dosTriggered = true;
+ // Opcode not allowed, let the punishment begin
+ TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)",
+ Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size());
+ }
+
+ // Return true if everything is fine, otherwise apply the configured policy
+ if (!dosTriggered)
+ return true;
switch (_policy)
{
@@ -1272,3 +1305,225 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const
return true;
}
}
+
+
+uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) const
+{
+ uint32 maxPacketCounterAllowed;
+ switch (opcode)
+ {
+ // These opcodes are spammed by few addons so a very high limit is required
+ case CMSG_QUEST_QUERY:
+ case CMSG_MESSAGECHAT:
+ case CMSG_ITEM_QUERY_SINGLE:
+ case CMSG_ITEM_NAME_QUERY:
+ case CMSG_GAMEOBJECT_QUERY:
+ case CMSG_NAME_QUERY:
+ case CMSG_PET_NAME_QUERY:
+ case CMSG_CREATURE_QUERY:
+ case CMSG_NPC_TEXT_QUERY:
+ case CMSG_QUESTGIVER_STATUS_QUERY:
+ {
+ maxPacketCounterAllowed = 5000;
+ break;
+ }
+
+ case CMSG_ATTACKSTOP:
+ case CMSG_GUILD_QUERY:
+ case CMSG_ARENA_TEAM_QUERY:
+ case CMSG_TAXINODE_STATUS_QUERY:
+ case CMSG_TAXIQUERYAVAILABLENODES:
+ case CMSG_QUESTGIVER_QUERY_QUEST:
+ case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY:
+ case CMSG_QUERY_QUESTS_COMPLETED:
+ case CMSG_QUEST_POI_QUERY:
+ case CMSG_QUERY_TIME:
+ case CMSG_PAGE_TEXT_QUERY:
+ case CMSG_PETITION_QUERY:
+ case CMSG_QUERY_INSPECT_ACHIEVEMENTS:
+ case CMSG_AREA_SPIRIT_HEALER_QUERY:
+ case CMSG_CORPSE_MAP_POSITION_QUERY:
+ case CMSG_MOVE_TIME_SKIPPED:
+ case CMSG_GUILD_BANK_QUERY_TAB:
+ case MSG_GUILD_BANK_LOG_QUERY:
+ case MSG_QUERY_GUILD_BANK_TEXT:
+ case MSG_CORPSE_QUERY:
+ case MSG_QUERY_NEXT_MAIL_TIME:
+ case MSG_GUILD_EVENT_LOG_QUERY:
+ case MSG_MOVE_SET_FACING:
+ case CMSG_INSPECT:
+ {
+ maxPacketCounterAllowed = 500;
+ break;
+ }
+
+ case CMSG_REQUEST_PARTY_MEMBER_STATS:
+ case CMSG_WHO:
+ case CMSG_SETSHEATHED:
+ case CMSG_CONTACT_LIST:
+ case CMSG_GUILD_SET_PUBLIC_NOTE:
+ case CMSG_GUILD_SET_OFFICER_NOTE:
+ {
+ maxPacketCounterAllowed = 50;
+ break;
+ }
+
+ case CMSG_SPELLCLICK:
+ case CMSG_GAMEOBJ_USE:
+ case CMSG_GAMEOBJ_REPORT_USE:
+ case MSG_RAID_TARGET_UPDATE:
+ case CMSG_QUESTGIVER_COMPLETE_QUEST:
+ case CMSG_PLAYER_VEHICLE_ENTER:
+ case CMSG_PETITION_SIGN:
+ {
+ maxPacketCounterAllowed = 20;
+ break;
+ }
+
+ case CMSG_PLAYER_LOGOUT:
+ case CMSG_LOGOUT_REQUEST:
+ case CMSG_LOGOUT_CANCEL:
+ case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
+ case CMSG_REQUEST_VEHICLE_PREV_SEAT:
+ case CMSG_REQUEST_VEHICLE_NEXT_SEAT:
+ case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
+ case CMSG_TOGGLE_PVP:
+ case CMSG_ADD_FRIEND:
+ case CMSG_DEL_FRIEND:
+ case CMSG_SET_CONTACT_NOTES:
+ case CMSG_RESET_INSTANCES:
+ case CMSG_HEARTH_AND_RESURRECT:
+ case CMSG_CHAR_CREATE:
+ case CMSG_READY_FOR_ACCOUNT_DATA_TIMES:
+ case CMSG_CHAR_ENUM:
+ case CMSG_REALM_SPLIT:
+ case CMSG_CHAR_DELETE:
+ case CMSG_PLAYER_LOGIN:
+ case CMSG_PET_ABANDON:
+ case CMSG_PET_RENAME:
+ case CMSG_CHAR_RENAME:
+ case CMSG_CHAR_CUSTOMIZE:
+ case CMSG_CHAR_RACE_CHANGE:
+ case CMSG_CHAR_FACTION_CHANGE:
+ case CMSG_GMTICKET_CREATE:
+ case CMSG_GMTICKET_UPDATETEXT:
+ case CMSG_GMTICKET_DELETETICKET:
+ case CMSG_GMSURVEY_SUBMIT:
+ case CMSG_GM_REPORT_LAG:
+ case CMSG_BUG:
+ case CMSG_GMRESPONSE_RESOLVE:
+ case CMSG_ACTIVATETAXIEXPRESS:
+ case CMSG_ACTIVATETAXI:
+ case CMSG_SELF_RES:
+ case CMSG_INITIATE_TRADE:
+ case CMSG_BEGIN_TRADE:
+ case CMSG_UNLEARN_SKILL:
+ case CMSG_DISMISS_CONTROLLED_VEHICLE:
+ case CMSG_REQUEST_VEHICLE_EXIT:
+ case CMSG_LEARN_PREVIEW_TALENTS:
+ case CMSG_LEARN_PREVIEW_TALENTS_PET:
+ case CMSG_CONTROLLER_EJECT_PASSENGER:
+ case CMSG_EQUIPMENT_SET_SAVE:
+ case CMSG_DELETEEQUIPMENT_SET:
+ case CMSG_REMOVE_GLYPH:
+ case CMSG_ALTER_APPEARANCE:
+ case CMSG_QUESTGIVER_ACCEPT_QUEST:
+ case CMSG_QUESTGIVER_CHOOSE_REWARD:
+ case CMSG_QUESTGIVER_REQUEST_REWARD:
+ case CMSG_QUESTGIVER_CANCEL:
+ case CMSG_QUESTLOG_REMOVE_QUEST:
+ case CMSG_QUEST_CONFIRM_ACCEPT:
+ case CMSG_DISMISS_CRITTER:
+ case CMSG_REPOP_REQUEST:
+ case CMSG_PETITION_BUY:
+ case CMSG_TURN_IN_PETITION:
+ case CMSG_COMPLETE_CINEMATIC:
+ case CMSG_ITEM_REFUND:
+ case CMSG_SOCKET_GEMS:
+ case CMSG_WRAP_ITEM:
+ case CMSG_BUY_BANK_SLOT:
+ case CMSG_GROUP_ACCEPT:
+ case CMSG_GROUP_DECLINE:
+ case CMSG_GROUP_UNINVITE_GUID:
+ case CMSG_GROUP_UNINVITE:
+ case CMSG_GROUP_SET_LEADER:
+ case CMSG_GROUP_DISBAND:
+ case CMSG_GROUP_RAID_CONVERT:
+ case CMSG_GROUP_CHANGE_SUB_GROUP:
+ case CMSG_GROUP_ASSISTANT_LEADER:
+ case CMSG_OPT_OUT_OF_LOOT:
+ case CMSG_BATTLEMASTER_JOIN_ARENA:
+ case CMSG_LEAVE_BATTLEFIELD:
+ case CMSG_REPORT_PVP_AFK:
+ case CMSG_DUEL_ACCEPTED:
+ case CMSG_DUEL_CANCELLED:
+ case CMSG_CALENDAR_GET_CALENDAR:
+ case CMSG_CALENDAR_ADD_EVENT:
+ case CMSG_CALENDAR_UPDATE_EVENT:
+ case CMSG_CALENDAR_REMOVE_EVENT:
+ case CMSG_CALENDAR_COPY_EVENT:
+ case CMSG_CALENDAR_EVENT_INVITE:
+ case CMSG_CALENDAR_EVENT_SIGNUP:
+ case CMSG_CALENDAR_EVENT_RSVP:
+ case CMSG_CALENDAR_EVENT_REMOVE_INVITE:
+ case CMSG_CALENDAR_EVENT_MODERATOR_STATUS:
+ case CMSG_CALENDAR_COMPLAIN:
+ case CMSG_ARENA_TEAM_INVITE:
+ case CMSG_ARENA_TEAM_ACCEPT:
+ case CMSG_ARENA_TEAM_DECLINE:
+ case CMSG_ARENA_TEAM_LEAVE:
+ case CMSG_ARENA_TEAM_DISBAND:
+ case CMSG_ARENA_TEAM_REMOVE:
+ case CMSG_ARENA_TEAM_LEADER:
+ case CMSG_LOOT_METHOD:
+ case CMSG_GUILD_INVITE:
+ case CMSG_GUILD_ACCEPT:
+ case CMSG_GUILD_DECLINE:
+ case CMSG_GUILD_LEAVE:
+ case CMSG_GUILD_DISBAND:
+ case CMSG_GUILD_LEADER:
+ case CMSG_GUILD_MOTD:
+ case CMSG_GUILD_RANK:
+ case CMSG_GUILD_ADD_RANK:
+ case CMSG_GUILD_DEL_RANK:
+ case CMSG_GUILD_INFO_TEXT:
+ case CMSG_GUILD_BANK_DEPOSIT_MONEY:
+ case CMSG_GUILD_BANK_WITHDRAW_MONEY:
+ case CMSG_GUILD_BANK_BUY_TAB:
+ case CMSG_GUILD_BANK_UPDATE_TAB:
+ case CMSG_SET_GUILD_BANK_TEXT:
+ case MSG_SAVE_GUILD_EMBLEM:
+ case MSG_PETITION_RENAME:
+ case MSG_PETITION_DECLINE:
+ case MSG_TALENT_WIPE_CONFIRM:
+ case MSG_SET_DUNGEON_DIFFICULTY:
+ case MSG_SET_RAID_DIFFICULTY:
+ case MSG_RANDOM_ROLL:
+ case MSG_PARTY_ASSIGNMENT:
+ case MSG_RAID_READY_CHECK:
+ {
+ maxPacketCounterAllowed = 3;
+ break;
+ }
+
+ case CMSG_SET_ACTION_BUTTON:
+ {
+ maxPacketCounterAllowed = MAX_ACTION_BUTTONS;
+ break;
+ }
+
+ case CMSG_ITEM_REFUND_INFO:
+ {
+ maxPacketCounterAllowed = PLAYER_SLOTS_COUNT;
+ break;
+ }
+
+ default:
+ {
+ maxPacketCounterAllowed = 100;
+ break;
+ }
+ }
+
+ return maxPacketCounterAllowed;
+}
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 9d1a05ae753..2f5f17952db 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -28,9 +28,11 @@
#include "AddonMgr.h"
#include "DatabaseEnv.h"
#include "World.h"
+#include "Opcodes.h"
#include "WorldPacket.h"
#include "Cryptography/BigNumber.h"
#include "AccountMgr.h"
+#include <unordered_set>
class Creature;
class GameObject;
@@ -196,6 +198,12 @@ class CharacterCreateInfo
uint8 CharCount;
};
+struct PacketCounter
+{
+ time_t lastReceiveTime;
+ uint32 amountCounter;
+};
+
/// Player session in the World
class WorldSession
{
@@ -721,7 +729,6 @@ class WorldSession
void HandleCompleteCinematic(WorldPacket& recvPacket);
void HandleNextCinematicCamera(WorldPacket& recvPacket);
- void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket);
void HandlePageTextQueryOpcode(WorldPacket& recvPacket);
void HandleTutorialFlag (WorldPacket& recvData);
@@ -929,7 +936,7 @@ class WorldSession
friend class World;
public:
DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY)) { }
- bool EvaluateOpcode(WorldPacket& p) const;
+ bool EvaluateOpcode(WorldPacket& p, time_t time) const;
void AllowOpcode(uint16 opcode, bool allow) { _isOpcodeAllowed[opcode] = allow; }
protected:
enum Policy
@@ -948,12 +955,17 @@ class WorldSession
return itr->second;
}
+ uint32 GetMaxPacketCounterAllowed(uint16 opcode) const;
+
WorldSession* Session;
private:
typedef std::unordered_map<uint16, bool> OpcodeStatusMap;
OpcodeStatusMap _isOpcodeAllowed; // could be bool array, but wouldn't be practical for game versions with non-linear opcodes
Policy _policy;
+ typedef std::unordered_map<uint16, PacketCounter> PacketThrottlingMap;
+ // mark this member as "mutable" so it can be modified even in const functions
+ mutable PacketThrottlingMap _PacketThrottlingMap;
DosProtection(DosProtection const& right) = delete;
DosProtection& operator=(DosProtection const& right) = delete;
@@ -963,6 +975,8 @@ class WorldSession
// private trade methods
void moveItems(Item* myItems[], Item* hisItems[]);
+ bool CanUseBank(uint64 bankerGUID = 0) const;
+
// logging helper
void LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason);
void LogUnprocessedTail(WorldPacket* packet);
@@ -1008,8 +1022,10 @@ class WorldSession
uint32 recruiterId;
bool isRecruiter;
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
- time_t timeLastWhoCommand;
rbac::RBACData* _RBACData;
+ uint32 expireTime;
+ bool forceExit;
+ uint64 m_currentBankerGUID;
WorldSession(WorldSession const& right) = delete;
WorldSession& operator=(WorldSession const& right) = delete;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b87524357d2..a0883c895d3 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -380,7 +380,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* cast
m_base(base), m_spellInfo(base->GetSpellInfo()),
m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints),
m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
-m_canBeRecalculated(true), m_isPeriodic(false)
+m_canBeRecalculated(true), m_damage(0), m_critChance(0.0f), m_donePct(1.0f), m_isPeriodic(false)
{
CalculatePeriodic(caster, true, false);
@@ -890,19 +890,15 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
GetBase()->CallScriptEffectUpdatePeriodicHandlers(this);
}
-bool AuraEffect::IsPeriodicTickCrit(Unit* target, Unit const* caster) const
+bool AuraEffect::CanPeriodicTickCrit(Unit const* caster) const
{
ASSERT(caster);
- Unit::AuraEffectList const& mPeriodicCritAuras= caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
- for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
- {
- if ((*itr)->IsAffectedOnSpell(m_spellInfo) && caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()))
- return true;
- }
+ if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_ABILITY_PERIODIC_CRIT, m_spellInfo))
+ return true;
// Rupture - since 3.3.3 can crit
if (m_spellInfo->SpellIconID == 500 && m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
- return caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask());
+ return true;
return false;
}
@@ -1672,9 +1668,6 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (aurApp->GetRemoveMode())
return;
- if (modelid > 0)
- target->SetDisplayId(modelid);
-
if (PowerType != POWER_MANA)
{
uint32 oldPower = target->GetPower(PowerType);
@@ -1725,6 +1718,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
return;
target->SetShapeshiftForm(form);
+ if (modelid > 0)
+ {
+ SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
+ if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
+ target->SetDisplayId(modelid);
+ }
}
else
{
@@ -1847,9 +1846,11 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
- // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
- if (!target->GetModelForForm(target->GetShapeshiftForm()) || !GetSpellInfo()->IsPositive())
+ // update active transform spell only when transform not set or not overwriting negative by positive case
+ SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
+ if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
{
+ target->setTransForm(GetId());
// special case (spell specific functionality)
if (GetMiscValue() == 0)
{
@@ -2018,11 +2019,6 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
}
}
- // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
- SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
- if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
- target->setTransForm(GetId());
-
// polymorph case
if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
{
@@ -5780,15 +5776,19 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
uint32 resist = 0;
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- // ignore non positive values (can be result apply spellmods to aura damage
- uint32 damage = std::max(GetAmount(), 0);
+ // AOE spells are not affected by the new periodic system.
+ bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA);
+ // ignore negative values (can be result apply spellmods to aura damage
+ uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
// Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
- sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+ if (isAreaAura)
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
- damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ if (isAreaAura)
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT);
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
// Calculate armor mitigation
@@ -5844,19 +5844,25 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
else
damage = uint32(target->CountPctFromMaxHealth(damage));
- if (m_spellInfo->Effects[m_effIndex].IsTargetingArea() || m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
- {
- damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
- if (caster->GetTypeId() != TYPEID_PLAYER)
- damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
- }
+ if (!(m_spellInfo->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
+ if (m_spellInfo->Effects[m_effIndex].IsTargetingArea() || isAreaAura)
+ {
+ damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
+ if (caster->GetTypeId() != TYPEID_PLAYER)
+ damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
+ }
+
+ bool crit = false;
+
+ if (CanPeriodicTickCrit(caster))
+ crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
- bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
int32 dmg = damage;
- caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
+ if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
+ caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
damage = dmg;
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
@@ -5905,25 +5911,45 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
uint32 resist = 0;
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- uint32 damage = std::max(GetAmount(), 0);
+ bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA);
+ // ignore negative values (can be result apply spellmods to aura damage
+ uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
- damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ if (isAreaAura)
+ {
+ // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT);
+ }
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
- bool crit = IsPeriodicTickCrit(target, caster);
- if (crit)
- damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
-
// Calculate armor mitigation
- if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), m_effIndex))
+ if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex()))
{
uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellInfo());
cleanDamage.mitigated_damage += damage - damageReductedArmor;
damage = damageReductedArmor;
}
+ if (!(m_spellInfo->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
+ if (m_spellInfo->Effects[m_effIndex].IsTargetingArea() || isAreaAura)
+ {
+ damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
+ if (caster->GetTypeId() != TYPEID_PLAYER)
+ damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
+ }
+
+ bool crit = false;
+
+ if (CanPeriodicTickCrit(caster))
+ crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
+
+ if (crit)
+ damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
+
int32 dmg = damage;
- caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
+ if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
+ caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
damage = dmg;
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo);
@@ -6005,8 +6031,9 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
if (GetBase()->IsPermanent() && target->IsFullHealth())
return;
+ bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA);
// ignore negative values (can be result apply spellmods to aura damage
- int32 damage = std::max(m_amount, 0);
+ int32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH)
{
@@ -6054,12 +6081,16 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
damage += addition;
}
-
- damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ if (isAreaAura)
+ damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellHealingPctDone(target, m_spellInfo);
damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
}
- bool crit = IsPeriodicTickCrit(target, caster);
+ bool crit = false;
+
+ if (CanPeriodicTickCrit(caster))
+ crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
+
if (crit)
damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 0887ce123e2..5eec9021291 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -70,6 +70,13 @@ class AuraEffect
void HandleEffect(Unit* target, uint8 mode, bool apply);
void ApplySpellMod(Unit* target, bool apply);
+ void SetDamage(int32 val) { m_damage = val; }
+ int32 GetDamage() const { return m_damage; }
+ void SetCritChance(float val) { m_critChance = val; }
+ float GetCritChance() const { return m_critChance; }
+ void SetDonePct(float val) { m_donePct = val; }
+ float GetDonePct() const { return m_donePct; }
+
void Update(uint32 diff, Unit* caster);
void UpdatePeriodic(Unit* caster);
@@ -98,6 +105,9 @@ class AuraEffect
int32 const m_baseAmount;
int32 m_amount;
+ int32 m_damage;
+ float m_critChance;
+ float m_donePct;
SpellModifier* m_spellmod;
@@ -109,7 +119,7 @@ class AuraEffect
bool m_canBeRecalculated;
bool m_isPeriodic;
private:
- bool IsPeriodicTickCrit(Unit* target, Unit const* caster) const;
+ bool CanPeriodicTickCrit(Unit const* caster) const;
public:
// aura effect apply/remove handlers
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 3e1763e6c5b..683059b8e99 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -746,9 +746,20 @@ void Aura::SetDuration(int32 duration, bool withMods)
SetNeedClientUpdateForTargets();
}
-void Aura::RefreshDuration()
+void Aura::RefreshDuration(bool withMods)
{
- SetDuration(GetMaxDuration());
+ if (withMods)
+ {
+ int32 duration = m_spellInfo->GetMaxDuration();
+ // Calculate duration of periodics affected by haste.
+ if (GetCaster()->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
+ duration = int32(duration * GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
+
+ SetMaxDuration(duration);
+ SetDuration(duration);
+ }
+ else
+ SetDuration(GetMaxDuration());
if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
@@ -825,7 +836,10 @@ void Aura::SetStackAmount(uint8 stackAmount)
for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
if (!(*apptItr)->GetRemoveMode())
+ {
HandleAuraSpecificMods(*apptItr, caster, true, true);
+ HandleAuraSpecificPeriodics(*apptItr, caster);
+ }
SetNeedClientUpdateForTargets();
}
@@ -1631,26 +1645,62 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
}
break;
- case SPELLFAMILY_WARLOCK:
- // Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
- if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)
+ }
+}
+
+void Aura::HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* caster)
+{
+ Unit* target = aurApp->GetTarget();
+
+ if (!caster || aurApp->GetRemoveMode())
+ return;
+
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (!HasEffect(i))
+ continue;
+
+ if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
+ continue;
+
+ switch (m_spellInfo->Effects[i].ApplyAuraName)
+ {
+ case SPELL_AURA_PERIODIC_DAMAGE:
+ case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
+ case SPELL_AURA_PERIODIC_LEECH:
{
- if (!caster)
- break;
- if (apply)
- {
- if (target != caster && !target->HealthAbovePct(25))
- caster->CastSpell(caster, 100001, true);
- }
- else
- {
- if (target != caster)
- caster->RemoveAurasDueToSpell(GetId());
- else
- caster->RemoveAurasDueToSpell(100001);
- }
+ AuraEffect* aurEff = GetEffect(i);
+
+ // ignore non positive values (can be result apply spellmods to aura damage
+ uint32 damage = std::max(aurEff->GetAmount(), 0);
+
+ // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+
+ aurEff->SetDonePct(caster->SpellDamagePctDone(target, m_spellInfo, DOT)); // Calculate done percentage first!
+ aurEff->SetDamage(caster->SpellDamageBonusDone(target, m_spellInfo, damage, DOT, GetStackAmount()) * aurEff->GetDonePct());
+ aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
+ break;
}
- break;
+ case SPELL_AURA_PERIODIC_HEAL:
+ case SPELL_AURA_OBS_MOD_HEALTH:
+ {
+ AuraEffect* aurEff = GetEffect(i);
+
+ // ignore non positive values (can be result apply spellmods to aura damage
+ uint32 damage = std::max(aurEff->GetAmount(), 0);
+
+ // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+
+ aurEff->SetDonePct(caster->SpellHealingPctDone(target, m_spellInfo)); // Calculate done percentage first!
+ aurEff->SetDamage(caster->SpellHealingBonusDone(target, m_spellInfo, damage, DOT, GetStackAmount()) * aurEff->GetDonePct());
+ aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
+ break;
+ }
+ default:
+ break;
+ }
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index f62b1ff47b4..669d2a529a1 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -129,7 +129,7 @@ class Aura
int32 CalcMaxDuration(Unit* caster) const;
int32 GetDuration() const { return m_duration; }
void SetDuration(int32 duration, bool withMods = false);
- void RefreshDuration();
+ void RefreshDuration(bool withMods = false);
void RefreshTimers();
bool IsExpired() const { return !GetDuration();}
bool IsPermanent() const { return GetMaxDuration() == -1; }
@@ -190,6 +190,7 @@ class Aura
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
+ void HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* caster);
bool CanBeAppliedOn(Unit* target);
bool CheckAreaTarget(Unit* target);
bool CanStackWith(Aura const* existingAura) const;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 768c0b7e818..ca170187e82 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -567,7 +567,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
m_spellState = SPELL_STATE_NULL;
_triggeredCastFlags = triggerFlags;
if (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED)
- _triggeredCastFlags = TRIGGERED_FULL_MASK;
+ _triggeredCastFlags = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT);
m_CastItem = NULL;
m_castItemGUID = 0;
@@ -2340,7 +2340,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Do healing and triggers
if (m_healing > 0)
{
- bool crit = caster->isSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask);
+ bool crit = caster->IsSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask);
uint32 addhealth = m_healing;
if (crit)
{
@@ -4188,7 +4188,7 @@ void Spell::SendChannelStart(uint32 duration)
void Spell::SendResurrectRequest(Player* target)
{
- // get ressurector name for creature resurrections, otherwise packet will be not accepted
+ // get resurrector name for creature resurrections, otherwise packet will be not accepted
// for player resurrections the name is looked up by guid
std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER
? ""
@@ -6729,7 +6729,7 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
}
}
- targetInfo.crit = m_caster->isSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType);
+ targetInfo.crit = m_caster->IsSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType);
}
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 65530b4b282..6df87228f3e 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -259,7 +259,7 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
Player* target = unitTarget->ToPlayer();
- if (target->isRessurectRequested()) // already have one active request
+ if (target->isResurrectRequested()) // already have one active request
return;
uint32 health = damage;
@@ -4056,15 +4056,40 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
{
// Get diseases on target of spell
if (m_targets.GetUnitTarget() && // Glyph of Disease - cast on unit target too to refresh aura
- (m_targets.GetUnitTarget() != unitTarget || m_caster->GetAura(63334)))
+ (m_targets.GetUnitTarget() != unitTarget || m_caster->HasAura(63334)))
{
// And spread them on target
// Blood Plague
- if (m_targets.GetUnitTarget()->GetAura(55078))
+ if (m_targets.GetUnitTarget()->HasAura(55078))
+ {
+ AuraEffect* aurEffOld = m_targets.GetUnitTarget()->GetAura(55078)->GetEffect(0);
+ float donePct = aurEffOld->GetDonePct();
+ float critChance = aurEffOld->GetCritChance();
+
m_caster->CastSpell(unitTarget, 55078, true);
+
+ if (unitTarget->HasAura(55078))
+ if (AuraEffect* aurEffNew = unitTarget->GetAura(55078)->GetEffect(0))
+ {
+ aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9.
+ aurEffNew->SetDonePct(donePct);
+ aurEffNew->SetDamage(m_caster->SpellDamageBonusDone(unitTarget, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
+ }
+ }
// Frost Fever
- if (m_targets.GetUnitTarget()->GetAura(55095))
+ if (m_targets.GetUnitTarget()->HasAura(55095))
+ {
+ float donePct = m_targets.GetUnitTarget()->GetAura(55095)->GetEffect(0)->GetDonePct();
+
m_caster->CastSpell(unitTarget, 55095, true);
+
+ if (unitTarget->HasAura(55095))
+ if (AuraEffect* aurEffNew = unitTarget->GetAura(55095)->GetEffect(0))
+ {
+ aurEffNew->SetDonePct(donePct);
+ aurEffNew->SetDamage(m_caster->SpellDamageBonusDone(unitTarget, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
+ }
+ }
}
}
break;
@@ -4542,7 +4567,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
Player* target = unitTarget->ToPlayer();
- if (target->isRessurectRequested()) // already have one active request
+ if (target->isResurrectRequested()) // already have one active request
return;
uint32 health = target->CountPctFromMaxHealth(damage);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 21c36510a32..ba4c3deca85 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -24,6 +24,7 @@
#include "Player.h"
#include "Battleground.h"
#include "Vehicle.h"
+#include "Pet.h"
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
@@ -1505,8 +1506,16 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
// creature/player specific target checks
if (unitTarget)
{
- if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && unitTarget->IsInCombat())
- return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT)
+ {
+ if (unitTarget->IsInCombat())
+ return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ // player with active pet counts as a player in combat
+ else if (Player const* player = unitTarget->ToPlayer())
+ if (Pet* pet = player->GetPet())
+ if (pet->GetVictim() && !pet->HasUnitState(UNIT_STATE_CONTROLLED))
+ return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ }
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
if (((AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST))
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 501cb1e77f2..b94d0def3dd 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -784,14 +784,14 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell
bool hasFamilyMask = false;
- /**
-
+ /**
+
* @brief Check auras procced by periodics
*Only damaging Dots can proc auras with PROC_FLAG_TAKEN_DAMAGE
*Only Dots can proc if ONLY has PROC_FLAG_DONE_PERIODIC or PROC_FLAG_TAKEN_PERIODIC.
-
+
*Hots can proc if ONLY has PROC_FLAG_DONE_PERIODIC and spellfamily != 0
*Only Dots can proc auras with PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG or PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
@@ -806,7 +806,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell
* @param procFlags proc_flags of spellProc
* @param procExtra proc_EX of procSpell
* @param EventProcFlag proc_flags of aura to be procced
- * @param spellProto SpellInfo of aura to be procced
+ * @param spellProto SpellInfo of aura to be procced
*/
@@ -815,7 +815,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell
return true;
if (procFlags & PROC_FLAG_DONE_PERIODIC && EventProcFlag & PROC_FLAG_DONE_PERIODIC)
- {
+ {
if (procExtra & PROC_EX_INTERNAL_HOT)
{
if (EventProcFlag == PROC_FLAG_DONE_PERIODIC)
@@ -835,7 +835,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell
}
if (procFlags & PROC_FLAG_TAKEN_PERIODIC && EventProcFlag & PROC_FLAG_TAKEN_PERIODIC)
- {
+ {
if (procExtra & PROC_EX_INTERNAL_HOT)
{
/// No aura that only has PROC_FLAG_TAKEN_PERIODIC can proc from a HOT.
@@ -3207,6 +3207,9 @@ void SpellMgr::LoadSpellInfoCorrections()
case 63675: // Improved Devouring Plague
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS;
break;
+ case 12721: // Deep Wounds shouldnt ignore resillience or damage taken auras because its damage is not based off a spell.
+ spellInfo->AttributesEx4 = 0;
+ break;
case 8145: // Tremor Totem (instant pulse)
case 6474: // Earthbind Totem (instant pulse)
spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY;
@@ -3382,6 +3385,9 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd
spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd
break;
+ case 72830: // Achievement Check
+ spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ break;
case 72900: // Start Halls of Reflection Quest AE
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
break;
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 75a191a9801..32b8781fb89 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -249,7 +249,7 @@ class SpellScript : public _SpellScript
class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) { } }; \
class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) { } }; \
class ObjectTargetSelectHandlerFunction : public SpellScript::ObjectTargetSelectHandler { public: ObjectTargetSelectHandlerFunction(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectTargetSelectHandler((SpellScript::SpellObjectTargetSelectFnType)_pObjectTargetSelectHandlerScript, _effIndex, _targetType) { } }; \
- class DestinationTargetSelectHandlerFunction : public SpellScript::DestinationTargetSelectHandler { public: DestinationTargetSelectHandlerFunction(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::DestinationTargetSelectHandler((SpellScript::SpellDestinationTargetSelectFnType)_DestinationTargetSelectHandlerScript, _effIndex, _targetType) { } };
+ class DestinationTargetSelectHandlerFunction : public SpellScript::DestinationTargetSelectHandler { public: DestinationTargetSelectHandlerFunction(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::DestinationTargetSelectHandler((SpellScript::SpellDestinationTargetSelectFnType)_DestinationTargetSelectHandlerScript, _effIndex, _targetType) { } }
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
public:
@@ -623,7 +623,7 @@ class AuraScript : public _SpellScript
class EffectSplitFunction : public AuraScript::EffectSplitHandler { public: EffectSplitFunction(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectSplitHandler((AuraScript::AuraEffectSplitFnType)_pEffectHandlerScript, _effIndex) { } }; \
class CheckProcHandlerFunction : public AuraScript::CheckProcHandler { public: CheckProcHandlerFunction(AuraCheckProcFnType handlerScript) : AuraScript::CheckProcHandler((AuraScript::AuraCheckProcFnType)handlerScript) { } }; \
class AuraProcHandlerFunction : public AuraScript::AuraProcHandler { public: AuraProcHandlerFunction(AuraProcFnType handlerScript) : AuraScript::AuraProcHandler((AuraScript::AuraProcFnType)handlerScript) { } }; \
- class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) { } }; \
+ class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) { } }
#define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 57690d7e5c1..8bd7a5a5e71 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -24,6 +24,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CreatureTextMgr.h"
+#include "Group.h"
class CreatureTextBuilder
{
@@ -346,6 +347,18 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
}
break;
}
+ case CHAT_MSG_MONSTER_PARTY:
+ if (!whisperTarget)
+ return;
+
+ if (Player const* player = whisperTarget->ToPlayer())
+ {
+ if (Group* group = const_cast<Group*>(player->GetGroup()))
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ if (Player* member = itr->GetSource())
+ member->GetSession()->SendPacket(data);
+ }
+ return;
default:
break;
}
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index b9ecfffb8c3..71d51153b4c 100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -233,7 +233,7 @@ void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
std::stringstream ss(log);
std::stringstream newss;
std::string line;
- while (std::getline(ss, line))
+ while (std::getline(ss, line) && !time.empty())
{
newss << secsToTimeString(time.front()) << ": " << line << "\n";
time.pop_front();
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index 42872bba22e..0810295c0cc 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -223,7 +223,7 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
{
- if (!_warden)
+ if (!_warden || recvData.empty())
return;
_warden->DecryptData(recvData.contents(), recvData.size());
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index cb332df9a41..8d39f553910 100644
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -28,7 +28,7 @@
#include "ObjectMgr.h"
#include "Util.h"
#include "ScriptMgr.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
/// Create the Weather object
Weather::Weather(uint32 zone, WeatherData const* weatherChances)
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 59dc591ccd0..5cf5cde75fd 100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -27,7 +27,7 @@
#include "AutoPtr.h"
#include "Player.h"
#include "WorldPacket.h"
-#include "Opcodes.h"
+#include "WorldSession.h"
namespace WeatherMgr
{
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index f2f11801229..5dbe95b3e54 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1020,7 +1020,7 @@ public:
}
else
{
- if (newmoney > MAX_MONEY_AMOUNT)
+ if (newmoney > static_cast<int32>(MAX_MONEY_AMOUNT))
newmoney = MAX_MONEY_AMOUNT;
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str());
@@ -1035,10 +1035,7 @@ public:
if (handler->needReportToTarget(target))
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd);
- if (moneyToAdd >= MAX_MONEY_AMOUNT)
- moneyToAdd = MAX_MONEY_AMOUNT;
-
- if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd)
+ if (targetMoney >= MAX_MONEY_AMOUNT - moneyToAdd)
moneyToAdd -= targetMoney;
target->ModifyMoney(moneyToAdd);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a0df1292210..28d49fe11aa 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -715,6 +715,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
+ handler->PSendSysMessage(LANG_NPCINFO_INHABIT_TYPE, cInfo->InhabitType);
handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS));
for (uint8 i = 0; i < MAX_UNIT_FLAGS; ++i)
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 83b716728ea..47e91cac63d 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -82,7 +82,7 @@ public:
// check if creature is not outside of building
if (resetTimer < diff)
{
- if (Creature* pBalinda = Unit::GetCreature(*me, balindaGUID))
+ if (Creature* pBalinda = ObjectAccessor::GetCreature(*me, balindaGUID))
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
resetTimer = 5 * IN_MILLISECONDS;
@@ -212,4 +212,4 @@ void AddSC_boss_balinda()
{
new boss_balinda;
new npc_water_elemental;
-};
+}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 1ab2d746aa5..3eab75cfd76 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -229,7 +229,7 @@ public:
if (RingBossGUID)
{
- Creature* boss = Unit::GetCreature(*me, RingBossGUID);
+ Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID);
if (boss && !boss->IsAlive() && boss->isDead())
{
RingBossGUID = 0;
@@ -242,7 +242,7 @@ public:
for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i)
{
- Creature* mob = Unit::GetCreature(*me, RingMobGUID[i]);
+ Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]);
if (mob && !mob->IsAlive() && mob->isDead())
{
RingMobGUID[i] = 0;
@@ -1304,7 +1304,7 @@ public:
DoGo(DATA_GO_BAR_KEG_TRAP, 0); //doesn't work very well, leaving code here for future
//spell by trap has effect61, this indicate the bar go hostile
- if (Unit* tmp = Unit::GetUnit(*me, instance->GetData64(DATA_PHALANX)))
+ if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PHALANX)))
tmp->setFaction(14);
//for later, this event(s) has alot more to it.
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
index 4ac039e9138..3e4097daf20 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -24,64 +23,74 @@ enum Spells
SPELL_FIREBLAST = 15573
};
-class boss_ambassador_flamelash : public CreatureScript
+enum Events
{
-public:
- boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_ambassador_flamelashAI(creature);
- }
-
- struct boss_ambassador_flamelashAI : public ScriptedAI
- {
- boss_ambassador_flamelashAI(Creature* creature) : ScriptedAI(creature) { }
+ EVENT_FIREBLAST = 1,
+ EVENT_SUMMON_SPIRITS = 2
+};
- uint32 FireBlast_Timer;
- uint32 Spirit_Timer;
+class boss_ambassador_flamelash : public CreatureScript
+{
+ public:
+ boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { }
- void Reset() override
+ struct boss_ambassador_flamelashAI : public ScriptedAI
{
- FireBlast_Timer = 2000;
- Spirit_Timer = 24000;
- }
+ boss_ambassador_flamelashAI(Creature* creature) : ScriptedAI(creature) { }
- void EnterCombat(Unit* /*who*/) override { }
-
- void SummonSpirits(Unit* victim)
- {
- if (Creature* Spirit = DoSpawnCreature(9178, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
- Spirit->AI()->AttackStart(victim);
- }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- void UpdateAI(uint32 diff) override
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_FIREBLAST, 2000);
+ _events.ScheduleEvent(EVENT_SUMMON_SPIRITS, 24000);
+ }
- //FireBlast_Timer
- if (FireBlast_Timer <= diff)
+ void SummonSpirit(Unit* victim)
{
- DoCastVictim(SPELL_FIREBLAST);
- FireBlast_Timer = 7000;
- } else FireBlast_Timer -= diff;
+ if (Creature* spirit = DoSpawnCreature(9178, frand(-9, 9), frand(-9, 9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
+ spirit->AI()->AttackStart(victim);
+ }
- //Spirit_Timer
- if (Spirit_Timer <= diff)
+ void UpdateAI(uint32 diff) override
{
- SummonSpirits(me->GetVictim());
- SummonSpirits(me->GetVictim());
- SummonSpirits(me->GetVictim());
- SummonSpirits(me->GetVictim());
+ if (!UpdateVictim())
+ return;
- Spirit_Timer = 30000;
- } else Spirit_Timer -= diff;
+ _events.Update(diff);
- DoMeleeAttackIfReady();
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_FIREBLAST:
+ DoCastVictim(SPELL_FIREBLAST);
+ _events.ScheduleEvent(EVENT_FIREBLAST, 7000);
+ break;
+ case EVENT_SUMMON_SPIRITS:
+ for (uint32 i = 0; i < 4; ++i)
+ SummonSpirit(me->GetVictim());
+ _events.ScheduleEvent(EVENT_SUMMON_SPIRITS, 30000);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_ambassador_flamelashAI(creature);
}
- };
};
void AddSC_boss_ambassador_flamelash()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp
index fd8b77ea8d4..894b528c03c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -21,90 +20,94 @@
enum Spells
{
- SPELL_SHADOWBOLT = 17228,
- SPELL_CURSEOFTONGUES = 15470,
- SPELL_CURSEOFWEAKNESS = 17227,
- SPELL_DEMONARMOR = 11735,
- SPELL_ENVELOPINGWEB = 15471
+ SPELL_SHADOWBOLT = 17228,
+ SPELL_CURSEOFTONGUES = 15470,
+ SPELL_CURSEOFWEAKNESS = 17227,
+ SPELL_DEMONARMOR = 11735,
+ SPELL_ENVELOPINGWEB = 15471
};
-class boss_anubshiah : public CreatureScript
+enum Events
{
-public:
- boss_anubshiah() : CreatureScript("boss_anubshiah") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_anubshiahAI(creature);
- }
-
- struct boss_anubshiahAI : public ScriptedAI
- {
- boss_anubshiahAI(Creature* creature) : ScriptedAI(creature) { }
-
- uint32 ShadowBolt_Timer;
- uint32 CurseOfTongues_Timer;
- uint32 CurseOfWeakness_Timer;
- uint32 DemonArmor_Timer;
- uint32 EnvelopingWeb_Timer;
-
- void Reset() override
- {
- ShadowBolt_Timer = 7000;
- CurseOfTongues_Timer = 24000;
- CurseOfWeakness_Timer = 12000;
- DemonArmor_Timer = 3000;
- EnvelopingWeb_Timer = 16000;
- }
+ EVENT_SHADOWBOLT = 1,
+ EVENT_CURSE_OF_TONGUES = 2,
+ EVENT_CURSE_OF_WEAKNESS = 3,
+ EVENT_DEMON_ARMOR = 4,
+ EVENT_ENVELOPING_WEB = 5
+};
- void EnterCombat(Unit* /*who*/) override { }
+class boss_anubshiah : public CreatureScript
+{
+ public:
+ boss_anubshiah() : CreatureScript("boss_anubshiah") { }
- void UpdateAI(uint32 diff) override
+ struct boss_anubshiahAI : public ScriptedAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- //ShadowBolt_Timer
- if (ShadowBolt_Timer <= diff)
- {
- DoCastVictim(SPELL_SHADOWBOLT);
- ShadowBolt_Timer = 7000;
- } else ShadowBolt_Timer -= diff;
-
- //CurseOfTongues_Timer
- if (CurseOfTongues_Timer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_CURSEOFTONGUES);
- CurseOfTongues_Timer = 18000;
- } else CurseOfTongues_Timer -= diff;
+ boss_anubshiahAI(Creature* creature) : ScriptedAI(creature) { }
- //CurseOfWeakness_Timer
- if (CurseOfWeakness_Timer <= diff)
+ void Reset() override
{
- DoCastVictim(SPELL_CURSEOFWEAKNESS);
- CurseOfWeakness_Timer = 45000;
- } else CurseOfWeakness_Timer -= diff;
+ _events.Reset();
+ }
- //DemonArmor_Timer
- if (DemonArmor_Timer <= diff)
+ void EnterCombat(Unit* /*who*/) override
{
- DoCast(me, SPELL_DEMONARMOR);
- DemonArmor_Timer = 300000;
- } else DemonArmor_Timer -= diff;
-
- //EnvelopingWeb_Timer
- if (EnvelopingWeb_Timer <= diff)
+ _events.ScheduleEvent(EVENT_SHADOWBOLT, 7000);
+ _events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 24000);
+ _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 12000);
+ _events.ScheduleEvent(EVENT_DEMON_ARMOR, 3000);
+ _events.ScheduleEvent(EVENT_ENVELOPING_WEB, 16000);
+ }
+
+ void UpdateAI(uint32 diff) override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_ENVELOPINGWEB);
- EnvelopingWeb_Timer = 12000;
- } else EnvelopingWeb_Timer -= diff;
-
- DoMeleeAttackIfReady();
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SHADOWBOLT:
+ DoCast(me, SPELL_SHADOWBOLT);
+ _events.ScheduleEvent(EVENT_SHADOWBOLT, 7000);
+ break;
+ case EVENT_CURSE_OF_TONGUES:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
+ DoCast(target, SPELL_CURSEOFTONGUES);
+ _events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 18000);
+ break;
+ case EVENT_CURSE_OF_WEAKNESS:
+ DoCastVictim(SPELL_CURSEOFWEAKNESS);
+ _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 45000);
+ break;
+ case EVENT_DEMON_ARMOR:
+ DoCast(me, SPELL_DEMONARMOR);
+ _events.ScheduleEvent(EVENT_DEMON_ARMOR, 300000);
+ break;
+ case EVENT_ENVELOPING_WEB:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
+ DoCast(target, SPELL_ENVELOPINGWEB);
+ _events.ScheduleEvent(EVENT_ENVELOPING_WEB, 12000);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_anubshiahAI(creature);
}
- };
};
void AddSC_boss_anubshiah()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index fffdf9c7514..cec29bcd4d1 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -32,89 +31,89 @@ enum Spells
SPELL_AVATAROFFLAME = 15636
};
-class boss_emperor_dagran_thaurissan : public CreatureScript
+enum Events
{
-public:
- boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_draganthaurissanAI>(creature);
- }
-
- struct boss_draganthaurissanAI : public ScriptedAI
- {
- boss_draganthaurissanAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = me->GetInstanceScript();
- }
-
- InstanceScript* instance;
- uint32 HandOfThaurissan_Timer;
- uint32 AvatarOfFlame_Timer;
- //uint32 Counter;
+ EVENT_HANDOFTHAURISSAN = 1,
+ EVENT_AVATAROFFLAME = 2
+};
- void Reset() override
- {
- HandOfThaurissan_Timer = 4000;
- AvatarOfFlame_Timer = 25000;
- //Counter= 0;
- }
+class boss_emperor_dagran_thaurissan : public CreatureScript
+{
+ public:
+ boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { }
- void EnterCombat(Unit* /*who*/) override
+ struct boss_draganthaurissanAI : public ScriptedAI
{
- Talk(SAY_AGGRO);
- me->CallForHelp(VISIBLE_RANGE);
- }
+ boss_draganthaurissanAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = me->GetInstanceScript();
+ }
- void KilledUnit(Unit* /*victim*/) override
- {
- Talk(SAY_SLAY);
- }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- void JustDied(Unit* /*killer*/) override
- {
- if (Creature* Moira = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOIRA)))
+ void EnterCombat(Unit* /*who*/) override
{
- Moira->AI()->EnterEvadeMode();
- Moira->setFaction(35);
+ Talk(SAY_AGGRO);
+ me->CallForHelp(VISIBLE_RANGE);
+ _events.ScheduleEvent(EVENT_HANDOFTHAURISSAN, 4000);
+ _events.ScheduleEvent(EVENT_AVATAROFFLAME, 25000);
}
- }
- void UpdateAI(uint32 diff) override
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ void KilledUnit(Unit* who) override
+ {
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
+ }
- if (HandOfThaurissan_Timer <= diff)
+ void JustDied(Unit* /*killer*/) override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_HANDOFTHAURISSAN);
-
- //3 Hands of Thaurissan will be cast
- //if (Counter < 3)
- //{
- // HandOfThaurissan_Timer = 1000;
- // ++Counter;
- //}
- //else
- //{
- HandOfThaurissan_Timer = 5000;
- //Counter = 0;
- //}
- } else HandOfThaurissan_Timer -= diff;
-
- //AvatarOfFlame_Timer
- if (AvatarOfFlame_Timer <= diff)
+ if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MOIRA)))
+ {
+ moira->AI()->EnterEvadeMode();
+ moira->setFaction(35);
+ }
+ }
+
+ void UpdateAI(uint32 diff) override
{
- DoCastVictim(SPELL_AVATAROFFLAME);
- AvatarOfFlame_Timer = 18000;
- } else AvatarOfFlame_Timer -= diff;
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_HANDOFTHAURISSAN:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_HANDOFTHAURISSAN);
+ _events.ScheduleEvent(EVENT_HANDOFTHAURISSAN, 5000);
+ break;
+ case EVENT_AVATAROFFLAME:
+ DoCastVictim(SPELL_AVATAROFFLAME);
+ _events.ScheduleEvent(EVENT_AVATAROFFLAME, 18000);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ InstanceScript* _instance;
+ EventMap _events;
+ };
- DoMeleeAttackIfReady();
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetInstanceAI<boss_draganthaurissanAI>(creature);
}
- };
};
void AddSC_boss_draganthaurissan()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
index 34ce2276a54..d5b8d1deadd 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -26,101 +25,113 @@ enum Spells
SPELL_CLEAVE = 20691
};
-class boss_general_angerforge : public CreatureScript
+enum Events
{
-public:
- boss_general_angerforge() : CreatureScript("boss_general_angerforge") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_general_angerforgeAI(creature);
- }
-
- struct boss_general_angerforgeAI : public ScriptedAI
- {
- boss_general_angerforgeAI(Creature* creature) : ScriptedAI(creature) { }
-
- uint32 MightyBlow_Timer;
- uint32 HamString_Timer;
- uint32 Cleave_Timer;
- uint32 Adds_Timer;
- bool Medics;
-
- void Reset() override
- {
- MightyBlow_Timer = 8000;
- HamString_Timer = 12000;
- Cleave_Timer = 16000;
- Adds_Timer = 0;
- Medics = false;
- }
-
- void EnterCombat(Unit* /*who*/) override { }
+ EVENT_MIGHTYBLOW = 1,
+ EVENT_HAMSTRING = 2,
+ EVENT_CLEAVE = 3,
+ EVENT_MEDIC = 4,
+ EVENT_ADDS = 5
+};
- void SummonAdds(Unit* victim)
- {
- if (Creature* SummonedAdd = DoSpawnCreature(8901, float(irand(-14, 14)), float(irand(-14, 14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
- SummonedAdd->AI()->AttackStart(victim);
- }
+enum Phases
+{
+ PHASE_ONE = 1,
+ PHASE_TWO = 2
+};
- void SummonMedics(Unit* victim)
- {
- if (Creature* SummonedMedic = DoSpawnCreature(8894, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
- SummonedMedic->AI()->AttackStart(victim);
- }
+class boss_general_angerforge : public CreatureScript
+{
+ public:
+ boss_general_angerforge() : CreatureScript("boss_general_angerforge") { }
- void UpdateAI(uint32 diff) override
+ struct boss_general_angerforgeAI : public ScriptedAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ boss_general_angerforgeAI(Creature* creature) : ScriptedAI(creature) { }
- //MightyBlow_Timer
- if (MightyBlow_Timer <= diff)
+ void Reset() override
{
- DoCastVictim(SPELL_MIGHTYBLOW);
- MightyBlow_Timer = 18000;
- } else MightyBlow_Timer -= diff;
+ _events.Reset();
+ }
- //HamString_Timer
- if (HamString_Timer <= diff)
+ void EnterCombat(Unit* /*who*/) override
{
- DoCastVictim(SPELL_HAMSTRING);
- HamString_Timer = 15000;
- } else HamString_Timer -= diff;
+ _events.SetPhase(PHASE_ONE);
+ _events.ScheduleEvent(EVENT_MIGHTYBLOW, 8000);
+ _events.ScheduleEvent(EVENT_HAMSTRING, 12000);
+ _events.ScheduleEvent(EVENT_CLEAVE, 16000);
+ }
- //Cleave_Timer
- if (Cleave_Timer <= diff)
+ void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
- DoCastVictim(SPELL_CLEAVE);
- Cleave_Timer = 9000;
- } else Cleave_Timer -= diff;
+ if (me->HealthBelowPctDamaged(20, damage) && _events.IsInPhase(PHASE_ONE))
+ {
+ _events.SetPhase(PHASE_TWO);
+ _events.ScheduleEvent(EVENT_MEDIC, 0, 0, PHASE_TWO);
+ _events.ScheduleEvent(EVENT_ADDS, 0, 0, PHASE_TWO);
+ }
+ }
- //Adds_Timer
- if (HealthBelowPct(21))
+ void SummonAdd(Unit* victim)
{
- if (Adds_Timer <= diff)
- {
- // summon 3 Adds every 25s
- SummonAdds(me->GetVictim());
- SummonAdds(me->GetVictim());
- SummonAdds(me->GetVictim());
+ if (Creature* SummonedAdd = DoSpawnCreature(8901, float(irand(-14, 14)), float(irand(-14, 14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ SummonedAdd->AI()->AttackStart(victim);
+ }
- Adds_Timer = 25000;
- } else Adds_Timer -= diff;
+ void SummonMedic(Unit* victim)
+ {
+ if (Creature* SummonedMedic = DoSpawnCreature(8894, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ SummonedMedic->AI()->AttackStart(victim);
}
- //Summon Medics
- if (!Medics && HealthBelowPct(21))
+ void UpdateAI(uint32 diff) override
{
- SummonMedics(me->GetVictim());
- SummonMedics(me->GetVictim());
- Medics = true;
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_MIGHTYBLOW:
+ DoCastVictim(SPELL_MIGHTYBLOW);
+ _events.ScheduleEvent(EVENT_MIGHTYBLOW, 18000);
+ break;
+ case EVENT_HAMSTRING:
+ DoCastVictim(SPELL_HAMSTRING);
+ _events.ScheduleEvent(EVENT_HAMSTRING, 15000);
+ break;
+ case EVENT_CLEAVE:
+ DoCastVictim(SPELL_CLEAVE);
+ _events.ScheduleEvent(EVENT_CLEAVE, 9000);
+ break;
+ case EVENT_MEDIC:
+ for (uint8 i = 0; i < 2; ++i)
+ SummonMedic(me->GetVictim());
+ break;
+ case EVENT_ADDS:
+ for (uint8 i = 0; i < 3; ++i)
+ SummonAdd(me->GetVictim());
+ _events.ScheduleEvent(EVENT_ADDS, 25000, 0, PHASE_TWO);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
}
- DoMeleeAttackIfReady();
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_general_angerforgeAI(creature);
}
- };
};
void AddSC_boss_general_angerforge()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp
index b5998576f24..e9034e17d83 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -25,56 +24,67 @@ enum Spells
SPELL_MORTALSTRIKE = 24573
};
+enum Events
+{
+ EVENT_WHIRLWIND = 1,
+ EVENT_MORTALSTRIKE = 2
+};
+
class boss_gorosh_the_dervish : public CreatureScript
{
-public:
- boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { }
+ public:
+ boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_gorosh_the_dervishAI(creature);
- }
+ struct boss_gorosh_the_dervishAI : public ScriptedAI
+ {
+ boss_gorosh_the_dervishAI(Creature* creature) : ScriptedAI(creature) { }
- struct boss_gorosh_the_dervishAI : public ScriptedAI
- {
- boss_gorosh_the_dervishAI(Creature* creature) : ScriptedAI(creature) { }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- uint32 WhirlWind_Timer;
- uint32 MortalStrike_Timer;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_WHIRLWIND, 12000);
+ _events.ScheduleEvent(EVENT_MORTALSTRIKE, 22000);
+ }
- void Reset() override
- {
- WhirlWind_Timer = 12000;
- MortalStrike_Timer = 22000;
- }
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- void EnterCombat(Unit* /*who*/) override
- {
- }
+ _events.Update(diff);
- void UpdateAI(uint32 diff) override
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_WHIRLWIND:
+ DoCast(me, SPELL_WHIRLWIND);
+ _events.ScheduleEvent(EVENT_WHIRLWIND, 15000);
+ break;
+ case EVENT_MORTALSTRIKE:
+ DoCastVictim(SPELL_MORTALSTRIKE);
+ _events.ScheduleEvent(EVENT_MORTALSTRIKE, 15000);
+ break;
+ default:
+ break;
+ }
+ }
- //WhirlWind_Timer
- if (WhirlWind_Timer <= diff)
- {
- DoCast(me, SPELL_WHIRLWIND);
- WhirlWind_Timer = 15000;
- } else WhirlWind_Timer -= diff;
+ DoMeleeAttackIfReady();
+ }
- //MortalStrike_Timer
- if (MortalStrike_Timer <= diff)
- {
- DoCastVictim(SPELL_MORTALSTRIKE);
- MortalStrike_Timer = 15000;
- } else MortalStrike_Timer -= diff;
+ private:
+ EventMap _events;
+ };
- DoMeleeAttackIfReady();
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_gorosh_the_dervishAI(creature);
}
- };
};
void AddSC_boss_gorosh_the_dervish()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp
index c4277c2447e..f53fd0f65b3 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -26,59 +25,83 @@ enum Grizzle
EMOTE_FRENZY_KILL = 0
};
-class boss_grizzle : public CreatureScript
+enum Events
{
-public:
- boss_grizzle() : CreatureScript("boss_grizzle") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_grizzleAI(creature);
- }
+ EVENT_GROUNDTREMOR = 1,
+ EVENT_FRENZY = 2
+};
- struct boss_grizzleAI : public ScriptedAI
- {
- boss_grizzleAI(Creature* creature) : ScriptedAI(creature) { }
+enum Phases
+{
+ PHASE_ONE = 1,
+ PHASE_TWO = 2
+};
- uint32 GroundTremor_Timer;
- uint32 Frenzy_Timer;
+class boss_grizzle : public CreatureScript
+{
+ public:
+ boss_grizzle() : CreatureScript("boss_grizzle") { }
- void Reset() override
+ struct boss_grizzleAI : public ScriptedAI
{
- GroundTremor_Timer = 12000;
- Frenzy_Timer =0;
- }
+ boss_grizzleAI(Creature* creature) : ScriptedAI(creature) { }
- void EnterCombat(Unit* /*who*/) override { }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- void UpdateAI(uint32 diff) override
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.SetPhase(PHASE_ONE);
+ _events.ScheduleEvent(EVENT_GROUNDTREMOR, 12000);
+ }
- //GroundTremor_Timer
- if (GroundTremor_Timer <= diff)
+ void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
- DoCastVictim(SPELL_GROUNDTREMOR);
- GroundTremor_Timer = 8000;
- } else GroundTremor_Timer -= diff;
+ if (me->HealthBelowPctDamaged(50, damage) && _events.IsInPhase(PHASE_ONE))
+ {
+ _events.SetPhase(PHASE_TWO);
+ _events.ScheduleEvent(EVENT_FRENZY, 0, 0, PHASE_TWO);
+ }
+ }
- //Frenzy_Timer
- if (HealthBelowPct(51))
+ void UpdateAI(uint32 diff) override
{
- if (Frenzy_Timer <= diff)
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
{
- DoCast(me, SPELL_FRENZY);
- Talk(EMOTE_FRENZY_KILL);
+ switch (eventId)
+ {
+ case EVENT_GROUNDTREMOR:
+ DoCastVictim(SPELL_GROUNDTREMOR);
+ _events.ScheduleEvent(EVENT_GROUNDTREMOR, 8000);
+ break;
+ case EVENT_FRENZY:
+ DoCast(me, SPELL_FRENZY);
+ Talk(EMOTE_FRENZY_KILL);
+ _events.ScheduleEvent(EVENT_FRENZY, 15000, 0, PHASE_TWO);
+ break;
+ default:
+ break;
+ }
+ }
- Frenzy_Timer = 15000;
- } else Frenzy_Timer -= diff;
+ DoMeleeAttackIfReady();
}
- DoMeleeAttackIfReady();
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_grizzleAI(creature);
}
- };
};
void AddSC_boss_grizzle()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
index 6aa89aa491d..c41ddf9d98b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -27,74 +26,81 @@ enum Spells
SPELL_SHADOWSHIELD = 22417
};
-class boss_high_interrogator_gerstahn : public CreatureScript
+enum Events
{
-public:
- boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_high_interrogator_gerstahnAI(creature);
- }
-
- struct boss_high_interrogator_gerstahnAI : public ScriptedAI
- {
- boss_high_interrogator_gerstahnAI(Creature* creature) : ScriptedAI(creature) { }
-
- uint32 ShadowWordPain_Timer;
- uint32 ManaBurn_Timer;
- uint32 PsychicScream_Timer;
- uint32 ShadowShield_Timer;
-
- void Reset() override
- {
- ShadowWordPain_Timer = 4000;
- ManaBurn_Timer = 14000;
- PsychicScream_Timer = 32000;
- ShadowShield_Timer = 8000;
- }
+ EVENT_SHADOW_WORD_PAIN = 1,
+ EVENT_MANABURN = 2,
+ EVENT_PSYCHIC_SCREAM = 3,
+ EVENT_SHADOWSHIELD = 4
+};
- void EnterCombat(Unit* /*who*/) override { }
+class boss_high_interrogator_gerstahn : public CreatureScript
+{
+ public:
+ boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { }
- void UpdateAI(uint32 diff) override
+ struct boss_high_interrogator_gerstahnAI : public ScriptedAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ boss_high_interrogator_gerstahnAI(Creature* creature) : ScriptedAI(creature) { }
- //ShadowWordPain_Timer
- if (ShadowWordPain_Timer <= diff)
+ void Reset() override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_SHADOWWORDPAIN);
- ShadowWordPain_Timer = 7000;
- } else ShadowWordPain_Timer -= diff;
+ _events.Reset();
+ }
- //ManaBurn_Timer
- if (ManaBurn_Timer <= diff)
+ void EnterCombat(Unit* /*who*/) override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_MANABURN);
- ManaBurn_Timer = 10000;
- } else ManaBurn_Timer -= diff;
+ _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 4000);
+ _events.ScheduleEvent(EVENT_MANABURN, 14000);
+ _events.ScheduleEvent(EVENT_PSYCHIC_SCREAM, 32000);
+ _events.ScheduleEvent(EVENT_SHADOWSHIELD, 8000);
+ }
- //PsychicScream_Timer
- if (PsychicScream_Timer <= diff)
+ void UpdateAI(uint32 diff) override
{
- DoCastVictim(SPELL_PSYCHICSCREAM);
- PsychicScream_Timer = 30000;
- } else PsychicScream_Timer -= diff;
+ if (!UpdateVictim())
+ return;
- //ShadowShield_Timer
- if (ShadowShield_Timer <= diff)
- {
- DoCast(me, SPELL_SHADOWSHIELD);
- ShadowShield_Timer = 25000;
- } else ShadowShield_Timer -= diff;
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SHADOW_WORD_PAIN:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_SHADOWWORDPAIN);
+ _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 7000);
+ break;
+ case EVENT_PSYCHIC_SCREAM:
+ DoCastVictim(SPELL_PSYCHICSCREAM);
+ _events.ScheduleEvent(EVENT_PSYCHIC_SCREAM, 30000);
+ break;
+ case EVENT_MANABURN:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_MANABURN);
+ _events.ScheduleEvent(EVENT_MANABURN, 10000);
+ break;
+ case EVENT_SHADOWSHIELD:
+ DoCast(me, SPELL_SHADOWSHIELD);
+ _events.ScheduleEvent(EVENT_SHADOWSHIELD, 25000);
+ break;
+ default:
+ break;
+ }
+ }
- DoMeleeAttackIfReady();
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_high_interrogator_gerstahnAI(creature);
}
- };
};
void AddSC_boss_high_interrogator_gerstahn()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
index 4cf968ad3b7..e6bbbaa73a9 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -18,75 +17,96 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "blackrock_depths.h"
enum Spells
{
- SPELL_FIERYBURST = 13900,
- SPELL_WARSTOMP = 24375
+ SPELL_FIERYBURST = 13900,
+ SPELL_WARSTOMP = 24375
};
-enum Misc
+enum Events
{
- DATA_THRONE_DOOR = 24 // not id or guid of doors but number of enum in blackrock_depths.h
+ EVENT_FIERY_BURST = 1,
+ EVENT_WARSTOMP = 2
};
-class boss_magmus : public CreatureScript
+enum Phases
{
-public:
- boss_magmus() : CreatureScript("boss_magmus") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_magmusAI(creature);
- }
-
- struct boss_magmusAI : public ScriptedAI
- {
- boss_magmusAI(Creature* creature) : ScriptedAI(creature) { }
+ PHASE_ONE = 1,
+ PHASE_TWO = 2
+};
- uint32 FieryBurst_Timer;
- uint32 WarStomp_Timer;
+class boss_magmus : public CreatureScript
+{
+ public:
+ boss_magmus() : CreatureScript("boss_magmus") { }
- void Reset() override
+ struct boss_magmusAI : public ScriptedAI
{
- FieryBurst_Timer = 5000;
- WarStomp_Timer =0;
- }
+ boss_magmusAI(Creature* creature) : ScriptedAI(creature) { }
- void EnterCombat(Unit* /*who*/) override { }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- void UpdateAI(uint32 diff) override
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.SetPhase(PHASE_ONE);
+ _events.ScheduleEvent(EVENT_FIERY_BURST, 5000);
+ }
- //FieryBurst_Timer
- if (FieryBurst_Timer <= diff)
+ void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
- DoCastVictim(SPELL_FIERYBURST);
- FieryBurst_Timer = 6000;
- } else FieryBurst_Timer -= diff;
+ if (me->HealthBelowPctDamaged(50, damage) && _events.IsInPhase(PHASE_ONE))
+ {
+ _events.SetPhase(PHASE_TWO);
+ _events.ScheduleEvent(EVENT_WARSTOMP, 0, 0, PHASE_TWO);
+ }
+ }
- //WarStomp_Timer
- if (HealthBelowPct(51))
+ void UpdateAI(uint32 diff) override
{
- if (WarStomp_Timer <= diff)
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
{
- DoCastVictim(SPELL_WARSTOMP);
- WarStomp_Timer = 8000;
- } else WarStomp_Timer -= diff;
+ switch (eventId)
+ {
+ case EVENT_FIERY_BURST:
+ DoCastVictim(SPELL_FIERYBURST);
+ _events.ScheduleEvent(EVENT_FIERY_BURST, 6000);
+ break;
+ case EVENT_WARSTOMP:
+ DoCastVictim(SPELL_WARSTOMP);
+ _events.ScheduleEvent(EVENT_WARSTOMP, 8000, 0, PHASE_TWO);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
}
- DoMeleeAttackIfReady();
- }
- // When he die open door to last chamber
- void JustDied(Unit* killer) override
+ void JustDied(Unit* /*killer*/) override
+ {
+ if (InstanceScript* instance = me->GetInstanceScript())
+ instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true);
+ }
+
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
{
- if (InstanceScript* instance = killer->GetInstanceScript())
- instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true);
+ return new boss_magmusAI(creature);
}
- };
};
void AddSC_boss_magmus()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
index 98f5f75ae3f..8342bef682b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -29,63 +28,73 @@ enum Spells
SPELL_SMITE = 10934
};
-class boss_moira_bronzebeard : public CreatureScript
+enum Events
{
-public:
- boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_moira_bronzebeardAI(creature);
- }
-
- struct boss_moira_bronzebeardAI : public ScriptedAI
- {
- boss_moira_bronzebeardAI(Creature* creature) : ScriptedAI(creature) { }
-
- uint32 Heal_Timer;
- uint32 MindBlast_Timer;
- uint32 ShadowWordPain_Timer;
- uint32 Smite_Timer;
-
- void Reset() override
- {
- Heal_Timer = 12000; //These times are probably wrong
- MindBlast_Timer = 16000;
- ShadowWordPain_Timer = 2000;
- Smite_Timer = 8000;
- }
+ EVENT_MINDBLAST = 1,
+ EVENT_SHADOW_WORD_PAIN = 2,
+ EVENT_SMITE = 3,
+ EVENT_HEAL = 4 // not used atm
+};
- void EnterCombat(Unit* /*who*/) override { }
+class boss_moira_bronzebeard : public CreatureScript
+{
+ public:
+ boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { }
- void UpdateAI(uint32 diff) override
+ struct boss_moira_bronzebeardAI : public ScriptedAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ boss_moira_bronzebeardAI(Creature* creature) : ScriptedAI(creature) { }
- //MindBlast_Timer
- if (MindBlast_Timer <= diff)
+ void Reset() override
{
- DoCastVictim(SPELL_MINDBLAST);
- MindBlast_Timer = 14000;
- } else MindBlast_Timer -= diff;
+ _events.Reset();
+ }
- //ShadowWordPain_Timer
- if (ShadowWordPain_Timer <= diff)
+ void EnterCombat(Unit* /*who*/) override
{
- DoCastVictim(SPELL_SHADOWWORDPAIN);
- ShadowWordPain_Timer = 18000;
- } else ShadowWordPain_Timer -= diff;
+ //_events.ScheduleEvent(EVENT_HEAL, 12000); // not used atm // These times are probably wrong
+ _events.ScheduleEvent(EVENT_MINDBLAST, 16000);
+ _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 2000);
+ _events.ScheduleEvent(EVENT_SMITE, 8000);
+ }
- //Smite_Timer
- if (Smite_Timer <= diff)
+ void UpdateAI(uint32 diff) override
{
- DoCastVictim(SPELL_SMITE);
- Smite_Timer = 10000;
- } else Smite_Timer -= diff;
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_MINDBLAST:
+ DoCastVictim(SPELL_MINDBLAST);
+ _events.ScheduleEvent(EVENT_MINDBLAST, 14000);
+ break;
+ case EVENT_SHADOW_WORD_PAIN:
+ DoCastVictim(SPELL_SHADOWWORDPAIN);
+ _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 18000);
+ break;
+ case EVENT_SMITE:
+ DoCastVictim(SPELL_SMITE);
+ _events.ScheduleEvent(EVENT_SMITE, 10000);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new boss_moira_bronzebeardAI(creature);
}
- };
};
void AddSC_boss_moira_bronzebeard()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
index cbcafa32a89..83464c12230 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -24,18 +24,24 @@
enum Spells
{
- SPELL_SMELT_DARK_IRON = 14891,
- SPELL_LEARN_SMELT = 14894,
+ SPELL_SMELT_DARK_IRON = 14891,
+ SPELL_LEARN_SMELT = 14894,
};
enum Quests
{
- QUEST_SPECTRAL_CHALICE = 4083
+ QUEST_SPECTRAL_CHALICE = 4083
};
enum Misc
{
- DATA_SKILLPOINT_MIN = 230
+ DATA_SKILLPOINT_MIN = 230
+};
+
+enum Phases
+{
+ PHASE_ONE = 1,
+ PHASE_TWO = 2
};
#define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron"
@@ -99,149 +105,151 @@ enum DoomrelSpells
SPELL_SUMMON_VOIDWALKERS = 15092
};
+enum DoomrelEvents
+{
+ EVENT_SHADOW_BOLT_VOLLEY = 1,
+ EVENT_IMMOLATE = 2,
+ EVENT_CURSE_OF_WEAKNESS = 3,
+ EVENT_DEMONARMOR = 4,
+ EVENT_SUMMON_VOIDWALKERS = 5
+};
+
#define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!"
#define GOSSIP_SELECT_DOOMREL "[PH] Continue..."
class boss_doomrel : public CreatureScript
{
-public:
- boss_doomrel() : CreatureScript("boss_doomrel") { }
+ public:
+ boss_doomrel() : CreatureScript("boss_doomrel") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->SEND_GOSSIP_MENU(2605, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->CLOSE_GOSSIP_MENU();
- //start event here
- creature->setFaction(FACTION_HOSTILE);
- creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
- creature->AI()->AttackStart(player);
- InstanceScript* instance = creature->GetInstanceScript();
- if (instance)
- instance->SetData64(DATA_EVENSTARTER, player->GetGUID());
- break;
+ player->PlayerTalkClass->ClearMenus();
+ switch (action)
+ {
+ case GOSSIP_ACTION_INFO_DEF+1:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->SEND_GOSSIP_MENU(2605, creature->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF+2:
+ player->CLOSE_GOSSIP_MENU();
+ //start event here
+ creature->setFaction(FACTION_HOSTILE);
+ creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ creature->AI()->AttackStart(player);
+ InstanceScript* instance = creature->GetInstanceScript();
+ if (instance)
+ instance->SetData64(DATA_EVENSTARTER, player->GetGUID());
+ break;
+ }
+ return true;
}
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->SEND_GOSSIP_MENU(2601, creature->GetGUID());
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_doomrelAI>(creature);
- }
-
- struct boss_doomrelAI : public ScriptedAI
- {
- boss_doomrelAI(Creature* creature) : ScriptedAI(creature)
+ bool OnGossipHello(Player* player, Creature* creature) override
{
- instance = creature->GetInstanceScript();
- }
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->SEND_GOSSIP_MENU(2601, creature->GetGUID());
- InstanceScript* instance;
- uint32 ShadowVolley_Timer;
- uint32 Immolate_Timer;
- uint32 CurseOfWeakness_Timer;
- uint32 DemonArmor_Timer;
- bool Voidwalkers;
+ return true;
+ }
- void Reset() override
+ struct boss_doomrelAI : public ScriptedAI
{
- ShadowVolley_Timer = 10000;
- Immolate_Timer = 18000;
- CurseOfWeakness_Timer = 5000;
- DemonArmor_Timer = 16000;
- Voidwalkers = false;
+ boss_doomrelAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- me->setFaction(FACTION_FRIEND);
+ void Reset() override
+ {
+ _voidwalkers = false;
- // was set before event start, so set again
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ me->setFaction(FACTION_FRIEND);
- if (instance->GetData(DATA_GHOSTKILL) >= 7)
- me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
- else
- me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- }
+ // was set before event start, so set again
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
- void EnterCombat(Unit* /*who*/) override
- {
- }
-
- void EnterEvadeMode() override
- {
- me->RemoveAllAuras();
- me->DeleteThreatList();
- me->CombatStop(true);
- me->LoadCreaturesAddon();
- if (me->IsAlive())
- me->GetMotionMaster()->MoveTargetedHome();
- me->SetLootRecipient(NULL);
- instance->SetData64(DATA_EVENSTARTER, 0);
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- instance->SetData(DATA_GHOSTKILL, 1);
- }
+ if (_instance->GetData(DATA_GHOSTKILL) >= 7)
+ me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
+ else
+ me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 10000);
+ _events.ScheduleEvent(EVENT_IMMOLATE, 18000);
+ _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 5000);
+ _events.ScheduleEvent(EVENT_DEMONARMOR, 16000);
+ }
- //ShadowVolley_Timer
- if (ShadowVolley_Timer <= diff)
+ void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override
{
- DoCastVictim(SPELL_SHADOWBOLTVOLLEY);
- ShadowVolley_Timer = 12000;
- } else ShadowVolley_Timer -= diff;
+ if (!_voidwalkers && !HealthAbovePct(50))
+ {
+ DoCastVictim(SPELL_SUMMON_VOIDWALKERS, true);
+ _voidwalkers = true;
+ }
+ }
- //Immolate_Timer
- if (Immolate_Timer <= diff)
+ void EnterEvadeMode() override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_IMMOLATE);
+ ScriptedAI::EnterEvadeMode();
- Immolate_Timer = 25000;
- } else Immolate_Timer -= diff;
+ _instance->SetData64(DATA_EVENSTARTER, 0);
+ }
- //CurseOfWeakness_Timer
- if (CurseOfWeakness_Timer <= diff)
+ void JustDied(Unit* /*killer*/) override
{
- DoCastVictim(SPELL_CURSEOFWEAKNESS);
- CurseOfWeakness_Timer = 45000;
- } else CurseOfWeakness_Timer -= diff;
+ _instance->SetData(DATA_GHOSTKILL, 1);
+ }
- //DemonArmor_Timer
- if (DemonArmor_Timer <= diff)
+ void UpdateAI(uint32 diff) override
{
- DoCast(me, SPELL_DEMONARMOR);
- DemonArmor_Timer = 300000;
- } else DemonArmor_Timer -= diff;
+ if (!UpdateVictim())
+ return;
- //Summon Voidwalkers
- if (!Voidwalkers && HealthBelowPct(51))
- {
- DoCastVictim(SPELL_SUMMON_VOIDWALKERS, true);
- Voidwalkers = true;
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SHADOW_BOLT_VOLLEY:
+ DoCastVictim(SPELL_SHADOWBOLTVOLLEY);
+ _events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 12000);
+ break;
+ case EVENT_IMMOLATE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_IMMOLATE);
+ _events.ScheduleEvent(EVENT_IMMOLATE, 25000);
+ break;
+ case EVENT_CURSE_OF_WEAKNESS:
+ DoCastVictim(SPELL_CURSEOFWEAKNESS);
+ _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 45000);
+ break;
+ case EVENT_DEMONARMOR:
+ DoCast(me, SPELL_DEMONARMOR);
+ _events.ScheduleEvent(EVENT_DEMONARMOR, 300000);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
}
- DoMeleeAttackIfReady();
+ private:
+ InstanceScript* _instance;
+ EventMap _events;
+ bool _voidwalkers;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetInstanceAI<boss_doomrelAI>(creature);
}
- };
};
void AddSC_boss_tomb_of_seven()
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
index ab065f62bbb..94bf3e991f4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
@@ -243,37 +243,37 @@ public:
switch (eventId)
{
case EVENT_START_1:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_0);
events.ScheduleEvent(EVENT_START_2, 4000);
break;
case EVENT_START_2:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->HandleEmoteCommand(EMOTE_ONESHOT_POINT);
events.ScheduleEvent(EVENT_START_3, 4000);
break;
case EVENT_START_3:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_1);
events.ScheduleEvent(EVENT_WAVE_1, 2000);
events.ScheduleEvent(EVENT_TURN_TO_REND, 4000);
events.ScheduleEvent(EVENT_WAVES_TEXT_1, 20000);
break;
case EVENT_TURN_TO_REND:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
{
victor->SetFacingToObject(me);
victor->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
}
break;
case EVENT_TURN_TO_PLAYER:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
if (Unit* player = victor->SelectNearestPlayer(60.0f))
victor->SetFacingToObject(player);
break;
case EVENT_TURN_TO_FACING_1:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->SetFacingTo(1.518436f);
break;
case EVENT_TURN_TO_FACING_2:
@@ -283,7 +283,7 @@ public:
me->SetFacingTo(1.500983f);
break;
case EVENT_WAVES_EMOTE_1:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION);
break;
case EVENT_WAVES_EMOTE_2:
@@ -291,7 +291,7 @@ public:
break;
case EVENT_WAVES_TEXT_1:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_2);
me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000);
@@ -301,7 +301,7 @@ public:
break;
case EVENT_WAVES_TEXT_2:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_3);
events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000);
events.ScheduleEvent(EVENT_WAVE_3, 2000);
@@ -309,7 +309,7 @@ public:
break;
case EVENT_WAVES_TEXT_3:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_4);
events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000);
events.ScheduleEvent(EVENT_WAVE_4, 2000);
@@ -324,7 +324,7 @@ public:
break;
case EVENT_WAVES_TEXT_5:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_5);
events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000);
events.ScheduleEvent(EVENT_WAVE_6, 2000);
@@ -332,26 +332,26 @@ public:
break;
case EVENT_WAVES_COMPLETE_TEXT_1:
events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0);
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_6);
events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000);
events.ScheduleEvent(EVENT_WAVES_COMPLETE_TEXT_2, 13000);
break;
case EVENT_WAVES_COMPLETE_TEXT_2:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_7);
Talk(SAY_BLACKHAND_2);
events.ScheduleEvent(EVENT_PATH_REND, 1000);
events.ScheduleEvent(EVENT_WAVES_COMPLETE_TEXT_3, 4000);
break;
case EVENT_WAVES_COMPLETE_TEXT_3:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->AI()->Talk(SAY_NEFARIUS_8);
events.ScheduleEvent(EVENT_PATH_NEFARIUS, 1000);
events.ScheduleEvent(EVENT_PATH_REND, 1000);
break;
case EVENT_PATH_NEFARIUS:
- if (Creature* victor = me->GetCreature(*me, victorGUID))
+ if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->GetMotionMaster()->MovePath(NEFARIUS_PATH_1, true);
break;
case EVENT_PATH_REND:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
index e645dd383f2..b3a55e1fe4a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
@@ -26,7 +26,7 @@
#include "ScriptedCreature.h"
#include "blackrock_spire.h"
-uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
+//uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN };
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
index ea4784bb5a4..8d4a84197b1 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -167,7 +167,7 @@ public:
{
if (InstanceScript* instance = go->GetInstanceScript())
if (instance->GetData(DATA_EGG_EVENT) != DONE)
- if (Creature* razor = Unit::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED)))
+ if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED)))
{
razor->Attack(player, true);
player->CastSpell(razor, SPELL_MINDCONTROL);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index c00029bea50..bbe70947901 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -146,8 +146,8 @@ public:
break;
case EVENT_SPEECH_4:
me->setFaction(103);
- if (PlayerGUID && Unit::GetUnit(*me, PlayerGUID))
- AttackStart(Unit::GetUnit(*me, PlayerGUID));;
+ if (PlayerGUID && ObjectAccessor::GetUnit(*me, PlayerGUID))
+ AttackStart(ObjectAccessor::GetUnit(*me, PlayerGUID));;
break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
index 048e6149b4b..6eafb41a8fa 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
@@ -147,7 +147,7 @@ class boss_ragnaros : public CreatureScript
break;
case EVENT_INTRO_4:
Talk(SAY_ARRIVAL5_RAG);
- if (Creature* executus = Unit::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS)))
+ if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS)))
me->Kill(executus);
break;
case EVENT_INTRO_5:
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index 1398f959e46..b171bf014c7 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -198,7 +198,7 @@ public:
if (!SummonList.empty())
for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{
- if (Creature* summon = Unit::GetCreature(*me, *itr))
+ if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
{
if (summon->IsAlive())
summon->DisappearAndDie();
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 59a04d6a457..b130ac74be3 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -101,7 +101,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
- if (Unit* midnight = Unit::GetUnit(*me, Midnight))
+ if (Unit* midnight = ObjectAccessor::GetUnit(*me, Midnight))
midnight->Kill(midnight);
}
@@ -149,7 +149,7 @@ public:
{
if (Phase == 2)
{
- if (Unit* unit = Unit::GetUnit(*me, Attumen))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, Attumen))
Talk(SAY_MIDNIGHT_KILL, unit);
}
}
@@ -172,7 +172,7 @@ public:
}
else if (Phase == 2 && HealthBelowPct(25))
{
- if (Unit* pAttumen = Unit::GetUnit(*me, Attumen))
+ if (Unit* pAttumen = ObjectAccessor::GetUnit(*me, Attumen))
Mount(pAttumen);
}
else if (Phase == 3)
@@ -184,7 +184,7 @@ public:
Mount_Timer = 0;
me->SetVisible(false);
me->GetMotionMaster()->MoveIdle();
- if (Unit* pAttumen = Unit::GetUnit(*me, Attumen))
+ if (Unit* pAttumen = ObjectAccessor::GetUnit(*me, Attumen))
{
pAttumen->SetDisplayId(MOUNTED_DISPLAYID);
pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -242,7 +242,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff)
if (ResetTimer <= diff)
{
ResetTimer = 0;
- Unit* pMidnight = Unit::GetUnit(*me, Midnight);
+ Unit* pMidnight = ObjectAccessor::GetUnit(*me, Midnight);
if (pMidnight)
{
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -288,7 +288,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff)
std::vector<Unit*> target_list;
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
{
- target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (target && !target->IsWithinDist(me, ATTACK_DISTANCE, false))
target_list.push_back(target);
target = NULL;
@@ -304,7 +304,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff)
{
if (HealthBelowPct(25))
{
- Creature* pMidnight = Unit::GetCreature(*me, Midnight);
+ Creature* pMidnight = ObjectAccessor::GetCreature(*me, Midnight);
if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{
CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 5d52cc62f8a..0ca7ee90986 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -236,7 +236,7 @@ public:
{
if (AddGUID[i])
{
- Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ Creature* temp = ObjectAccessor::GetCreature((*me), AddGUID[i]);
if (temp && temp->IsAlive())
{
temp->AI()->AttackStart(me->GetVictim());
@@ -270,7 +270,7 @@ public:
{
if (AddGUID[i])
{
- Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
+ Creature* temp = ObjectAccessor::GetCreature((*me), AddGUID[i]);
if (temp && temp->IsAlive())
if (!temp->GetVictim())
temp->AI()->AttackStart(me->GetVictim());
@@ -350,7 +350,7 @@ struct boss_moroes_guestAI : public ScriptedAI
void AcquireGUID()
{
- if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES)))
+ if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOROES)))
for (uint8 i = 0; i < 4; ++i)
if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
GuestGUID[i] = GUID;
@@ -361,7 +361,7 @@ struct boss_moroes_guestAI : public ScriptedAI
uint64 TempGUID = GuestGUID[rand()%4];
if (TempGUID)
{
- Unit* unit = Unit::GetUnit(*me, TempGUID);
+ Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID);
if (unit && unit->IsAlive())
return unit;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index 33ea71f81e1..010b7223f97 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -158,9 +158,9 @@ public:
{
for (int i=0; i<3; ++i)
{
- if (Creature* portal = Unit::GetCreature(*me, PortalGUID[i]))
+ if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[i]))
portal->DisappearAndDie();
- if (Creature* portal = Unit::GetCreature(*me, BeamerGUID[i]))
+ if (Creature* portal = ObjectAccessor::GetCreature(*me, BeamerGUID[i]))
portal->DisappearAndDie();
PortalGUID[i] = 0;
BeamTarget[i] = 0;
@@ -170,10 +170,10 @@ public:
void UpdatePortals() // Here we handle the beams' behavior
{
for (int j=0; j<3; ++j) // j = color
- if (Creature* portal = Unit::GetCreature(*me, PortalGUID[j]))
+ if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[j]))
{
// the one who's been cast upon before
- Unit* current = Unit::GetUnit(*portal, BeamTarget[j]);
+ Unit* current = ObjectAccessor::GetUnit(*portal, BeamTarget[j]);
// temporary store for the best suitable beam reciever
Unit* target = me;
@@ -205,7 +205,7 @@ public:
{
BeamTarget[j] = target->GetGUID();
// remove currently beaming portal
- if (Creature* beamer = Unit::GetCreature(*portal, BeamerGUID[j]))
+ if (Creature* beamer = ObjectAccessor::GetCreature(*portal, BeamerGUID[j]))
{
beamer->CastSpell(target, PortalBeam[j], false);
beamer->DisappearAndDie();
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index cf13863f84b..befe72a6403 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -146,7 +146,7 @@ public:
void KilledUnit(Unit* who) override
{
- if (Unit* unit = Unit::GetUnit(*me, malchezaar))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, malchezaar))
if (Creature* creature = unit->ToCreature())
creature->AI()->KilledUnit(who);
}
@@ -273,7 +273,7 @@ public:
{
//Infernal Cleanup
for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
- if (Unit* pInfernal = Unit::GetUnit(*me, *itr))
+ if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr))
if (pInfernal->IsAlive())
{
pInfernal->SetVisible(false);
@@ -287,7 +287,7 @@ public:
{
for (uint8 i = 0; i < 2; ++i)
{
- Unit* axe = Unit::GetUnit(*me, axes[i]);
+ Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]);
if (axe && axe->IsAlive())
axe->Kill(axe);
axes[i] = 0;
@@ -316,7 +316,7 @@ public:
ThreatContainer::StorageType::const_iterator itr = t_list.begin();
std::advance(itr, 1);
for (; itr != t_list.end(); ++itr) //store the threat list in a different container
- if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
targets.push_back(target);
@@ -340,7 +340,7 @@ public:
{
for (uint8 i = 0; i < 5; ++i)
{
- Unit* target = Unit::GetUnit(*me, enfeeble_targets[i]);
+ Unit* target = ObjectAccessor::GetUnit(*me, enfeeble_targets[i]);
if (target && target->IsAlive())
target->SetHealth(enfeeble_health[i]);
enfeeble_targets[i] = 0;
@@ -480,7 +480,7 @@ public:
{
for (uint8 i = 0; i < 2; ++i)
{
- if (Unit* axe = Unit::GetUnit(*me, axes[i]))
+ if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]))
{
if (axe->GetVictim())
DoModifyThreatPercent(axe->GetVictim(), -100);
@@ -583,7 +583,7 @@ public:
void netherspite_infernal::netherspite_infernalAI::Cleanup()
{
- Creature* pMalchezaar = Unit::GetCreature(*me, malchezaar);
+ Creature* pMalchezaar = ObjectAccessor::GetCreature(*me, malchezaar);
if (pMalchezaar && pMalchezaar->IsAlive())
CAST_AI(boss_malchezaar::boss_malchezaarAI, pMalchezaar->AI())->Cleanup(me, point);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
index 0a3a697c6a7..9bda41b03a1 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -184,7 +184,7 @@ public:
//store the threat list in a different container
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
//only on alive players
if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
targets.push_back(target);
@@ -450,7 +450,7 @@ public:
if (!FlameWreathTarget[i])
continue;
- Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]);
+ Unit* unit = ObjectAccessor::GetUnit(*me, FlameWreathTarget[i]);
if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{
unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID());
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 65c3522ea9a..3b499b649cf 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -103,7 +103,7 @@ public:
uint64 TerestianGUID = instance->GetData64(DATA_TERESTIAN);
if (TerestianGUID)
{
- Unit* Terestian = Unit::GetUnit(*me, TerestianGUID);
+ Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGUID);
if (Terestian && Terestian->IsAlive())
DoCast(Terestian, SPELL_BROKEN_PACT, true);
}
@@ -158,7 +158,7 @@ public:
{
if (SacrificeGUID)
{
- Unit* Sacrifice = Unit::GetUnit(*me, SacrificeGUID);
+ Unit* Sacrifice = ObjectAccessor::GetUnit(*me, SacrificeGUID);
if (Sacrifice)
Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
}
@@ -280,7 +280,7 @@ public:
{
if (PortalGUID[i])
{
- if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i]))
+ if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[i]))
{
CAST_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp();
pPortal->DespawnOrUnsummon();
@@ -345,7 +345,7 @@ public:
{
if (PortalGUID[i])
{
- if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i]))
+ if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i]))
pPortal->DespawnOrUnsummon();
PortalGUID[i] = 0;
@@ -396,7 +396,7 @@ public:
if (PortalGUID[0] && PortalGUID[1])
{
- if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0, 1)]))
+ if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[urand(0, 1)]))
pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP, false);
SummonTimer = 5000;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 010e06d67cb..c0e6a8d3b90 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -109,7 +109,7 @@ void SummonCroneIfReady(InstanceScript* instance, Creature* creature)
pCrone->AI()->AttackStart(creature->GetVictim());
}
}
-};
+}
class boss_dorothee : public CreatureScript
{
@@ -254,7 +254,7 @@ public:
{
if (DorotheeGUID)
{
- Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID));
+ Creature* Dorothee = (ObjectAccessor::GetCreature((*me), DorotheeGUID));
if (Dorothee && Dorothee->IsAlive())
{
CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true;
@@ -893,7 +893,7 @@ public:
{
IsChasing = false;
- if (Unit* target = Unit::GetUnit(*me, HoodGUID))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, HoodGUID))
{
HoodGUID = 0;
if (DoGetThreat(target))
@@ -1186,7 +1186,7 @@ public:
IsFakingDeath = true;
Phase = PHASE_BOTH;
- if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
+ if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)))
{
CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true;
CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000;
@@ -1200,7 +1200,7 @@ public:
{
if (JulianneDead)
{
- if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
+ if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)))
{
Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Julianne->GetMotionMaster()->Clear();
@@ -1212,7 +1212,7 @@ public:
return;
}
- if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
+ if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)))
{
PretendToDie(me);
IsFakingDeath = true;
@@ -1231,7 +1231,7 @@ public:
Talk(SAY_ROMULO_AGGRO);
if (JulianneGUID)
{
- Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
+ Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID));
if (Julianne && Julianne->GetVictim())
{
me->AddThreat(Julianne->GetVictim(), 1.0f);
@@ -1275,7 +1275,7 @@ public:
{
if (ResurrectTimer <= diff)
{
- Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
+ Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID));
if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath)
{
Talk(SAY_ROMULO_RESURRECT);
@@ -1395,7 +1395,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
{
if (ResurrectTimer <= diff)
{
- Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID));
+ Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID));
if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath)
{
Talk(SAY_JULIANNE_RESURRECT);
@@ -1430,7 +1430,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
{
if (urand(0, 1) && SummonedRomulo)
{
- Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID));
+ Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID));
if (Romulo && Romulo->IsAlive() && !RomuloDead)
DoCast(Romulo, SPELL_ETERNAL_AFFECTION);
} else DoCast(me, SPELL_ETERNAL_AFFECTION);
@@ -1460,7 +1460,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
DoCast(me, SPELL_DRINK_POISON);
IsFakingDeath = true;
- //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
+ //IS THIS USEFULL? Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID));
return;
}
@@ -1476,7 +1476,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
//if this is true then we have to kill romulo too
if (RomuloDead)
{
- if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)))
+ if (Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)))
{
Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Romulo->GetMotionMaster()->Clear();
@@ -1490,7 +1490,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
}
//if not already returned, then romulo is alive and we can pretend die
- if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)))
+ if (Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)))
{
PretendToDie(me);
IsFakingDeath = true;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 9db4c4b2bfa..976a83a98c2 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -286,7 +286,7 @@ public:
{
if (TalkCount > 3)
{
- if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID))
+ if (Creature* pSpotlight = ObjectAccessor::GetCreature(*me, m_uiSpotlightGUID))
pSpotlight->DespawnOrUnsummon();
SetEscortPaused(false);
@@ -539,7 +539,7 @@ public:
uint32 NextStep(uint32 Step)
{
- Creature* arca = Unit::GetCreature(*me, ArcanagosGUID);
+ Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
switch (Step)
{
@@ -630,7 +630,7 @@ public:
if (Step >= 7 && Step <= 12)
{
- Unit* arca = Unit::GetUnit(*me, ArcanagosGUID);
+ Unit* arca = ObjectAccessor::GetUnit(*me, ArcanagosGUID);
if (FireArcanagosTimer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index e0c902427c2..3c4b372808b 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -196,7 +196,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && unit->IsAlive())
{
float threat = me->getThreatManager().getThreat(unit);
@@ -214,7 +214,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true);
}
@@ -227,7 +227,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
// Knockback into the air
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
@@ -240,7 +240,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
// Also needs an exception in spell system.
@@ -260,7 +260,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 046db7fc654..8dc8ff799ba 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -162,7 +162,7 @@ public:
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i]))
{
if (!pAdd->GetVictim())
{
@@ -210,7 +210,7 @@ public:
{
for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr)
{
- Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]);
+ Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[j]);
//object already removed, not exist
if (!pAdd)
@@ -271,7 +271,7 @@ public:
Unit* target = me;
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i]))
{
if (pAdd->IsAlive() && pAdd->GetHealth() < health)
target = pAdd;
@@ -287,7 +287,7 @@ public:
Unit* target = me;
if (urand(0, 1))
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->IsAlive())
target = pAdd;
@@ -300,7 +300,7 @@ public:
Unit* target = me;
if (urand(0, 1))
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->IsAlive() && !pAdd->HasAura(SPELL_SHIELD))
target = pAdd;
@@ -319,7 +319,7 @@ public:
if (urand(0, 1))
target = me;
else
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->IsAlive())
target = pAdd;
}
@@ -390,7 +390,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i]))
{
if (!pAdd->GetVictim() && pAdd != me)
{
@@ -400,7 +400,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
}
}
- if (Creature* pDelrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
+ if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
{
if (pDelrissa->IsAlive() && !pDelrissa->GetVictim())
{
@@ -412,7 +412,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void JustDied(Unit* /*killer*/) override
{
- Creature* pDelrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA));
+ Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA));
uint32 uiLackeyDeathCount = instance->GetData(DATA_DELRISSA_DEATH_COUNT);
if (!pDelrissa)
@@ -441,13 +441,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void KilledUnit(Unit* victim) override
{
- if (Creature* Delrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
+ if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
Delrissa->AI()->KilledUnit(victim);
}
void AcquireGUIDs()
{
- if (Creature* Delrissa = (Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA))))
+ if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))))
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i];
@@ -832,7 +832,7 @@ public:
ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
{
//if in melee range
if (target->IsWithinDistInMap(me, 5))
@@ -918,7 +918,7 @@ public:
ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
{
//if in melee range
if (target->IsWithinDistInMap(me, ATTACK_DISTANCE))
@@ -1022,7 +1022,7 @@ public:
Wing_Clip_Timer = 4000;
Freezing_Trap_Timer = 15000;
- Unit* pPet = Unit::GetUnit(*me, m_uiPetGUID);
+ Unit* pPet = ObjectAccessor::GetUnit(*me, m_uiPetGUID);
if (!pPet)
me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
@@ -1171,7 +1171,7 @@ public:
// uint64 guid = (*itr)->guid;
// if (guid)
// {
- // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid);
+ // Unit* pAdd = ObjectAccessor::GetUnit(*me, (*itr)->guid);
// if (pAdd && pAdd->IsAlive())
// {
DoCast(me, SPELL_LESSER_HEALING_WAVE);
@@ -1256,7 +1256,7 @@ public:
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
- if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i]))
+ if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i]))
{
if (pAdd->IsPolymorphed())
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index 74e9321d08c..d77f5db9cea 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -107,8 +107,8 @@ public:
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
- //Unit* unit = Unit::GetUnit(*me, FelCrystals[i]);
- if (Creature* creature = Unit::GetCreature(*me, *itr))
+ //Unit* unit = ObjectAccessor::GetUnit(*me, FelCrystals[i]);
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, *itr))
{
if (!creature->IsAlive())
creature->Respawn(); // Let the core handle setting death state, etc.
@@ -148,8 +148,8 @@ public:
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
pCrystal = NULL;
- //pCrystal = Unit::GetUnit(*me, FelCrystals[i]);
- pCrystal = Unit::GetUnit(*me, *itr);
+ //pCrystal = ObjectAccessor::GetUnit(*me, FelCrystals[i]);
+ pCrystal = ObjectAccessor::GetUnit(*me, *itr);
if (pCrystal && pCrystal->IsAlive())
{
// select nearest
@@ -184,8 +184,8 @@ public:
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
- //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i]));
- Creature* pCrystal = Unit::GetCreature(*me, *itr);
+ //Creature* pCrystal = (ObjectAccessor::GetCreature(*me, FelCrystals[i]));
+ Creature* pCrystal = ObjectAccessor::GetCreature(*me, *itr);
if (pCrystal && pCrystal->IsAlive())
pCrystal->Kill(pCrystal);
}
@@ -206,7 +206,7 @@ public:
{
if (type == POINT_MOTION_TYPE && id == 1)
{
- Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID);
+ Unit* CrystalChosen = ObjectAccessor::GetUnit(*me, CrystalGUID);
if (CrystalChosen && CrystalChosen->IsAlive())
{
// Make the crystal attackable
@@ -292,7 +292,7 @@ public:
Talk(SAY_EMPOWERED);
- Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID);
+ Unit* CrystalChosen = ObjectAccessor::GetUnit(*me, CrystalGUID);
if (CrystalChosen && CrystalChosen->IsAlive())
// Use Deal Damage to kill it, not setDeathState.
CrystalChosen->Kill(CrystalChosen);
@@ -335,7 +335,7 @@ public:
{
if (InstanceScript* instance = me->GetInstanceScript())
{
- Creature* Selin = (Unit::GetCreature(*me, instance->GetData64(DATA_SELIN)));
+ Creature* Selin = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SELIN)));
if (Selin && Selin->IsAlive())
{
if (CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID())
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 5602a2a50e0..46c566f62bd 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -314,7 +314,7 @@ public:
{
if (Creature* anchor = go->FindNearestCreature(29521, 15))
if (uint64 prisonerGUID = anchor->AI()->GetGUID())
- if (Creature* prisoner = Creature::GetCreature(*player, prisonerGUID))
+ if (Creature* prisoner = ObjectAccessor::GetCreature(*player, prisonerGUID))
CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player);
return false;
@@ -467,7 +467,7 @@ public:
{
me->setFaction(FACTION_HOSTILE);
- if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, m_uiDuelerGUID))
AttackStart(unit);
}
else
@@ -1047,14 +1047,14 @@ class npc_scarlet_miner : public CreatureScript
{
if (IntroPhase == 1)
{
- if (Creature* car = Unit::GetCreature(*me, carGUID))
+ if (Creature* car = ObjectAccessor::GetCreature(*me, carGUID))
DoCast(car, SPELL_CART_DRAG);
IntroTimer = 800;
IntroPhase = 2;
}
else
{
- if (Creature* car = Unit::GetCreature(*me, carGUID))
+ if (Creature* car = ObjectAccessor::GetCreature(*me, carGUID))
car->AI()->DoAction(0);
IntroPhase = 0;
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 88c30efdf71..09377f20bed 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -307,7 +307,7 @@ public:
break;
case 4:
{
- Creature* temp = Unit::GetCreature(*me, valrothGUID);
+ Creature* temp = ObjectAccessor::GetCreature(*me, valrothGUID);
if (!temp || !temp->IsAlive())
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 8d5e10679ec..40773c87b68 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -400,15 +400,15 @@ public:
//UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0);
UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0);
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->setDeathState(JUST_DIED);
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
temp->setDeathState(JUST_DIED);
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
temp->setDeathState(JUST_DIED);
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
temp->setDeathState(JUST_DIED);
- if (Creature* temp = Unit::GetCreature(*me, uiRayneGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiRayneGUID))
temp->setDeathState(JUST_DIED);
uiTirionGUID = 0;
@@ -419,24 +419,24 @@ public:
for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiDefenderGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]))
temp->setDeathState(JUST_DIED);
uiDefenderGUID[i] = 0;
}
for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiEarthshatterGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]))
temp->setDeathState(JUST_DIED);
uiEarthshatterGUID[i] = 0;
}
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
temp->Respawn();
- if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID))
temp->Respawn();
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
temp->Respawn();
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->Respawn();
uiKoltiraGUID = 0;
@@ -445,25 +445,25 @@ public:
uiLichKingGUID = 0;
for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiAbominationGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]))
temp->setDeathState(JUST_DIED);
uiAbominationGUID[i] = 0;
}
for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiBehemothGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]))
temp->setDeathState(JUST_DIED);
uiBehemothGUID[i] = 0;
}
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiGhoulGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]))
temp->setDeathState(JUST_DIED);
uiGhoulGUID[i] = 0;
}
for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, uiWarriorGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]))
temp->setDeathState(JUST_DIED);
uiWarriorGUID[i] = 0;
}
@@ -514,9 +514,9 @@ public:
case 1:
SetHoldState(true);
SpawnNPC();
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN07);
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN08);
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
@@ -534,9 +534,9 @@ public:
me->Dismount();
me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
temp->Dismount();
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
temp->Dismount();
bIsBattle = true;
@@ -547,37 +547,37 @@ public:
break;
case 3:
{
- //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID);
+ //Unit* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID);
Talk(EMOTE_LIGHT_OF_DAWN05);
if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
{
if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
{
if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
{
temp->SetWalk(true);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
{
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
{
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z);
@@ -589,9 +589,9 @@ public:
Talk(SAY_LIGHT_OF_DAWN27);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
temp->SetStandState(UNIT_STAND_STATE_KNEEL);
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
temp->SetStandState(UNIT_STAND_STATE_KNEEL);
SetHoldState(true);
break;
@@ -610,7 +610,7 @@ public:
break;
case 8:
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP));
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
me->CastSpell(temp, SPELL_ASHBRINGER, true);
Talk(EMOTE_LIGHT_OF_DAWN14);
SetHoldState(true);
@@ -743,51 +743,51 @@ public:
case 9: // charge begins
SetHoldState(false);
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
{
temp->SetWalk(false);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID))
{
temp->SetWalk(false);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
{
temp->SetWalk(false);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
}
for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, uiAbominationGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]))
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, uiBehemothGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]))
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, uiGhoulGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]))
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, uiWarriorGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]))
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z);
JumpToNextStep(5000);
break;
// ******* After battle *****************************************************************
case 11: // Tirion starts to speak
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN28);
JumpToNextStep(21000);
break;
case 12:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN29);
JumpToNextStep(13000);
break;
case 13:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN30);
JumpToNextStep(13000);
break;
@@ -810,7 +810,7 @@ public:
break;
case 16: // Alexandros out
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z);
@@ -837,7 +837,7 @@ public:
break;
case 19: // runs to father
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
{
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN07);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z);
@@ -846,59 +846,59 @@ public:
break;
case 20:
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN36);
JumpToNextStep(4000);
break;
case 21:
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN08);
JumpToNextStep(4000);
break;
case 22:
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN37);
JumpToNextStep(8000);
break;
case 23:
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN38);
JumpToNextStep(8000);
break;
case 24:
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN39);
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z);
JumpToNextStep(15000);
break;
case 25:
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN40);
JumpToNextStep(11000);
break;
case 26:
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN41);
JumpToNextStep(5000);
break;
case 27:
- if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID))
temp->setDeathState(JUST_DIED);
JumpToNextStep(24000);
break;
case 28:
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN42);
JumpToNextStep(6000);
break;
@@ -908,19 +908,19 @@ public:
{
temp->AI()->Talk(SAY_LIGHT_OF_DAWN43);
uiLichKingGUID = temp->GetGUID();
- if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID))
+ if (Unit* pAlex = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID))
temp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false);
}
JumpToNextStep(2000);
break;
case 30:
- if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) // just hide him
{
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN09);
temp->SetVisible(false);
}
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
{
temp->InterruptNonMeleeSpells(false);
temp->AI()->Talk(SAY_LIGHT_OF_DAWN45);
@@ -936,13 +936,13 @@ public:
break;
case 32:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z);
JumpToNextStep(6000);
break;
case 33: // Darion supports to jump to lich king here
- if (Unit::GetCreature(*me, uiLichKingGUID))
+ if (ObjectAccessor::GetCreature(*me, uiLichKingGUID))
DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge
// doesn't make it looks well, so workarounds, Darion charges, looks better
me->SetSpeed(MOVE_RUN, 3.0f);
@@ -952,7 +952,7 @@ public:
break;
case 35: // Lich king counterattacks
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
{
temp->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
temp->AI()->Talk(SAY_LIGHT_OF_DAWN46);
@@ -969,29 +969,29 @@ public:
break;
case 38:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN47);
JumpToNextStep(8000);
break;
case 39:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN48);
JumpToNextStep(15000);
break;
case 40:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN49);
JumpToNextStep(17000);
break;
case 41: // Lich king - Apocalypse
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
{
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN11);
temp->AI()->Talk(SAY_LIGHT_OF_DAWN51);
- if (Creature* pTirion = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
pTirion->SetStandState(UNIT_STAND_STATE_KNEEL);
//temp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working
@@ -1007,7 +1007,7 @@ public:
float fLichPositionX = 0,
fLichPositionY = 0,
fLichPositionZ = 0;
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
{
fLichPositionX = temp->GetPositionX();
fLichPositionY = temp->GetPositionY();
@@ -1032,7 +1032,7 @@ public:
temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ);
uiEarthshatterGUID[0] = temp->GetGUID();
}
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED);
temp->SetWalk(false);
@@ -1040,7 +1040,7 @@ public:
temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ);
temp->AI()->Talk(SAY_LIGHT_OF_DAWN50);
}
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED);
temp->SetWalk(false);
@@ -1048,7 +1048,7 @@ public:
temp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED);
temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ);
}
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED);
temp->SetWalk(false);
@@ -1060,37 +1060,37 @@ public:
break;
case 43: // They all got kicked
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN13);
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
temp->SetSpeed(MOVE_RUN, 6.0f);
temp->SetStandState(UNIT_STAND_STATE_DEAD);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
temp->SetSpeed(MOVE_RUN, 6.0f);
temp->SetStandState(UNIT_STAND_STATE_DEAD);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
temp->SetSpeed(MOVE_RUN, 6.0f);
temp->SetStandState(UNIT_STAND_STATE_DEAD);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiDefenderGUID[0]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[0]))
{
temp->SetSpeed(MOVE_RUN, 6.0f);
temp->SetStandState(UNIT_STAND_STATE_DEAD);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiEarthshatterGUID[0]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[0]))
{
temp->SetSpeed(MOVE_RUN, 6.0f);
temp->SetStandState(UNIT_STAND_STATE_DEAD);
@@ -1100,11 +1100,11 @@ public:
break;
case 44: // make them stand up
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
temp->SetStandState(UNIT_STAND_STATE_STAND);
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
temp->SetStandState(UNIT_STAND_STATE_STAND);
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
temp->SetStandState(UNIT_STAND_STATE_STAND);
JumpToNextStep(1000);
break;
@@ -1126,7 +1126,7 @@ public:
case 47: // Ashbringer rebirth
me->SetStandState(UNIT_STAND_STATE_KNEEL);
Talk(EMOTE_LIGHT_OF_DAWN15);
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
temp->SetStandState(UNIT_STAND_STATE_STAND);
temp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING));
@@ -1139,38 +1139,38 @@ public:
//if (GameObject* go = me->GetMap()->GetGameObject(uiDawnofLightGUID))
// go->SetPhaseMask(128, true);
me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0, 0, 0, 0, 0, 30000);
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0))
temp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER);
temp->CastSpell(temp, 41542, false); // workarounds, light expoded, makes it cool
temp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
}
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->InterruptNonMeleeSpells(false);
JumpToNextStep(2500);
break;
case 49:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN54);
JumpToNextStep(4000);
break;
case 50:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN55);
JumpToNextStep(5000);
break;
case 51:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN56);
JumpToNextStep(1000);
break;
case 52: // Tiron charges
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN16);
temp->CastSpell(temp, SPELL_TIRION_CHARGE, false); // jumping charge
@@ -1178,20 +1178,20 @@ public:
temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running
temp->SetWalk(false);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z);
- if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* lktemp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him
}
JumpToNextStep(1500);
break;
case 53:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN57);
JumpToNextStep(1000);
break;
case 54:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
{
temp->SetSpeed(MOVE_RUN, 1.0f);
me->SetWalk(true);
@@ -1201,33 +1201,33 @@ public:
break;
case 55:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->SetStandState(UNIT_STAND_STATE_KNEEL);
JumpToNextStep(2000);
break;
case 56:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->SetStandState(UNIT_STAND_STATE_STAND);
JumpToNextStep(1500);
break;
case 57:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN58);
JumpToNextStep(10000);
break;
case 58:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN59);
JumpToNextStep(10000);
break;
case 59:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->CastSpell(temp, SPELL_TELEPORT_VISUAL, false);
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion
{
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
temp->SetSpeed(MOVE_RUN, 1.0f);
@@ -1237,7 +1237,7 @@ public:
break;
case 60:
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here
{
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN17);
temp->Kill(temp);
@@ -1246,13 +1246,13 @@ public:
break;
case 61:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN60);
JumpToNextStep(3000);
break;
case 62:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z);
@@ -1261,7 +1261,7 @@ public:
break;
case 63:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z);
temp->AI()->Talk(SAY_LIGHT_OF_DAWN61);
@@ -1270,37 +1270,37 @@ public:
break;
case 64:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN62);
JumpToNextStep(7000);
break;
case 65:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN63);
JumpToNextStep(10000);
break;
case 66:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN64);
JumpToNextStep(11000);
break;
case 67:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN65);
JumpToNextStep(10000);
break;
case 68:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN66);
JumpToNextStep(8000);
break;
case 69:
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN67);
JumpToNextStep(10000);
break;
@@ -1335,13 +1335,13 @@ public:
break;
case 73:
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
temp->DespawnOrUnsummon();
- if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID))
temp->DespawnOrUnsummon();
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
temp->DespawnOrUnsummon();
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->DespawnOrUnsummon();
me->DespawnOrUnsummon();
break;
@@ -1452,7 +1452,7 @@ public:
for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i)
DespawnNPC(uiWarriorGUID[i]);
- if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
{
temp->RemoveAllAuras();
temp->DeleteThreatList();
@@ -1463,7 +1463,7 @@ public:
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
{
temp->RemoveAllAuras();
temp->DeleteThreatList();
@@ -1474,7 +1474,7 @@ public:
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z);
}
- if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
{
temp->RemoveAllAuras();
temp->DeleteThreatList();
@@ -1486,7 +1486,7 @@ public:
}
DespawnNPC(uiRayneGUID);
- if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
{
temp->RemoveAllAuras();
temp->DeleteThreatList();
@@ -1498,10 +1498,10 @@ public:
temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false);
}
- if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID))
temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN04);
- if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
{
temp->RemoveAllAuras();
temp->DeleteThreatList();
@@ -1513,7 +1513,7 @@ public:
temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false);
}
- if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
temp->AI()->Talk(SAY_LIGHT_OF_DAWN26);
SetHoldState(false);
@@ -1532,7 +1532,7 @@ public:
void NPCChangeTarget(uint64 ui_GUID)
{
- if (Creature* temp = Unit::GetCreature(*me, ui_GUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, ui_GUID))
if (temp->IsAlive())
if (Unit* pTarger = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (pTarger->IsAlive())
@@ -1553,7 +1553,7 @@ public:
// Death
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiGhoulGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1563,7 +1563,7 @@ public:
}
for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiAbominationGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1573,7 +1573,7 @@ public:
}
for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiWarriorGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1583,7 +1583,7 @@ public:
}
for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiBehemothGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1595,7 +1595,7 @@ public:
// Dawn
for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiDefenderGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1606,7 +1606,7 @@ public:
}
for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i)
{
- temp = Unit::GetCreature(*me, uiEarthshatterGUID[i]);
+ temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]);
if (!temp)
{
temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1615,7 +1615,7 @@ public:
uiEarthshatterGUID[i] = temp->GetGUID();
}
}
- temp = Unit::GetCreature(*me, uiKorfaxGUID);
+ temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID);
if (!temp)
{
temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
@@ -1623,7 +1623,7 @@ public:
me->AddThreat(temp, 0.0f);
uiKorfaxGUID = temp->GetGUID();
}
- temp = Unit::GetCreature(*me, uiMaxwellGUID);
+ temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID);
if (!temp)
{
temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
@@ -1631,7 +1631,7 @@ public:
me->AddThreat(temp, 0.0f);
uiMaxwellGUID = temp->GetGUID();
}
- temp = Unit::GetCreature(*me, uiEligorGUID);
+ temp = ObjectAccessor::GetCreature(*me, uiEligorGUID);
if (!temp)
{
temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
@@ -1639,7 +1639,7 @@ public:
me->AddThreat(temp, 0.0f);
uiEligorGUID = temp->GetGUID();
}
- temp = Unit::GetCreature(*me, uiRayneGUID);
+ temp = ObjectAccessor::GetCreature(*me, uiRayneGUID);
if (!temp)
{
temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
@@ -1651,7 +1651,7 @@ public:
void DespawnNPC(uint64 pGUID)
{
- if (Creature* temp = Unit::GetCreature(*me, pGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, pGUID))
if (temp->IsAlive())
{
temp->SetVisible(false);
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
index e5be2cb6eb7..43dee1338ef 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
@@ -99,7 +99,7 @@ public:
FlyBackTimer = 4500;
break;
case 2:
- if (!player->isRessurectRequested())
+ if (!player->isResurrectRequested())
{
me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01);
DoCast(player, SPELL_REVIVE, true);
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 423f8f26130..0be681af915 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -356,7 +356,7 @@ public:
if (wait <= diff)
{
die = false;
- if (Unit* body = Unit::GetUnit(*me, bodyGUID))
+ if (Unit* body = ObjectAccessor::GetUnit(*me, bodyGUID))
body->Kill(body);
me->Kill(me);
}
@@ -428,7 +428,7 @@ public:
DoCast(me, SPELL_HEAD);
if (headGUID)
{
- if (Creature* Head = Unit::GetCreature((*me), headGUID))
+ if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID))
Head->DisappearAndDie();
headGUID = 0;
@@ -483,7 +483,7 @@ public:
wp_reached = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
SaySound(SAY_ENTRANCE);
- if (Unit* player = Unit::GetUnit(*me, PlayerGUID))
+ if (Unit* player = ObjectAccessor::GetUnit(*me, PlayerGUID))
DoStartMovement(player);
break;
}
@@ -516,7 +516,7 @@ public:
if (withhead)
SaySound(SAY_PLAYER_DEATH);
//maybe possible when player dies from conflagration
- else if (Creature* Head = Unit::GetCreature((*me), headGUID))
+ else if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID))
CAST_AI(npc_head::npc_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH);
}
}
@@ -601,7 +601,7 @@ public:
ThreatContainer::StorageType threatlist = caster->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->IsAlive() && unit != caster)
me->AddThreat(unit, caster->getThreatManager().getThreat(unit));
}
@@ -621,7 +621,7 @@ public:
if (!headGUID)
headGUID = DoSpawnCreature(HEAD, float(rand()%6), float(rand()%6), 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->GetGUID();
- Unit* Head = Unit::GetUnit(*me, headGUID);
+ Unit* Head = ObjectAccessor::GetUnit(*me, headGUID);
if (Head && Head->IsAlive())
{
Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -746,7 +746,7 @@ public:
--Phase;
else
Phase = 1;
- Creature* Head = Unit::GetCreature((*me), headGUID);
+ Creature* Head = ObjectAccessor::GetCreature((*me), headGUID);
if (Head && Head->IsAlive())
{
CAST_AI(npc_head::npc_headAI, Head->AI())->Phase = Phase;
@@ -837,7 +837,7 @@ public:
if (!debuffGUID)
return;
- Unit* debuff = Unit::GetUnit(*me, debuffGUID);
+ Unit* debuff = ObjectAccessor::GetUnit(*me, debuffGUID);
if (debuff)
{
debuff->SetVisible(false);
@@ -909,7 +909,7 @@ void npc_head::npc_headAI::Disappear()
if (bodyGUID)
{
- Creature* body = Unit::GetCreature((*me), bodyGUID);
+ Creature* body = ObjectAccessor::GetCreature((*me), bodyGUID);
if (body && body->IsAlive())
{
withbody = true;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index e345dc60074..a7c795a81f6 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -84,7 +84,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
//Any other Actions to do with vorrel? setStandState?
- if (Creature* vorrel = Creature::GetCreature(*me, instance->GetData64(DATA_VORREL)))
+ if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VORREL)))
vorrel->AI()->Talk(SAY_TRIGGER_VORREL);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index a8d1f91c443..25bb08620a1 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -33,12 +33,12 @@ enum Says
//Mograine says
SAY_MO_AGGRO = 0,
SAY_MO_KILL = 1,
- SAY_MO_RESSURECTED = 2,
+ SAY_MO_RESURRECTED = 2,
//Whitemane says
SAY_WH_INTRO = 0,
SAY_WH_KILL = 1,
- SAY_WH_RESSURECT = 2,
+ SAY_WH_RESURRECT = 2,
};
enum Spells
@@ -127,7 +127,7 @@ public:
return;
//On first death, fake death and open door, as well as initiate whitemane if exist
- if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
+ if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
{
instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS);
@@ -157,10 +157,10 @@ public:
void SpellHit(Unit* /*who*/, const SpellInfo* spell) override
{
- //When hit with ressurection say text
+ //When hit with resurrection say text
if (spell->Id == SPELL_SCARLETRESURRECTION)
{
- Talk(SAY_MO_RESSURECTED);
+ Talk(SAY_MO_RESURRECTED);
_bFakeDeath = false;
instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL);
@@ -174,8 +174,8 @@ public:
if (_bHasDied && !_bHeal && instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL)
{
- //On ressurection, stop fake death and heal whitemane and resume fight
- if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
+ //On resurrection, stop fake death and heal whitemane and resume fight
+ if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -294,7 +294,7 @@ public:
if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE)))
{
DoCast(mograine, SPELL_SCARLETRESURRECTION);
- Talk(SAY_WH_RESSURECT);
+ Talk(SAY_WH_RESURRECT);
_bCanResurrect = false;
}
}
@@ -325,7 +325,7 @@ public:
if (!HealthAbovePct(75))
target = me;
- if (Creature* mograine = Unit::GetCreature(*me, instance->GetData64(DATA_MOGRAINE)))
+ if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE)))
{
// checking _bCanResurrectCheck prevents her healing Mograine while he is "faking death"
if (_bCanResurrectCheck && mograine->IsAlive() && !mograine->HealthAbovePct(75))
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 9bcf67bce8c..4109328afda 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -187,7 +187,7 @@ public:
{
if (Die_Timer <= diff)
{
- if (Unit* temp = Unit::GetUnit(*me, Tagger))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, Tagger))
{
if (Player* player = temp->ToPlayer())
player->KilledMonsterCredit(NPC_RESTLESS, me->GetGUID());
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 5bca936d5b4..8a9699ed1be 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -280,7 +280,7 @@ public:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
if (!target)
{
@@ -306,7 +306,7 @@ public:
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
if (!target)
{
@@ -335,7 +335,7 @@ public:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
if (!target)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 28bb24f49a9..d300703152c 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -766,7 +766,7 @@ public:
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetPositionZ() > me->GetPositionZ() + 5)
me->getThreatManager().modifyThreatPercent(unit, -100);
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 179a649aab4..565d40a802e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -956,7 +956,7 @@ public:
ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
pPortal->AddThreat(unit, 1.0f);
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index 9d9232b774d..faecb2ca2f0 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -603,7 +603,7 @@ public:
{
if (SpellTimer <= diff)
{
- Unit* Victim = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
switch (NeedForAHack)
{
case 0:
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 9134f15959f..f06dc247883 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -94,7 +94,7 @@ class boss_archaedas : public CreatureScript
void ActivateMinion(uint64 uiGuid, bool flag)
{
- Unit* minion = Unit::GetUnit(*me, uiGuid);
+ Unit* minion = ObjectAccessor::GetUnit(*me, uiGuid);
if (minion && minion->IsAlive())
{
@@ -139,7 +139,7 @@ class boss_archaedas : public CreatureScript
} else if (bWakingUp && iAwakenTimer <= 0)
{
bWakingUp = false;
- AttackStart(Unit::GetUnit(*me, instance->GetData64(0)));
+ AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0)));
return; // dont want to continue until we finish the AttackStart method
}
@@ -285,7 +285,7 @@ class npc_archaedas_minions : public CreatureScript
{
bWakingUp = false;
bAmIAwake = true;
- // AttackStart(Unit::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID
+ // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID
return; // dont want to continue until we finish the AttackStart method
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index 717406e6750..56c84677181 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -252,7 +252,7 @@ class instance_uldaman : public InstanceMapScript
if (!archaedas)
return;
- if (Unit::GetUnit(*archaedas, target))
+ if (ObjectAccessor::GetUnit(*archaedas, target))
{
archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN, false);
whoWokeuiArchaedasGUID = target;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 3adca160720..9810c42bdfb 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -304,13 +304,13 @@ class boss_akilzon : public CreatureScript
break;
case EVENT_STORM_SEQUENCE:
{
- Unit* target = Unit::GetUnit(*me, CloudGUID);
+ Unit* target = ObjectAccessor::GetUnit(*me, CloudGUID);
if (!target || !target->IsAlive())
{
EnterEvadeMode();
return;
}
- else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID))
+ else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, CycloneGUID))
Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or...
HandleStormSequence(target);
break;
@@ -323,7 +323,7 @@ class boss_akilzon : public CreatureScript
for (uint8 i = 0; i < 8; ++i)
{
- Unit* bird = Unit::GetUnit(*me, BirdGUIDs[i]);
+ Unit* bird = ObjectAccessor::GetUnit(*me, BirdGUIDs[i]);
if (!bird) //they despawned on die
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -406,7 +406,7 @@ class npc_akilzon_eagle : public CreatureScript
arrived = true;
if (TargetGUID)
{
- if (Unit* target = Unit::GetUnit(*me, TargetGUID))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID))
DoCast(target, SPELL_EAGLE_SWOOP, true);
TargetGUID = 0;
me->SetSpeed(MOVE_RUN, 1.2f);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index 2da0201e060..74ce267441f 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -152,7 +152,7 @@ class boss_halazzi : public CreatureScript
me->Attack(me->GetVictim(), true);
me->GetMotionMaster()->MoveChase(me->GetVictim());
}
- if (Creature* Lynx = Unit::GetCreature(*me, LynxGUID))
+ if (Creature* Lynx = ObjectAccessor::GetCreature(*me, LynxGUID))
Lynx->DisappearAndDie();
me->SetMaxHealth(600000);
me->SetHealth(600000 - 150000 * TransformCount);
@@ -174,7 +174,7 @@ class boss_halazzi : public CreatureScript
TotemTimer = 12000;
break;
case PHASE_MERGE:
- if (Unit* pLynx = Unit::GetUnit(*me, LynxGUID))
+ if (Unit* pLynx = ObjectAccessor::GetUnit(*me, LynxGUID))
{
Talk(SAY_MERGE);
pLynx->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -259,7 +259,7 @@ class boss_halazzi : public CreatureScript
EnterPhase(PHASE_MERGE);
else
{
- Unit* Lynx = Unit::GetUnit(*me, LynxGUID);
+ Unit* Lynx = ObjectAccessor::GetUnit(*me, LynxGUID);
if (Lynx && !Lynx->HealthAbovePct(20) /*Lynx->HealthBelowPct(10)*/)
EnterPhase(PHASE_MERGE);
}
@@ -272,7 +272,7 @@ class boss_halazzi : public CreatureScript
{
if (CheckTimer <= diff)
{
- Unit* Lynx = Unit::GetUnit(*me, LynxGUID);
+ Unit* Lynx = ObjectAccessor::GetUnit(*me, LynxGUID);
if (Lynx)
{
Lynx->GetMotionMaster()->MoveFollow(me, 0, 0);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index a7afa93e835..6e5517e82a6 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -303,7 +303,7 @@ class boss_hexlord_malacrass : public CreatureScript
for (uint8 i = 0; i < 4; ++i)
{
- Creature* creature = Unit::GetCreature(*me, AddGUID[i]);
+ Creature* creature = ObjectAccessor::GetCreature(*me, AddGUID[i]);
if (creature && creature->IsAlive())
creature->AI()->AttackStart(me->GetVictim());
else
@@ -338,7 +338,7 @@ class boss_hexlord_malacrass : public CreatureScript
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Temp = Unit::GetUnit(*me, AddGUID[i]);
+ Unit* Temp = ObjectAccessor::GetUnit(*me, AddGUID[i]);
if (Temp && Temp->IsAlive())
Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
@@ -363,7 +363,7 @@ class boss_hexlord_malacrass : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* creature = (Unit::GetCreature((*me), AddGUID[i]));
+ Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i]));
if (!creature || !creature->IsAlive())
{
if (creature) creature->setDeathState(DEAD);
@@ -397,7 +397,7 @@ class boss_hexlord_malacrass : public CreatureScript
if (CheckAddState_Timer <= diff)
{
for (uint8 i = 0; i < 4; ++i)
- if (Creature* temp = Unit::GetCreature(*me, AddGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, AddGUID[i]))
if (temp->IsAlive() && !temp->GetVictim())
temp->AI()->AttackStart(me->GetVictim());
@@ -462,7 +462,7 @@ class boss_hexlord_malacrass : public CreatureScript
if (PlayerAbility_Timer <= diff)
{
- //Unit* target = Unit::GetUnit(*me, PlayerGUID);
+ //Unit* target = ObjectAccessor::GetUnit(*me, PlayerGUID);
//if (target && target->IsAlive())
//{
UseAbility();
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index 47ca91ec591..f264b12ca23 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -292,7 +292,7 @@ class boss_janalai : public CreatureScript
{
if (BombCount < 40)
{
- if (Unit* FireBomb = Unit::GetUnit(*me, FireBombGUIDs[BombCount]))
+ if (Unit* FireBomb = ObjectAccessor::GetUnit(*me, FireBombGUIDs[BombCount]))
{
FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 179b29b70d8..6b0fc05ba3d 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -229,7 +229,7 @@ class boss_zuljin : public CreatureScript
Talk(YELL_DEATH);
Summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE);
- if (Unit* Temp = Unit::GetUnit(*me, SpiritGUID[3]))
+ if (Unit* Temp = ObjectAccessor::GetUnit(*me, SpiritGUID[3]))
Temp->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD);
}
@@ -284,7 +284,7 @@ class boss_zuljin : public CreatureScript
{
if (SpiritGUID[i])
{
- if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, SpiritGUID[i]))
{
temp->SetVisible(false);
temp->setDeathState(DEAD);
@@ -322,10 +322,10 @@ class boss_zuljin : public CreatureScript
Talk(Transform[Phase].text);
if (Phase > 0)
{
- if (Unit* Temp = Unit::GetUnit(*me, SpiritGUID[Phase - 1]))
+ if (Unit* Temp = ObjectAccessor::GetUnit(*me, SpiritGUID[Phase - 1]))
Temp->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD);
}
- if (Unit* Temp = Unit::GetUnit(*me, SpiritGUID[NextPhase - 1]))
+ if (Unit* Temp = ObjectAccessor::GetUnit(*me, SpiritGUID[NextPhase - 1]))
Temp->CastSpell(me, SPELL_SIPHON_SOUL, false); // should m cast on temp
if (NextPhase == 2)
{
@@ -442,7 +442,7 @@ class boss_zuljin : public CreatureScript
if (Claw_Loop_Timer <= diff)
{
Unit* target = me->GetVictim();
- if (!target || !target->isTargetableForAttack()) target = Unit::GetUnit(*me, TankGUID);
+ if (!target || !target->isTargetableForAttack()) target = ObjectAccessor::GetUnit(*me, TankGUID);
if (!target || !target->isTargetableForAttack()) target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
{
@@ -455,7 +455,7 @@ class boss_zuljin : public CreatureScript
{
Claw_Rage_Timer = urand(15000, 20000);
me->SetSpeed(MOVE_RUN, 1.2f);
- AttackStart(Unit::GetUnit(*me, TankGUID));
+ AttackStart(ObjectAccessor::GetUnit(*me, TankGUID));
TankGUID = 0;
return;
}
@@ -503,7 +503,7 @@ class boss_zuljin : public CreatureScript
{
Lynx_Rush_Timer = urand(15000, 20000);
me->SetSpeed(MOVE_RUN, 1.2f);
- AttackStart(Unit::GetUnit(*me, TankGUID));
+ AttackStart(ObjectAccessor::GetUnit(*me, TankGUID));
TankGUID = 0;
}
else
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index efd18472a52..4ac34615498 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -344,7 +344,7 @@ class npc_zulian_prowler : public CreatureScript
DoCast(me, SPELL_SNEAK_RANK_1_1);
DoCast(me, SPELL_SNEAK_RANK_1_2);
- if (Unit* arlokk = me->GetUnit(*me, _instance->GetData64(NPC_ARLOKK)))
+ if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetData64(NPC_ARLOKK)))
me->GetMotionMaster()->MovePoint(0, arlokk->GetPositionX(), arlokk->GetPositionY(), arlokk->GetPositionZ());
_events.ScheduleEvent(EVENT_ATTACK, 6000);
}
diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
index ecf2bd95cbe..e7e374ea26e 100644
--- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
@@ -252,7 +252,7 @@ public:
{
me->DisappearAndDie();
- if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
+ if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
{
if (pMarzon->IsAlive())
pMarzon->DisappearAndDie();
@@ -261,7 +261,7 @@ public:
void EnterCombat(Unit* who) override
{
- if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
+ if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
{
if (pMarzon->IsAlive() && !pMarzon->IsInCombat())
pMarzon->AI()->AttackStart(who);
@@ -335,7 +335,7 @@ public:
uiPhase = 0;
break;
case 5:
- if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
+ if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
pMarzon->AI()->Talk(SAY_MARZON_1);
uiTimer = 3000;
uiPhase = 6;
@@ -350,7 +350,7 @@ public:
case 7:
if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true))
pTyrion->AI()->Talk(SAY_TYRION_2);
- if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
+ if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
pMarzon->setFaction(14);
me->setFaction(14);
uiTimer = 0;
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 07cdcefcbbb..0958a9141f0 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -130,7 +130,7 @@ public:
{
if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY)
{
- if (Creature* target = Unit::GetCreature(*summoned, targetGUID))
+ if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
{
target->MonsterMoveWithSpeed(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0);
target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index eeda208f0e1..353b5ab9501 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -1036,7 +1036,7 @@ class npc_grizzlemaw_cw_trigger : public CreatureScript
if (who && who->GetDistance2d(me) < 10.0f)
if (Player* player = who->ToPlayer())
if (player->GetQuestStatus(QUEST_HOME_OF_THE_BEAR_MEN) == QUEST_STATUS_INCOMPLETE)
- if (Creature* orphan = Creature::GetCreature(*me, getOrphanGUID(player, ORPHAN_WOLVAR)))
+ if (Creature* orphan = ObjectAccessor::GetCreature(*me, getOrphanGUID(player, ORPHAN_WOLVAR)))
{
player->AreaExploredOrEventHappens(QUEST_HOME_OF_THE_BEAR_MEN);
orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_10);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index ebe9939390f..7aaa2239745 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -94,7 +94,7 @@ public:
{
if (waypointId == 7)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index c0f3ea35004..d86e3342cf0 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -118,7 +118,7 @@ public:
{
if (CheckTimer <= diff)
{
- if (Unit* Archimonde = Unit::GetUnit(*me, ArchimondeGUID))
+ if (Unit* Archimonde = ObjectAccessor::GetUnit(*me, ArchimondeGUID))
{
if (Archimonde->HealthBelowPct(2) || !Archimonde->IsAlive())
DoCast(me, SPELL_DENOUEMENT_WISP);
@@ -205,7 +205,7 @@ public:
{
if (ChangeTargetTimer <= diff)
{
- if (Unit* temp = Unit::GetUnit(*me, TargetGUID))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, TargetGUID))
{
me->GetMotionMaster()->MoveFollow(temp, 0.0f, 0.0f);
TargetGUID = 0;
@@ -364,7 +364,7 @@ public:
ThreatContainer::StorageType::const_iterator itr = threatlist.begin();
for (; itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->IsAlive())
targets.push_back(unit);
}
@@ -406,7 +406,7 @@ public:
summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false);
summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID());
- if (Unit* DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID))
+ if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID))
{
summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f);
DoomfireSpiritGUID = 0;
@@ -487,7 +487,7 @@ public:
if (temp)
WorldTreeGUID = temp->GetGUID();
- if (Unit* Nordrassil = Unit::GetUnit(*me, WorldTreeGUID))
+ if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID))
{
Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Nordrassil->SetDisplayId(11686);
@@ -496,7 +496,7 @@ public:
}
}
- if (Unit* Nordrassil = Unit::GetUnit(*me, WorldTreeGUID))
+ if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID))
{
Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true);
DrainNordrassilTimer = 1000;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index d7c48541315..c9e010e4159 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -99,7 +99,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 193b8bfe483..5266f2b22c5 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -94,7 +94,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index 21fe3ab946b..9ac5034d954 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -89,7 +89,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index c8006158ef1..4e6da7dcac2 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -665,7 +665,7 @@ void hyjalAI::DeSpawnVeins()
{
if (Faction == 1)
{
- Creature* unit=Unit::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE));
+ Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
@@ -676,7 +676,7 @@ void hyjalAI::DeSpawnVeins()
}
} else if (Faction)
{
- Creature* unit=Unit::GetCreature((*me), instance->GetData64(DATA_THRALL));
+ Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_THRALL));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
@@ -804,7 +804,7 @@ void hyjalAI::UpdateAI(uint32 diff)
{
if (BossGUID[i])
{
- Unit* unit = Unit::GetUnit(*me, BossGUID[i]);
+ Unit* unit = ObjectAccessor::GetUnit(*me, BossGUID[i]);
if (unit && (!unit->IsAlive()))
{
if (BossGUID[i] == BossGUID[0])
@@ -937,7 +937,7 @@ void hyjalAI::WaypointReached(uint32 waypointId)
DoCast(me, SPELL_MASS_TELEPORT, false);
if (me->GetEntry() == THRALL && DummyGuid)
{
- if (Creature* creature = Unit::GetCreature(*me, DummyGuid))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, DummyGuid))
{
hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
ai->DoMassTeleport = true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 038b7ab69ce..85de43cb4c4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -447,7 +447,7 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -486,7 +486,7 @@ public:
CanMove = true;
if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT))
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
} else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){
@@ -563,13 +563,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -662,13 +662,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -773,13 +773,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -886,13 +886,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -982,13 +982,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1068,13 +1068,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1155,7 +1155,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
@@ -1276,7 +1276,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index 0e6d60395d8..fd832051421 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -627,7 +627,7 @@ public:
JumpToNextStep(2000);
break;
case 3:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
{
uther->AI()->Talk(SAY_PHASE102);
}
@@ -642,13 +642,13 @@ public:
break;
//After waypoint 1
case 5:
- if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->SetTarget(me->GetGUID());
Talk(SAY_PHASE104);
JumpToNextStep(10000);
break;
case 6:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->AI()->Talk(SAY_PHASE105);
JumpToNextStep(1000);
break;
@@ -657,7 +657,7 @@ public:
JumpToNextStep(4000);
break;
case 8:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->AI()->Talk(SAY_PHASE107);
JumpToNextStep(6000);
break;
@@ -666,7 +666,7 @@ public:
JumpToNextStep(4000);
break;
case 10:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->AI()->Talk(SAY_PHASE109);
JumpToNextStep(8000);
break;
@@ -675,7 +675,7 @@ public:
JumpToNextStep(4000);
break;
case 12:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->AI()->Talk(SAY_PHASE111);
JumpToNextStep(4000);
break;
@@ -684,7 +684,7 @@ public:
JumpToNextStep(11000);
break;
case 14:
- if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->AI()->Talk(SAY_PHASE113);
JumpToNextStep(3000);
break;
@@ -693,12 +693,12 @@ public:
JumpToNextStep(9000);
break;
case 16:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->AI()->Talk(SAY_PHASE115);
JumpToNextStep(4000);
break;
case 17:
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
{
uther->SetWalk(true);
uther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
@@ -706,7 +706,7 @@ public:
JumpToNextStep(1000);
break;
case 18:
- if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{
me->SetTarget(jainaGUID);
jaina->SetWalk(true);
@@ -719,7 +719,7 @@ public:
JumpToNextStep(1000);
break;
case 20:
- if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->AI()->Talk(SAY_PHASE117);
JumpToNextStep(3000);
break;
@@ -740,10 +740,10 @@ public:
bStepping = false;
SetRun(true);
- if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->DisappearAndDie();
- if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->DisappearAndDie();
me->SetTarget(0);
@@ -772,7 +772,7 @@ public:
//After waypoint 9
case 27:
me->SetTarget(citymenGUID[0]);
- if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0]))
+ if (Creature* cityman = ObjectAccessor::GetCreature(*me, citymenGUID[0]))
{
cityman->SetTarget(me->GetGUID());
cityman->SetWalk(true);
@@ -781,7 +781,7 @@ public:
JumpToNextStep(2000);
break;
case 28:
- if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0]))
+ if (Creature* cityman = ObjectAccessor::GetCreature(*me, citymenGUID[0]))
cityman->AI()->Talk(SAY_PHASE202);
JumpToNextStep(4000);
break;
@@ -799,11 +799,11 @@ public:
case 31:
SetEscortPaused(false);
bStepping = false;
- if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1]))
+ if (Creature* cityman1 = ObjectAccessor::GetCreature(*me, citymenGUID[1]))
{
cityman1->AI()->Talk(SAY_PHASE204);
cityman1->SetTarget(me->GetGUID());
- if (Creature* cityman0 = Unit::GetCreature(*me, citymenGUID[0]))
+ if (Creature* cityman0 = ObjectAccessor::GetCreature(*me, citymenGUID[0]))
cityman0->Kill(cityman0);
me->SetTarget(citymenGUID[1]);
}
@@ -815,7 +815,7 @@ public:
JumpToNextStep(1000);
break;
case 33:
- if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1]))
+ if (Creature* cityman1 = ObjectAccessor::GetCreature(*me, citymenGUID[1]))
cityman1->Kill(cityman1);
JumpToNextStep(1000);
break;
@@ -839,7 +839,7 @@ public:
case 36:
if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000))
{
- if (Creature* pStalkerM = Unit::GetCreature(*me, stalkerGUID))
+ if (Creature* pStalkerM = ObjectAccessor::GetCreature(*me, stalkerGUID))
malganis->CastSpell(pStalkerM, 63793, false);
malganisGUID = malganis->GetGUID();
@@ -850,7 +850,7 @@ public:
JumpToNextStep(11000);
break;
case 37:
- if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID))
{
Creature* pZombie = GetClosestCreatureWithEntry(malganis, NPC_CITY_MAN, 100.0f);
if (!pZombie)
@@ -865,12 +865,12 @@ public:
phaseTimer = 500;
break;
case 38:
- if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID))
malganis->AI()->Talk(SAY_PHASE207);
JumpToNextStep(17000);
break;
case 39:
- if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID))
malganis->SetVisible(false);
Talk(SAY_PHASE208);
JumpToNextStep(7000);
@@ -922,7 +922,7 @@ public:
if (waveGUID[i] == 0)
break;
++mobCounter;
- Unit* temp = Unit::GetCreature(*me, waveGUID[i]);
+ Unit* temp = ObjectAccessor::GetCreature(*me, waveGUID[i]);
if (!temp || temp->isDead())
++deadCounter;
}
@@ -976,16 +976,16 @@ public:
//After Gossip 2 (waypoint 22)
case 61:
me->SetReactState(REACT_AGGRESSIVE);
- if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0]))
disguised0->SetTarget(me->GetGUID());
- if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1]))
+ if (Creature* disguised1 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[1]))
disguised1->SetTarget(me->GetGUID());
- if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2]))
+ if (Creature* disguised2 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[2]))
disguised2->SetTarget(me->GetGUID());
JumpToNextStep(1000);
break;
case 62:
- if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0]))
disguised0->AI()->Talk(SAY_PHASE302);
JumpToNextStep(7000);
break;
@@ -1001,7 +1001,7 @@ public:
JumpToNextStep(1000);
break;
case 65:
- if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0]))
disguised0->HandleEmoteCommand(11);
JumpToNextStep(1000);
break;
@@ -1010,12 +1010,12 @@ public:
JumpToNextStep(2000);
break;
case 67:
- if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0]))
disguised0->AI()->Talk(SAY_PHASE305);
JumpToNextStep(1000);
break;
case 68:
- if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2]))
+ if (Creature* disguised2 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[2]))
{
disguised2->UpdateEntry(NPC_INFINITE_HUNTER);
//Make them unattackable
@@ -1025,7 +1025,7 @@ public:
JumpToNextStep(2000);
break;
case 69:
- if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1]))
+ if (Creature* disguised1 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[1]))
{
disguised1->UpdateEntry(NPC_INFINITE_AGENT);
//Make them unattackable
@@ -1035,7 +1035,7 @@ public:
JumpToNextStep(2000);
break;
case 70:
- if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0]))
{
disguised0->UpdateEntry(NPC_INFINITE_ADVERSARY);
//Make them unattackable
@@ -1051,7 +1051,7 @@ public:
case 77:
//Make cratures attackable
for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, infiniteDraconianGUID[i]))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[i]))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetReactState(REACT_AGGRESSIVE);
@@ -1091,7 +1091,7 @@ public:
if (instance->GetData(DATA_EPOCH_EVENT) != DONE)
{
SpawnTimeRift(17, &epochGUID);
- if (Creature* epoch = Unit::GetCreature(*me, epochGUID))
+ if (Creature* epoch = ObjectAccessor::GetCreature(*me, epochGUID))
epoch->AI()->Talk(SAY_PHASE314);
me->SetTarget(epochGUID);
}
@@ -1105,7 +1105,7 @@ public:
case 82:
if (instance->GetData(DATA_EPOCH_EVENT) != DONE)
{
- if (Creature* epoch = Unit::GetCreature(*me, epochGUID))
+ if (Creature* epoch = ObjectAccessor::GetCreature(*me, epochGUID))
{
//Make Epoch attackable
epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
@@ -1157,7 +1157,7 @@ public:
me->SetTarget(malganisGUID);
break;
case 87:
- if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID))
{
malganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_UNK_6 | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNK_15);
malganis->SetReactState(REACT_AGGRESSIVE);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
index dbd844aa34c..503166e0b12 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
@@ -187,7 +187,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
// Summon Chromie and global whisper
if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos))
if (!instance->GetPlayers().isEmpty())
- sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
+ chromie->AI()->TalkToMap(SAY_CRATES_COMPLETED);
}
DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount);
break;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index f6ff1719391..14f9bfb2e2f 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -402,7 +402,7 @@ public:
case 94:
if (uint64 TarethaGUID = instance->GetData64(DATA_TARETHA))
{
- if (Creature* Taretha = Creature::GetCreature(*me, TarethaGUID))
+ if (Creature* Taretha = ObjectAccessor::GetCreature(*me, TarethaGUID))
Taretha->AI()->Talk(SAY_TA_ESCAPED, me);
}
break;
@@ -590,7 +590,7 @@ public:
if (instance->GetData64(DATA_EPOCH) == 0)
creature->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
- if (Creature* thrall = (Unit::GetCreature(*creature, instance->GetData64(DATA_THRALL))))
+ if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_THRALL))))
CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP();
}
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 35086afa42e..21da920e4fd 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -545,7 +545,7 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
- Unit* unit = Unit::GetUnit(*me, i->first);
+ Unit* unit = ObjectAccessor::GetUnit(*me, i->first);
//Only units out of stomach
if (unit && i->second == false)
@@ -640,7 +640,7 @@ public:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Emerging phase
- //AttackStart(Unit::GetUnit(*me, HoldpPlayer));
+ //AttackStart(ObjectAccessor::GetUnit(*me, HoldpPlayer));
DoZoneInCombat();
//Place all units in threat list on outside of stomach
@@ -686,7 +686,7 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
- Unit* unit = Unit::GetUnit(*me, i->first);
+ Unit* unit = ObjectAccessor::GetUnit(*me, i->first);
//Only move units in stomach
if (unit && i->second == true)
@@ -717,7 +717,7 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
- Unit* unit = Unit::GetUnit(*me, i->first);
+ Unit* unit = ObjectAccessor::GetUnit(*me, i->first);
//Only apply to units in stomach
if (unit && i->second == true)
@@ -767,7 +767,7 @@ public:
if (StomachEnterVisTimer <= diff)
{
//Check for valid player
- Unit* unit = Unit::GetUnit(*me, StomachEnterTarget);
+ Unit* unit = ObjectAccessor::GetUnit(*me, StomachEnterTarget);
if (unit)
{
@@ -917,7 +917,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
}
@@ -998,7 +998,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
}
@@ -1026,7 +1026,7 @@ public:
{
if (EvadeTimer <= diff)
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
//Dissapear and reappear at new position
@@ -1115,7 +1115,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
}
@@ -1144,7 +1144,7 @@ public:
{
if (EvadeTimer <= diff)
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
//Dissapear and reappear at new position
@@ -1234,7 +1234,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Unit* p = Unit::GetUnit(*me, Portal))
+ if (Unit* p = ObjectAccessor::GetUnit(*me, Portal))
p->Kill(p);
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index 6775d84d435..acf0215f9ff 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -103,7 +103,7 @@ struct boss_twinemperorsAI : public ScriptedAI
Creature* GetOtherBoss()
{
- return Unit::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR));
+ return ObjectAccessor::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR));
}
void DamageTaken(Unit* /*done_by*/, uint32 &damage) override
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index aa9180d79c2..0614303515c 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -132,7 +132,7 @@ public:
void SendMyListToBuddies()
{
for (int i=0; i<3; ++i)
- if (Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
+ if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i]))
GiveBuddyMyList(pNearby);
}
@@ -140,7 +140,7 @@ public:
{
for (int i=0; i<3; ++i)
{
- Creature* c = Unit::GetCreature(*me, NearbyGUID[i]);
+ Creature* c = ObjectAccessor::GetCreature(*me, NearbyGUID[i]);
if (c)
{
if (!c->IsInCombat())
@@ -195,7 +195,7 @@ public:
if (!NearbyGUID[bli])
break;
- Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[bli]);
+ Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[bli]);
if (!pNearby)
break;
@@ -221,7 +221,7 @@ public:
{
if (!NearbyGUID[i])
continue;
- if (Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
+ if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i]))
{
if (pNearby->isDead())
pNearby->Respawn();
@@ -250,7 +250,7 @@ public:
{
for (int ni=0; ni<3; ++ni)
{
- Creature* sent = Unit::GetCreature(*me, NearbyGUID[ni]);
+ Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
continue;
if (sent->isDead())
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 67e3801f842..be70b2e9fa4 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -443,7 +443,7 @@ public:
uint32 NextStep(uint8 Step)
{
- Creature* Spark = Unit::GetCreature(*me, SparkGUID);
+ Creature* Spark = ObjectAccessor::GetCreature(*me, SparkGUID);
if (!Spark)
return 99999999;
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp
index 8d6ae347b85..358814d440a 100644
--- a/src/server/scripts/Kalimdor/zone_durotar.cpp
+++ b/src/server/scripts/Kalimdor/zone_durotar.cpp
@@ -447,7 +447,7 @@ class spell_mount_check : public SpellScriptLoader
class spell_mount_check_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_mount_check_AuraScript)
+ PrepareAuraScript(spell_mount_check_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -495,7 +495,7 @@ class spell_voljin_war_drums : public SpellScriptLoader
class spell_voljin_war_drums_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_voljin_war_drums_SpellScript)
+ PrepareSpellScript(spell_voljin_war_drums_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -552,7 +552,7 @@ class spell_voodoo : public SpellScriptLoader
class spell_voodoo_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_voodoo_SpellScript)
+ PrepareSpellScript(spell_voodoo_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index 3f4fb31a11d..04cec70b7ad 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -706,7 +706,7 @@ public:
break;
case 65:
me->SetVisible(false);
- if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID)))
+ if (Creature* AnachronosQuestTrigger = (ObjectAccessor::GetCreature(*me, AnachronosQuestTriggerGUID)))
{
Talk(ARYGOS_YELL_1);
AnachronosQuestTrigger->AI()->EnterEvadeMode();
@@ -1002,11 +1002,11 @@ void npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/)
if (!MobGUID)
return;
- if (Creature* mob = Unit::GetCreature(*me, MobGUID))
+ if (Creature* mob = ObjectAccessor::GetCreature(*me, MobGUID))
if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, mob->AI()))
triggerAI->LiveCounter();
-};
+}
/*#####
# go_crystalline_tear
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 4ac4e502363..23e8e2f26ff 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -584,7 +584,7 @@ public:
{
PostEventTimer = 5000;
- Creature* torta = Creature::GetCreature(*me, TortaGUID);
+ Creature* torta = ObjectAccessor::GetCreature(*me, TortaGUID);
if (!torta || !torta->IsAlive())
{
//something happened, so just complete
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index ae8c279947d..dabfee00065 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -380,7 +380,7 @@ public:
{
if (AffrayChallenger[i])
{
- Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]);
+ Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i]);
if (creature && creature->IsAlive())
creature->DisappearAndDie();
}
@@ -388,7 +388,7 @@ public:
if (BigWill) // unsummon bigWill
{
- Creature* creature = Unit::GetCreature((*me), BigWill);
+ Creature* creature = ObjectAccessor::GetCreature((*me), BigWill);
if (creature && creature->IsAlive())
creature->DisappearAndDie();
}
@@ -429,7 +429,7 @@ public:
{
if (AffrayChallenger[i])
{
- Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]);
+ Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i]);
if ((!creature || (!creature->IsAlive())) && !ChallengerDown[i])
{
Talk(SAY_TWIGGY_FLATHEAD_DOWN);
diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
index d6d45d72f5b..09f82b0417c 100644
--- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
@@ -270,7 +270,7 @@ public:
{
if (EndEventTimer <= Diff)
{
- Creature* spraggle = Creature::GetCreature(*me, SpraggleGUID);
+ Creature* spraggle = ObjectAccessor::GetCreature(*me, SpraggleGUID);
if (!spraggle || !spraggle->IsAlive())
{
SetFollowComplete();
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
index 09fdbcbce70..1c042f4d185 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -211,7 +211,7 @@ public:
// Check if all summons in this phase killed
for (SummonList::const_iterator iter = Summons.begin(); iter != Summons.end(); ++iter)
{
- if (Creature* visage = Unit::GetCreature(*me, *iter))
+ if (Creature* visage = ObjectAccessor::GetCreature(*me, *iter))
{
// Not all are dead
if (phase == visage->GetPhaseMask())
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
index aab0f22169f..b78bdae5c87 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -212,7 +212,7 @@ public:
}
else
{
- if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET)))
{
AttackStart(target);
instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0);
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index a4c3edb85f3..bf5855c3318 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -188,7 +188,7 @@ public:
}
break;
case IMPALE_PHASE_ATTACK:
- if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
+ if (Creature* impaleTarget = ObjectAccessor::GetCreature(*me, ImpaleTarget))
{
impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SPIKE, false);
impaleTarget->RemoveAurasDueToSpell(SPELL_IMPALE_SHAKEGROUND);
@@ -197,7 +197,7 @@ public:
ImpaleTimer = 1*IN_MILLISECONDS;
break;
case IMPALE_PHASE_DMG:
- if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
+ if (Creature* impaleTarget = ObjectAccessor::GetCreature(*me, ImpaleTarget))
me->CastSpell(impaleTarget, SPELL_IMPALE_DMG, true);
ImpalePhase = IMPALE_PHASE_TARGET;
ImpaleTimer = 9*IN_MILLISECONDS;
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index 12c3c580cae..81e124cf5bc 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -178,15 +178,15 @@ public:
Talk(SAY_SARTHARION_DEATH);
_JustDied();
- if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
if (tenebron->IsAlive())
tenebron->DisappearAndDie();
- if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
if (shadron->IsAlive())
shadron->DisappearAndDie();
- if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
if (vesperon->IsAlive())
vesperon->DisappearAndDie();
}
@@ -211,7 +211,7 @@ public:
void DrakeRespawn() // Drakes respawning system
{
- if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
{
tenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f);
if (tenebron->IsAlive())
@@ -231,7 +231,7 @@ public:
}
}
- if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
{
shadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f);
if (shadron->IsAlive())
@@ -251,7 +251,7 @@ public:
}
}
- if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
{
vesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f);
if (vesperon->IsAlive())
@@ -280,7 +280,7 @@ public:
//if at least one of the dragons are alive and are being called
bool _canUseWill = false;
- if (Creature* fetchTene = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
{
if (fetchTene->IsAlive() && !fetchTene->GetVictim())
{
@@ -298,7 +298,7 @@ public:
}
}
- if (Creature* fetchShad = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
{
if (fetchShad->IsAlive() && !fetchShad->GetVictim())
{
@@ -316,7 +316,7 @@ public:
}
}
- if (Creature* fetchVesp = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
{
if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim())
{
@@ -340,7 +340,7 @@ public:
void CallDragon(uint32 dataId)
{
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(dataId)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(dataId)))
{
if (temp->IsAlive() && !temp->GetVictim())
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index cb0cba21d6c..7e9e351ae9c 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -292,7 +292,7 @@ public:
bHealth = false;
bDone = false;
- if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID))
+ if (Creature* pMemory = ObjectAccessor::GetCreature(*me, MemoryGUID))
if (pMemory->IsAlive())
pMemory->RemoveFromWorld();
}
@@ -373,7 +373,7 @@ public:
DoCast(me, SPELL_RENEW);
break;
case 1:
- if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID))
+ if (Creature* pMemory = ObjectAccessor::GetCreature(*me, MemoryGUID))
if (pMemory->IsAlive())
DoCast(pMemory, SPELL_RENEW);
break;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
index 46817e46512..a8aff70b034 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -140,7 +140,7 @@ public:
for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{
- if (Creature* temp = Unit::GetCreature(*me, *itr))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
if (temp)
temp->DisappearAndDie();
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
index 2b1d582bcd4..2e24398d49a 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -126,9 +126,9 @@ bool GrandChampionsOutVehicle(Creature* me)
if (!instance)
return false;
- Creature* pGrandChampion1 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1));
- Creature* pGrandChampion2 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2));
- Creature* pGrandChampion3 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3));
+ Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1));
+ Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2));
+ Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3));
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
@@ -829,7 +829,7 @@ public:
if (bShoot && uiMultiShotTimer <= uiDiff)
{
me->InterruptNonMeleeSpells(true);
- Unit* target = Unit::GetUnit(*me, uiTargetGUID);
+ Unit* target = ObjectAccessor::GetUnit(*me, uiTargetGUID);
if (target && me->IsInRange(target, 5.0f, 30.0f, false))
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
index faeb92e4595..e22ee040599 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
@@ -161,7 +161,7 @@ public:
}
for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr)
- if (Creature* summon = Unit::GetCreature(*me, *itr))
+ if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
AggroAllPlayers(summon);
}else if (uiLesserChampions == 9)
StartGrandChampionsAttack();
@@ -173,9 +173,9 @@ public:
void StartGrandChampionsAttack()
{
- Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID);
- Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID);
- Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID);
+ Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, uiVehicle1GUID);
+ Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, uiVehicle2GUID);
+ Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, uiVehicle3GUID);
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
@@ -417,7 +417,7 @@ public:
if (!Champion1List.empty())
{
for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr)
- if (Creature* summon = Unit::GetCreature(*me, *itr))
+ if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
AggroAllPlayers(summon);
NextStep(0, false);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
index 77e4e740333..6a664ec7f8d 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -344,7 +344,7 @@ class boss_anubarak_trial : public CreatureScript
uint32 at = urand(0, _burrowGUID.size()-1);
for (uint32 k = 0; k < at; k++)
++i;
- if (Creature* pBurrow = Unit::GetCreature(*me, *i))
+ if (Creature* pBurrow = ObjectAccessor::GetCreature(*me, *i))
pBurrow->CastSpell(pBurrow, 66340, false);
events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
@@ -377,7 +377,7 @@ class boss_anubarak_trial : public CreatureScript
uint8 i = startAt;
do
{
- if (Unit* pSphere = Unit::GetCreature(*me, _sphereGUID[i]))
+ if (Unit* pSphere = ObjectAccessor::GetCreature(*me, _sphereGUID[i]))
{
if (!pSphere->HasAura(SPELL_FROST_SPHERE))
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
index 71df7d05378..77697cdb3e8 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -479,7 +479,7 @@ class boss_toc_champion_controller : public CreatureScript
case 1:
for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i)
{
- if (Creature* temp = Unit::GetCreature(*me, *i))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, *i))
{
temp->SetReactState(REACT_AGGRESSIVE);
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
@@ -559,7 +559,7 @@ struct boss_faction_championsAI : public BossAI
void JustReachedHome() override
{
- if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, FAIL);
me->DespawnOrUnsummon();
}
@@ -577,7 +577,7 @@ struct boss_faction_championsAI : public BossAI
std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && me->getThreatManager().getThreat(unit))
{
if (unit->GetTypeId() == TYPEID_PLAYER)
@@ -609,7 +609,7 @@ struct boss_faction_championsAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
if (_aiType != AI_PET)
- if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, DONE);
}
@@ -617,7 +617,7 @@ struct boss_faction_championsAI : public BossAI
{
DoCast(me, SPELL_ANTI_AOE, true);
_EnterCombat();
- if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, IN_PROGRESS);
}
@@ -634,11 +634,11 @@ struct boss_faction_championsAI : public BossAI
if (TeamInInstance == ALLIANCE)
{
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
temp->AI()->Talk(SAY_KILL_PLAYER);
}
else
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
temp->AI()->Talk(SAY_KILL_PLAYER);
@@ -663,7 +663,7 @@ struct boss_faction_championsAI : public BossAI
Unit* target;
for (iter = tList.begin(); iter!=tList.end(); ++iter)
{
- target = Unit::GetUnit(*me, (*iter)->getUnitGuid());
+ target = ObjectAccessor::GetUnit(*me, (*iter)->getUnitGuid());
if (target && target->getPowerType() == POWER_MANA)
return target;
}
@@ -678,7 +678,7 @@ struct boss_faction_championsAI : public BossAI
Unit* target;
for (iter = tList.begin(); iter != tList.end(); ++iter)
{
- target = Unit::GetUnit(*me, (*iter)->getUnitGuid());
+ target = ObjectAccessor::GetUnit(*me, (*iter)->getUnitGuid());
if (target && me->GetDistance2d(target) < distance)
++count;
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
index abeafe156ad..c0f7b2f1856 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -553,7 +553,7 @@ class spell_mistress_kiss_area : public SpellScriptLoader
class spell_mistress_kiss_area_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_mistress_kiss_area_SpellScript)
+ PrepareSpellScript(spell_mistress_kiss_area_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index f45a57bd0bc..9e75bef9735 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -508,7 +508,7 @@ struct boss_jormungarAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
- if (Creature* otherWorm = Unit::GetCreature(*me, instance->GetData64(OtherWormEntry)))
+ if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherWormEntry)))
{
if (!otherWorm->IsAlive())
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index 00eb970b57b..e40cd9d5f41 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -245,7 +245,7 @@ struct boss_twin_baseAI : public BossAI
// Called when sister pointer needed
Creature* GetSister()
{
- return Unit::GetCreature((*me), instance->GetData64(SisterNpcId));
+ return ObjectAccessor::GetCreature((*me), instance->GetData64(SisterNpcId));
}
void EnterCombat(Unit* /*who*/) override
@@ -673,8 +673,7 @@ class spell_powering_up : public SpellScriptLoader
class spell_powering_up_SpellScript : public SpellScript
{
- public:
- PrepareSpellScript(spell_powering_up_SpellScript)
+ PrepareSpellScript(spell_powering_up_SpellScript);
uint32 spellId;
uint32 poweringUp;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index 64afe8d5b2e..7cab84ee4a7 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -95,7 +95,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
// make sure Anub'arak isnt missing and floor is destroyed after a crash
if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE)
{
- Creature* anubArak = Unit::GetCreature(*player, GetData64(NPC_ANUBARAK));
+ Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK));
if (!anubArak)
anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
index 74e4f4caa9d..11548ba4b1c 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -173,7 +173,7 @@ class npc_announcer_toc10 : public CreatureScript
else if (instance->GetBossState(BOSS_JARAXXUS) != DONE)
{
// if Jaraxxus is spawned, but the raid wiped
- if (Creature* jaraxxus = Unit::GetCreature(*player, instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_JARAXXUS)))
{
jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -207,7 +207,7 @@ class npc_announcer_toc10 : public CreatureScript
creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false);
creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false);
- Creature* anubArak = Unit::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK));
+ Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK));
if (!anubArak || !anubArak->IsAlive())
anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
@@ -330,7 +330,7 @@ class boss_lich_king_toc : public CreatureScript
me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false);
_instance->SetBossState(BOSS_LICH_KING, DONE);
- Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK));
+ Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK));
if (!temp || !temp->IsAlive())
temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
@@ -377,7 +377,7 @@ class npc_fizzlebang_toc : public CreatureScript
{
Talk(SAY_STAGE_1_06, killer);
_instance->SetData(TYPE_EVENT, 1180);
- if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
temp->SetReactState(REACT_AGGRESSIVE);
@@ -484,23 +484,23 @@ class npc_fizzlebang_toc : public CreatureScript
_updateTimer = 5*IN_MILLISECONDS;
break;
case 1142:
- if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
temp->SetTarget(me->GetGUID());
- if (Creature* pTrigger = Unit::GetCreature(*me, _triggerGUID))
+ if (Creature* pTrigger = ObjectAccessor::GetCreature(*me, _triggerGUID))
pTrigger->DespawnOrUnsummon();
- if (Creature* pPortal = Unit::GetCreature(*me, _portalGUID))
+ if (Creature* pPortal = ObjectAccessor::GetCreature(*me, _portalGUID))
pPortal->DespawnOrUnsummon();
_instance->SetData(TYPE_EVENT, 1144);
_updateTimer = 10*IN_MILLISECONDS;
break;
case 1144:
- if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
temp->AI()->Talk(SAY_STAGE_1_05);
_instance->SetData(TYPE_EVENT, 1150);
_updateTimer = 5*IN_MILLISECONDS;
break;
case 1150:
- if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
{
//1-shot Fizzlebang
temp->CastSpell(me, 67888, false);
@@ -699,7 +699,7 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 3092);
break;
case 3092:
- if (Creature* pChampionController = Unit::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(1, NOT_STARTED);
_instance->SetData(TYPE_EVENT, 3095);
break;
@@ -735,12 +735,12 @@ class npc_tirion_toc : public CreatureScript
break;
case 4015:
_instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
- if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE)))
+ if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ());
temp->SetVisible(true);
}
- if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_DARKBANE)))
+ if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_DARKBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ());
temp->SetVisible(true);
@@ -779,7 +779,7 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 6005);
break;
case 6005:
- if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
tirionFordring->AI()->Talk(SAY_STAGE_4_06);
_updateTimer = 20*IN_MILLISECONDS;
_instance->SetData(TYPE_EVENT, 6010);
@@ -787,7 +787,7 @@ class npc_tirion_toc : public CreatureScript
case 6010:
if (IsHeroic())
{
- if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
tirionFordring->AI()->Talk(SAY_STAGE_4_07);
_updateTimer = 1*MINUTE*IN_MILLISECONDS;
_instance->SetBossState(BOSS_ANUBARAK, SPECIAL);
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
index 562105c0866..8a62453d7c1 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
@@ -40,7 +40,7 @@ enum SpellIds
enum MiscData
{
- DESPAWN_TIME = 300000,
+ DESPAWN_TIME = 1200000,
DISPLAYID_DESTROYED_FLOOR = 9060
};
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index 72e4b0b5eb9..63b1359a406 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -314,7 +314,7 @@ public:
{
if (InstanceScript* instance = me->GetInstanceScript())
if (uint64 guid = instance->GetData64(DATA_NOVOS))
- if (Creature* novos = Creature::GetCreature(*me, guid))
+ if (Creature* novos = ObjectAccessor::GetCreature(*me, guid))
novos->AI()->JustSummoned(summon);
if (summon)
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
index 0c5514a1c0a..4303026ba64 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -1100,7 +1100,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
Talk(SAY_JAINA_ESCAPE_9);
if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP)))
gunship->EnableMovement(true);
- _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE);
+ _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE);
break;
case EVENT_ESCAPE_17:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -1139,7 +1139,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript
struct npc_the_lich_king_escape_horAI : public ScriptedAI
{
- npc_the_lich_king_escape_horAI(Creature* creature) : ScriptedAI(creature)
+ npc_the_lich_king_escape_horAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
_instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, NOT_STARTED);
@@ -1248,12 +1248,12 @@ class npc_the_lich_king_escape_hor : public CreatureScript
_events.ScheduleEvent(EVENT_ESCAPE_SUMMON_WITCH_DOCTOR, 66000);
_events.ScheduleEvent(EVENT_ESCAPE_SUMMON_LUMBERING_ABOMINATION, 14000);
Talk(SAY_LK_ESCAPE_ICEWALL_SUMMONED_4);
- break;
+ break;
default:
break;
}
}
-
+
void EnterEvadeMode() override
{
if (_despawn)
@@ -2021,12 +2021,12 @@ class at_hor_waves_restarter : public AreaTriggerScript
{
_instance->ProcessEvent(0, EVENT_SPAWN_WAVES);
- if (Creature* falric = player->GetCreature(*player, _instance->GetData64(DATA_FALRIC)))
+ if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_FALRIC)))
{
falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true);
falric->SetVisible(true);
}
- if (Creature* marwyn = player->GetCreature(*player, _instance->GetData64(DATA_MARWYN)))
+ if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_MARWYN)))
{
marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true);
marwyn->SetVisible(true);
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
index 9cbd296d69e..783f9e245c8 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -113,7 +113,7 @@ class boss_garfrost : public CreatureScript
Talk(SAY_DEATH);
me->RemoveAllGameObjects();
- if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS)))
+ if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TYRANNUS)))
tyrannus->AI()->Talk(SAY_TYRANNUS_DEATH);
}
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index 26ab1f61ae8..1c126bc54fd 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -362,7 +362,7 @@ class boss_krick : public CreatureScript
{
case EVENT_OUTRO_1:
{
- if (Creature* temp = me->GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1)))
temp->DespawnOrUnsummon();
Creature* jainaOrSylvanas = NULL;
@@ -410,7 +410,7 @@ class boss_krick : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_6, 1000);
break;
case EVENT_OUTRO_6:
- if (Creature* tyrannus = me->GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT)))
+ if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT)))
{
tyrannus->SetSpeed(MOVE_FLIGHT, 3.5f, true);
tyrannus->GetMotionMaster()->MovePoint(1, outroPos[4]);
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
index a501bf4ea55..c4f46136bd9 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -25,12 +25,12 @@
enum Yells
{
- //Gorkun
+ // Gorkun
SAY_GORKUN_INTRO_2 = 0,
SAY_GORKUN_OUTRO_1 = 1,
SAY_GORKUN_OUTRO_2 = 2,
- //Tyrannus
+ // Tyrannus
SAY_AMBUSH_1 = 3,
SAY_AMBUSH_2 = 4,
SAY_GAUNTLET_START = 5,
@@ -44,12 +44,12 @@ enum Yells
SAY_DARK_MIGHT_1 = 13,
SAY_DARK_MIGHT_2 = 14,
- //Jaina
+ // Jaina
SAY_JAYNA_OUTRO_3 = 3,
SAY_JAYNA_OUTRO_4 = 4,
SAY_JAYNA_OUTRO_5 = 5,
- //Sylvanas
+ // Sylvanas
SAY_SYLVANAS_OUTRO_3 = 3,
SAY_SYLVANAS_OUTRO_4 = 4
};
@@ -121,7 +121,7 @@ static const Position rimefangPos[10] =
{1012.601f, 142.4965f, 665.0453f, 0.000000f},
};
-static const Position miscPos = {1018.376f, 167.2495f, 628.2811f, 0.000000f}; //tyrannus combat start position
+static Position const miscPos = { 1018.376f, 167.2495f, 628.2811f, 0.000000f }; // tyrannus combat start position
class boss_tyrannus : public CreatureScript
{
@@ -235,7 +235,7 @@ class boss_tyrannus : public CreatureScript
me->GetMotionMaster()->MovePoint(0, miscPos);
break;
case EVENT_COMBAT_START:
- if (Creature* rimefang = me->GetCreature(*me, instance->GetData64(DATA_RIMEFANG)))
+ if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG)))
rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight
events.SetPhase(PHASE_COMBAT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -357,7 +357,7 @@ class boss_rimefang : public CreatureScript
_events.ScheduleEvent(EVENT_ICY_BLAST, 15000, 0, PHASE_COMBAT);
break;
case EVENT_HOARFROST:
- if (Unit* target = me->GetUnit(*me, _hoarfrostTargetGUID))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, _hoarfrostTargetGUID))
{
DoCast(target, SPELL_HOARFROST);
_hoarfrostTargetGUID = 0;
@@ -490,6 +490,43 @@ class spell_tyrannus_mark_of_rimefang : public SpellScriptLoader
}
};
+// 69232 - Icy Blast
+class spell_tyrannus_rimefang_icy_blast : public SpellScriptLoader
+{
+ public:
+ spell_tyrannus_rimefang_icy_blast() : SpellScriptLoader("spell_tyrannus_rimefang_icy_blast") { }
+
+ class spell_tyrannus_rimefang_icy_blast_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_tyrannus_rimefang_icy_blast_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AURA))
+ return false;
+ return true;
+ }
+
+ void HandleTriggerMissile(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ if (Position const* pos = GetHitDest())
+ if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 60000))
+ summon->CastSpell(summon, SPELL_ICY_BLAST_AURA, true);
+ }
+
+ void Register() override
+ {
+ OnEffectHit += SpellEffectFn(spell_tyrannus_rimefang_icy_blast_SpellScript::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_tyrannus_rimefang_icy_blast_SpellScript();
+ }
+};
+
class at_tyrannus_event_starter : public AreaTriggerScript
{
public:
@@ -518,5 +555,6 @@ void AddSC_boss_tyrannus()
new boss_rimefang();
new spell_tyrannus_overlord_brand();
new spell_tyrannus_mark_of_rimefang();
+ new spell_tyrannus_rimefang_icy_blast();
new at_tyrannus_event_starter();
}
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index f0affa66d0f..b02a319abdc 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -278,7 +278,7 @@ class boss_drakkari_elemental : public CreatureScript
if (killer == me)
return;
- if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
killer->Kill(colossus);
}
@@ -314,7 +314,7 @@ class boss_drakkari_elemental : public CreatureScript
{
case ACTION_RETURN_TO_COLOSSUS:
DoCast(SPELL_SURGE_VISUAL);
- if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
// what if the elemental is more than 80 yards from drakkari colossus ?
DoCast(colossus, SPELL_MERGE, true);
break;
@@ -325,7 +325,7 @@ class boss_drakkari_elemental : public CreatureScript
{
if (HealthBelowPct(50) && instance)
{
- if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
{
if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON)
{
@@ -423,7 +423,7 @@ public:
if (id == 1)
{
- if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
{
colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS);
if (!colossus->AI()->GetData(DATA_INTRO_DONE))
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index 9847d7191c6..4e45d72cadf 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -345,7 +345,7 @@ class npc_stinky_icc : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* festergut = me->GetCreature(*me, _instance->GetData64(DATA_FESTERGUT)))
+ if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT)))
if (festergut->IsAlive())
festergut->AI()->Talk(SAY_STINKY_DEAD);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index c408c486b30..3bf8fd8d305 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -372,7 +372,7 @@ class boss_professor_putricide : public CreatureScript
instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); // needed here for delayed gate close
me->SetSpeed(MOVE_RUN, _baseSpeed, true);
DoAction(ACTION_FESTERGUT_GAS);
- if (Creature* festergut = Unit::GetCreature(*me, instance->GetData64(DATA_FESTERGUT)))
+ if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FESTERGUT)))
festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, NULL, NULL, festergut->GetGUID());
break;
case POINT_ROTFACE:
@@ -442,7 +442,7 @@ class boss_professor_putricide : public CreatureScript
_oozeFloodStage = 0;
DoZoneInCombat(me);
// init random sequence of floods
- if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
{
std::list<Creature*> list;
GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f);
@@ -469,7 +469,7 @@ class boss_professor_putricide : public CreatureScript
}
case ACTION_ROTFACE_OOZE:
Talk(SAY_ROTFACE_OOZE_FLOOD);
- if (Creature* dummy = Unit::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage]))
+ if (Creature* dummy = ObjectAccessor::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage]))
dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], true, NULL, NULL, me->GetGUID()); // cast from self for LoS (with prof's GUID for logs)
if (++_oozeFloodStage == 4)
_oozeFloodStage = 0;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 8766781de7c..c1ee616218c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -126,7 +126,7 @@ class boss_rotface : public CreatureScript
me->setActive(true);
Talk(SAY_AGGRO);
- if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_ROTFACE_COMBAT);
DoZoneInCombat();
@@ -138,7 +138,7 @@ class boss_rotface : public CreatureScript
instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION);
_JustDied();
Talk(SAY_DEATH);
- if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_ROTFACE_DEATH);
}
@@ -158,7 +158,7 @@ class boss_rotface : public CreatureScript
void EnterEvadeMode() override
{
ScriptedAI::EnterEvadeMode();
- if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->EnterEvadeMode();
}
@@ -176,7 +176,7 @@ class boss_rotface : public CreatureScript
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() == NPC_VILE_GAS_STALKER)
- if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->CastSpell(summon, SPELL_VILE_GAS_H, true);
}
@@ -308,13 +308,13 @@ class npc_big_ooze : public CreatureScript
DoCast(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true);
events.ScheduleEvent(EVENT_STICKY_OOZE, 5000);
// register in Rotface's summons - not summoned with Rotface as owner
- if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
rotface->AI()->JustSummoned(me);
}
void JustDied(Unit* /*killer*/) override
{
- if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
rotface->AI()->SummonedCreatureDespawn(me);
me->DespawnOrUnsummon();
}
@@ -395,7 +395,7 @@ class npc_precious_icc : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_summons.DespawnAll();
- if (Creature* rotface = Unit::GetCreature(*me, _instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE)))
if (rotface->IsAlive())
rotface->AI()->Talk(SAY_PRECIOUS_DIES);
}
@@ -657,7 +657,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* rotface = Unit::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE)))
if (rotface->IsAlive())
{
rotface->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 0543b0274b5..77486c37498 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -138,10 +138,10 @@ public:
bool DoEncounteraction(Unit* who, bool attack, bool reset, bool checkAllDead)
{
- Creature* Thane = Unit::GetCreature(*me, instance->GetData64(DATA_THANE));
- Creature* Lady = Unit::GetCreature(*me, instance->GetData64(DATA_LADY));
- Creature* Baron = Unit::GetCreature(*me, instance->GetData64(DATA_BARON));
- Creature* Sir = Unit::GetCreature(*me, instance->GetData64(DATA_SIR));
+ Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THANE));
+ Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LADY));
+ Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BARON));
+ Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SIR));
if (Thane && Lady && Baron && Sir)
{
@@ -226,7 +226,7 @@ public:
movementCompleted = true;
me->SetReactState(REACT_AGGRESSIVE);
- Unit* eventStarter = Unit::GetUnit(*me, uiEventStarterGUID);
+ Unit* eventStarter = ObjectAccessor::GetUnit(*me, uiEventStarterGUID);
if (eventStarter && me->IsValidAttackTarget(eventStarter))
AttackStart(eventStarter);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 29e435e2127..d973ce867f2 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -257,25 +257,25 @@ class boss_gothik : public CreatureScript
{
case NPC_LIVE_TRAINEE:
{
- if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[0]))
+ if (Creature* liveTrigger = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[0]))
DoSummon(NPC_LIVE_TRAINEE, liveTrigger, 1);
- if (Creature* liveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1]))
+ if (Creature* liveTrigger1 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[1]))
DoSummon(NPC_LIVE_TRAINEE, liveTrigger1, 1);
- if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2]))
+ if (Creature* liveTrigger2 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[2]))
DoSummon(NPC_LIVE_TRAINEE, liveTrigger2, 1);
break;
}
case NPC_LIVE_KNIGHT:
{
- if (Creature* liveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3]))
+ if (Creature* liveTrigger3 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[3]))
DoSummon(NPC_LIVE_KNIGHT, liveTrigger3, 1);
- if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5]))
+ if (Creature* liveTrigger5 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[5]))
DoSummon(NPC_LIVE_KNIGHT, liveTrigger5, 1);
break;
}
case NPC_LIVE_RIDER:
{
- if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
+ if (Creature* liveTrigger4 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4]))
DoSummon(NPC_LIVE_RIDER, liveTrigger4, 1);
break;
}
@@ -287,21 +287,21 @@ class boss_gothik : public CreatureScript
{
case NPC_LIVE_TRAINEE:
{
- if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[4]))
+ if (Creature* liveTrigger = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4]))
DoSummon(NPC_LIVE_TRAINEE, liveTrigger, 1);
- if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
+ if (Creature* liveTrigger2 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4]))
DoSummon(NPC_LIVE_TRAINEE, liveTrigger2, 1);
break;
}
case NPC_LIVE_KNIGHT:
{
- if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
+ if (Creature* liveTrigger5 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4]))
DoSummon(NPC_LIVE_KNIGHT, liveTrigger5, 1);
break;
}
case NPC_LIVE_RIDER:
{
- if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
+ if (Creature* liveTrigger4 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4]))
DoSummon(NPC_LIVE_RIDER, liveTrigger4, 1);
break;
}
@@ -359,7 +359,7 @@ class boss_gothik : public CreatureScript
if (spellId && me->IsInCombat())
{
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST);
- if (Creature* pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD]))
+ if (Creature* pRandomDeadTrigger = ObjectAccessor::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD]))
me->CastSpell(pRandomDeadTrigger, spellId, true);
}
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 8b3ac64fb89..c5c70cf3957 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -368,38 +368,33 @@ public:
if (Phase == 1)
{
- while (uint32 eventId = events.GetEvent())
+ while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_WASTE:
DoSummon(NPC_WASTE, Pos[RAND(0, 3, 6, 9)]);
- events.RepeatEvent(urand(2000, 5000));
+ events.Repeat(2000, 5000);
break;
case EVENT_ABOMIN:
if (nAbomination < 8)
{
DoSummon(NPC_ABOMINATION, Pos[RAND(1, 4, 7, 10)]);
nAbomination++;
- events.RepeatEvent(20000);
+ events.Repeat(20000);
}
- else
- events.PopEvent();
break;
case EVENT_WEAVER:
if (nWeaver < 8)
{
DoSummon(NPC_WEAVER, Pos[RAND(0, 3, 6, 9)]);
nWeaver++;
- events.RepeatEvent(25000);
+ events.Repeat(25000);
}
- else
- events.PopEvent();
break;
case EVENT_TRIGGER:
if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER)))
trigger->SetPhaseMask(2, true);
- events.PopEvent();
break;
case EVENT_PHASE:
events.Reset();
@@ -419,7 +414,6 @@ public:
Phase = 2;
break;
default:
- events.PopEvent();
break;
}
}
@@ -461,17 +455,17 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- if (uint32 eventId = events.GetEvent())
+ if (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BOLT:
DoCastVictim(SPELL_FROST_BOLT);
- events.RepeatEvent(urand(5000, 10000));
+ events.Repeat(5000, 10000);
break;
case EVENT_NOVA:
DoCastAOE(SPELL_FROST_BOLT_AOE);
- events.RepeatEvent(urand(15000, 30000));
+ events.Repeat(15000, 30000);
break;
case EVENT_CHAIN:
{
@@ -490,7 +484,7 @@ public:
}
if (!chained.empty())
Talk(SAY_CHAIN);
- events.RepeatEvent(urand(100000, 180000));
+ events.Repeat(100000, 180000);
break;
}
case EVENT_CHAINED_SPELL:
@@ -565,10 +559,8 @@ public:
++itr;
}
- if (chained.empty())
- events.PopEvent();
- else
- events.RepeatEvent(5000);
+ if (!chained.empty())
+ events.Repeat(5000);
break;
}
@@ -596,23 +588,22 @@ public:
Talk(SAY_SPECIAL);
}
- events.RepeatEvent(urand(20000, 50000));
+ events.Repeat(20000, 50000);
break;
}
case EVENT_FISSURE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_SHADOW_FISURE);
- events.RepeatEvent(urand(10000, 45000));
+ events.Repeat(10000, 45000);
break;
case EVENT_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true))
DoCast(target, SPELL_FROST_BLAST);
if (rand()%2)
Talk(SAY_FROST_BLAST);
- events.RepeatEvent(urand(30000, 90000));
+ events.Repeat(30000, 90000);
break;
default:
- events.PopEvent();
break;
}
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index ce605987890..52723b591a2 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -169,14 +169,14 @@ public:
{
victimGUID = guid;
if (me->m_spells[0] && victimGUID)
- if (Unit* victim = Unit::GetUnit(*me, victimGUID))
+ if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID());
}
void JustDied(Unit* /*killer*/) override
{
if (me->m_spells[0] && victimGUID)
- if (Unit* victim = Unit::GetUnit(*me, victimGUID))
+ if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID());
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index 528b2fec348..406ca3963a4 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -123,11 +123,11 @@ public:
// Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn
// and each mob will send its status at reset (meaning that it is alive)
checkFeugenAlive = false;
- if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
checkFeugenAlive = pFeugen->IsAlive();
checkStalaggAlive = false;
- if (Creature* pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG)))
+ if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG)))
checkStalaggAlive = pStalagg->IsAlive();
if (!checkFeugenAlive && !checkStalaggAlive)
@@ -230,12 +230,12 @@ public:
{
if (!checkStalaggAlive)
{
- if (Creature* pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG)))
+ if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG)))
pStalagg->Respawn();
}
else
{
- if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
pFeugen->Respawn();
}
}
@@ -300,7 +300,7 @@ public:
void Reset() override
{
- if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_STALAGG_RESET);
powerSurgeTimer = urand(20000, 25000);
@@ -322,7 +322,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_STAL_DEATH);
- if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_STALAGG_DIED);
}
@@ -334,7 +334,7 @@ public:
if (magneticPullTimer <= uiDiff)
{
- if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
{
Unit* pStalaggVictim = me->GetVictim();
Unit* pFeugenVictim = pFeugen->GetVictim();
@@ -391,7 +391,7 @@ public:
void Reset() override
{
- if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET);
staticFieldTimer = 5000;
@@ -412,7 +412,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_FEUG_DEATH);
- if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED);
}
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 3f0fb2f93b1..fefdfa633ea 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -664,7 +664,7 @@ public:
Talk(SAY_BUFF_SPARK);
}
else if (spell->Id == SPELL_MALYGOS_BERSERK)
- sCreatureTextMgr->SendChat(me, EMOTE_HIT_BERSERKER_TIMER, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
+ TalkToMap(EMOTE_HIT_BERSERKER_TIMER);
}
void MoveInLineOfSight(Unit* who) override
@@ -1113,8 +1113,7 @@ public:
npc_power_sparkAI(Creature* creature) : ScriptedAI(creature)
{
_instance = creature->GetInstanceScript();
- // Talk range was not enough for this encounter
- sCreatureTextMgr->SendChat(me, EMOTE_POWER_SPARK_SUMMONED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
+ TalkToMap(EMOTE_POWER_SPARK_SUMMONED);
MoveToMalygos();
}
@@ -1810,7 +1809,7 @@ public:
class spell_malygos_vortex_dummy_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_malygos_vortex_dummy_SpellScript)
+ PrepareSpellScript(spell_malygos_vortex_dummy_SpellScript);
bool Load() override
{
@@ -2282,7 +2281,7 @@ class spell_malygos_surge_of_power_warning_selector_25 : public SpellScriptLoade
class spell_malygos_surge_of_power_warning_selector_25_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_malygos_surge_of_power_warning_selector_25_SpellScript)
+ PrepareSpellScript(spell_malygos_surge_of_power_warning_selector_25_SpellScript);
bool Load() override
{
@@ -2348,7 +2347,7 @@ class spell_malygos_surge_of_power_25 : public SpellScriptLoader
class spell_malygos_surge_of_power_25_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_malygos_surge_of_power_25_SpellScript)
+ PrepareSpellScript(spell_malygos_surge_of_power_25_SpellScript);
bool Load() override
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 0870614ba78..585da8e28d3 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -299,7 +299,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
class spell_varos_energize_core_area_enemySpellScript : public SpellScript
{
- PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript)
+ PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
@@ -343,7 +343,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
class spell_varos_energize_core_area_entrySpellScript : public SpellScript
{
- PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript)
+ PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 727060578c8..24d145f097f 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -164,7 +164,7 @@ public:
for (uint8 i = 0; i < 2; ++i)
{
- if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i])))
+ if (Creature* pStormforgedLieutenant = (ObjectAccessor::GetCreature((*me), m_auiStormforgedLieutenantGUID[i])))
{
if (!pStormforgedLieutenant->IsAlive())
pStormforgedLieutenant->Respawn();
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 880045b96ef..d0b8f75e711 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -164,7 +164,7 @@ public:
for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
{
- if (Creature* temp = Unit::GetCreature(*me, *itr))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
{
if (temp->IsAlive())
temp->DespawnOrUnsummon();
@@ -181,7 +181,7 @@ public:
for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
{
- if (Creature* temp = Unit::GetCreature(*me, *itr))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
{
// Only shatter brittle golems
if (temp->IsAlive() && temp->GetEntry() == NPC_BRITTLE_GOLEM)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index c81cd0b0b80..07cdfa3353c 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -15,14 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* Script Data Start
-SDName: Boss krystallus
-SDAuthor: LordVanMartin
-SD%Complete:
-SDComment:
-SDCategory:
-Script Data End */
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
@@ -30,17 +22,13 @@ Script Data End */
enum Spells
{
- SPELL_BOULDER_TOSS = 50843,
- H_SPELL_BOULDER_TOSS = 59742,
- SPELL_GROUND_SPIKE = 59750,
- SPELL_GROUND_SLAM = 50827,
- SPELL_SHATTER = 50810,
- H_SPELL_SHATTER = 61546,
- SPELL_SHATTER_EFFECT = 50811,
- H_SPELL_SHATTER_EFFECT = 61547,
- SPELL_STONED = 50812,
- SPELL_STOMP = 48131,
- H_SPELL_STOMP = 59744
+ SPELL_BOULDER_TOSS = 50843,
+ SPELL_GROUND_SPIKE = 59750,
+ SPELL_GROUND_SLAM = 50827,
+ SPELL_SHATTER = 50810,
+ SPELL_SHATTER_EFFECT = 50811,
+ SPELL_STONED = 50812,
+ SPELL_STOMP = 48131
};
enum Yells
@@ -51,133 +39,103 @@ enum Yells
SAY_SHATTER = 3
};
-class boss_krystallus : public CreatureScript
+enum Events
{
-public:
- boss_krystallus() : CreatureScript("boss_krystallus") { }
-
- struct boss_krystallusAI : public ScriptedAI
- {
- boss_krystallusAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- }
-
- uint32 uiBoulderTossTimer;
- uint32 uiGroundSpikeTimer;
- uint32 uiGroundSlamTimer;
- uint32 uiShatterTimer;
- uint32 uiStompTimer;
-
- bool bIsSlam;
-
- InstanceScript* instance;
-
- void Reset() override
- {
- bIsSlam = false;
-
- uiBoulderTossTimer = urand(3000, 9000);
- uiGroundSpikeTimer = urand(9000, 14000);
- uiGroundSlamTimer = urand(15000, 18000);
- uiStompTimer = urand(20000, 29000);
- uiShatterTimer = 0;
-
- instance->SetBossState(DATA_KRYSTALLUS, NOT_STARTED);
- }
- void EnterCombat(Unit* /*who*/) override
- {
- Talk(SAY_AGGRO);
+ EVENT_BOULDER_TOSS = 1,
+ EVENT_GROUND_SPIKE,
+ EVENT_GROUND_SLAM,
+ EVENT_STOMP,
+ EVENT_SHATTER
+};
- instance->SetBossState(DATA_KRYSTALLUS, IN_PROGRESS);
- }
+class boss_krystallus : public CreatureScript
+{
+ public:
+ boss_krystallus() : CreatureScript("boss_krystallus") { }
- void UpdateAI(uint32 diff) override
+ struct boss_krystallusAI : public BossAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ boss_krystallusAI(Creature* creature) : BossAI(creature, DATA_KRYSTALLUS) { }
- if (uiBoulderTossTimer <= diff)
+ void Reset() override
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_BOULDER_TOSS);
- uiBoulderTossTimer = urand(9000, 15000);
- } else uiBoulderTossTimer -= diff;
-
- if (uiGroundSpikeTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_GROUND_SPIKE);
- uiGroundSpikeTimer = urand(12000, 17000);
- } else uiGroundSpikeTimer -= diff;
-
- if (uiStompTimer <= diff)
- {
- DoCast(me, SPELL_STOMP);
- uiStompTimer = urand(20000, 29000);
- } else uiStompTimer -= diff;
-
- if (uiGroundSlamTimer <= diff)
- {
- DoCast(me, SPELL_GROUND_SLAM);
- bIsSlam = true;
- uiShatterTimer = 10000;
- uiGroundSlamTimer = urand(15000, 18000);
- } else uiGroundSlamTimer -= diff;
+ _Reset();
+ }
- if (bIsSlam)
+ void EnterCombat(Unit* /*who*/) override
{
- if (uiShatterTimer <= diff)
- {
- DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER));
- } else uiShatterTimer -= diff;
+ Talk(SAY_AGGRO);
+ _EnterCombat();
+
+ events.ScheduleEvent(EVENT_BOULDER_TOSS, urand(3000, 9000));
+ events.ScheduleEvent(EVENT_GROUND_SLAM, urand(15000, 18000));
+ events.ScheduleEvent(EVENT_STOMP, urand(20000, 29000));
+ if (IsHeroic())
+ events.ScheduleEvent(EVENT_GROUND_SPIKE, urand(9000, 14000));
}
- DoMeleeAttackIfReady();
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- Talk(SAY_DEATH);
-
- instance->SetBossState(DATA_KRYSTALLUS, DONE);
- }
+ void UpdateAI(uint32 diff) override
+ {
+ // Return since we have no target
+ if (!UpdateVictim())
+ return;
- void KilledUnit(Unit* victim) override
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
+ events.Update(diff);
- Talk(SAY_KILL);
- }
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell) override
- {
- //this part should be in the core
- if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER)
- {
- /// @todo we need eventmap to kill this stuff
- //clear this, if we are still performing
- if (bIsSlam)
+ while (uint32 eventId = events.ExecuteEvent())
{
- bIsSlam = false;
-
- //and correct movement, if not already
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE)
+ switch (eventId)
{
- if (me->GetVictim())
- me->GetMotionMaster()->MoveChase(me->GetVictim());
+ case EVENT_BOULDER_TOSS:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
+ DoCast(target, SPELL_BOULDER_TOSS);
+ events.ScheduleEvent(EVENT_BOULDER_TOSS, urand(9000, 15000));
+ break;
+ case EVENT_GROUND_SPIKE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_GROUND_SPIKE);
+ events.ScheduleEvent(EVENT_GROUND_SPIKE, urand(12000, 17000));
+ break;
+ case EVENT_GROUND_SLAM:
+ DoCast(me, SPELL_GROUND_SLAM);
+ events.ScheduleEvent(EVENT_SHATTER, 10000);
+ events.ScheduleEvent(EVENT_GROUND_SLAM, urand(15000, 18000));
+ break;
+ case EVENT_STOMP:
+ DoCast(me, SPELL_STOMP);
+ events.ScheduleEvent(EVENT_STOMP, urand(20000, 29000));
+ break;
+ case EVENT_SHATTER:
+ DoCast(me, SPELL_SHATTER);
+ break;
+ default:
+ break;
}
}
+
+ DoMeleeAttackIfReady();
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ Talk(SAY_DEATH);
+ _JustDied();
}
- }
- };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetHallsOfStoneAI<boss_krystallusAI>(creature);
- }
+ void KilledUnit(Unit* victim) override
+ {
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_KILL);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetHallsOfStoneAI<boss_krystallusAI>(creature);
+ }
};
class spell_krystallus_shatter : public SpellScriptLoader
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index f666f5d5874..cedf06a3154 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -211,7 +211,7 @@ public:
if (!KaddrakGUIDList.empty())
for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr)
{
- if (Creature* pKaddrak = Unit::GetCreature(*me, *itr))
+ if (Creature* pKaddrak = ObjectAccessor::GetCreature(*me, *itr))
{
if (pKaddrak->IsAlive())
pKaddrak->CastSpell(target, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true);
@@ -331,7 +331,7 @@ public:
return;
for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr)
{
- Creature* temp = Unit::GetCreature(*me, instance ? (*itr) : 0);
+ Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : 0);
if (temp && temp->IsAlive())
temp->DespawnOrUnsummon();
}
@@ -446,7 +446,7 @@ public:
JumpToNextStep(0);
break;
case 5:
- if (Creature* temp = (Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))))
+ if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))))
temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED);
JumpToNextStep(8500);
break;
@@ -455,14 +455,14 @@ public:
JumpToNextStep(6500);
break;
case 7:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_A_2_KADD);
JumpToNextStep(12500);
break;
case 8:
Talk(SAY_EVENT_A_3);
instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true);
- if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true;
JumpToNextStep(5000);
break;
@@ -476,7 +476,7 @@ public:
JumpToNextStep(6000);
break;
case 11:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_B_2_MARN);
SpawnDwarf(1);
JumpToNextStep(20000);
@@ -484,7 +484,7 @@ public:
case 12:
Talk(SAY_EVENT_B_3);
instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true);
- if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true;
JumpToNextStep(10000);
break;
@@ -506,7 +506,7 @@ public:
JumpToNextStep(20000);
break;
case 17:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_C_2_ABED);
SpawnDwarf(1);
JumpToNextStep(20000);
@@ -514,7 +514,7 @@ public:
case 18:
Talk(SAY_EVENT_C_3);
instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true);
- if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true;
JumpToNextStep(5000);
break;
@@ -532,7 +532,7 @@ public:
JumpToNextStep(20000);
break;
case 22:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_D_2_ABED);
SpawnDwarf(1);
JumpToNextStep(5000);
@@ -555,7 +555,7 @@ public:
JumpToNextStep(10000);
break;
case 27:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_D_4_ABED);
SpawnDwarf(1);
JumpToNextStep(10000);
@@ -565,7 +565,7 @@ public:
Talk(SAY_EVENT_END_01);
me->SetStandState(UNIT_STAND_STATE_STAND);
instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true);
- if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
bIsBattle = true;
SetEscortPaused(false);
@@ -578,7 +578,7 @@ public:
JumpToNextStep(5500);
break;
case 30:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_03_ABED);
JumpToNextStep(8500);
break;
@@ -587,7 +587,7 @@ public:
JumpToNextStep(11500);
break;
case 32:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_05_ABED);
JumpToNextStep(11500);
break;
@@ -596,7 +596,7 @@ public:
JumpToNextStep(4500);
break;
case 34:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_07_ABED);
JumpToNextStep(22500);
break;
@@ -605,7 +605,7 @@ public:
JumpToNextStep(7500);
break;
case 36:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_09_KADD);
JumpToNextStep(18500);
break;
@@ -614,7 +614,7 @@ public:
JumpToNextStep(5500);
break;
case 38:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_11_KADD);
JumpToNextStep(20500);
break;
@@ -623,7 +623,7 @@ public:
JumpToNextStep(2500);
break;
case 40:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_13_KADD);
JumpToNextStep(19500);
break;
@@ -632,7 +632,7 @@ public:
JumpToNextStep(10500);
break;
case 42:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_15_MARN);
JumpToNextStep(6500);
break;
@@ -641,7 +641,7 @@ public:
JumpToNextStep(6500);
break;
case 44:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_17_MARN);
JumpToNextStep(25500);
break;
@@ -650,7 +650,7 @@ public:
JumpToNextStep(23500);
break;
case 46:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_19_MARN);
JumpToNextStep(3500);
break;
@@ -659,7 +659,7 @@ public:
JumpToNextStep(8500);
break;
case 48:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_21_ABED);
JumpToNextStep(5500);
break;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 58df31a4471..011d1844adf 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -332,7 +332,7 @@ class boss_saronite_animus : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Vezax = me->GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
+ if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
Vezax->AI()->DoAction(ACTION_ANIMUS_DIE);
}
@@ -427,7 +427,7 @@ class npc_saronite_vapors : public CreatureScript
DoCast(me, SPELL_SARONITE_VAPORS);
me->DespawnOrUnsummon(30000);
- if (Creature* Vezax = me->GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
+ if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
Vezax->AI()->DoAction(ACTION_VAPORS_DIE);
}
}
@@ -494,13 +494,13 @@ class spell_general_vezax_mark_of_the_faceless_leech : public SpellScriptLoader
FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
}
- void Register()
+ void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_general_vezax_mark_of_the_faceless_leech_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
- SpellScript* GetSpellScript() const
+ SpellScript* GetSpellScript() const override
{
return new spell_general_vezax_mark_of_the_faceless_leech_SpellScript();
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index ef9bd9a8b12..6be3586de28 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -399,7 +399,7 @@ class npc_scorch_ground : public CreatureScript
{
if (_heatTimer <= uiDiff)
{
- Creature* construct = me->GetCreature(*me, _constructGUID);
+ Creature* construct = ObjectAccessor::GetCreature(*me, _constructGUID);
if (construct && !construct->HasAura(SPELL_MOLTEN))
{
me->AddAura(SPELL_HEAT, construct);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index e77350e2710..58969fd63c8 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -234,7 +234,7 @@ class boss_kologarn : public CreatureScript
// Victim gets 67351
if (eyebeamTarget)
{
- if (Unit* target = Unit::GetUnit(*summon, eyebeamTarget))
+ if (Unit* target = ObjectAccessor::GetUnit(*summon, eyebeamTarget))
{
summon->Attack(target, false);
summon->GetMotionMaster()->MoveChase(target);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index cfa5429ea79..f284aacf996 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -89,7 +89,7 @@ class spell_ulduar_proximity_mines : public SpellScriptLoader
class spell_ulduar_proximity_minesSpellScript : public SpellScript
{
- PrepareSpellScript(spell_ulduar_proximity_minesSpellScript)
+ PrepareSpellScript(spell_ulduar_proximity_minesSpellScript);
void HandleScript(SpellEffIndex effIndex)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index c57c3b33d01..87192f39a5c 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -457,7 +457,7 @@ class npc_xt002_heart : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* xt002 = _instance ? me->GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL;
+ Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL;
if (!xt002 || !xt002->AI())
return;
@@ -503,7 +503,7 @@ class npc_scrapbot : public CreatureScript
_rangeCheckTimer = 500;
- if (Creature* pXT002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f);
}
@@ -511,7 +511,7 @@ class npc_scrapbot : public CreatureScript
{
if (_rangeCheckTimer <= diff)
{
- if (Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
{
if (me->IsWithinMeleeRange(xt002))
{
@@ -560,7 +560,7 @@ class npc_pummeller : public CreatureScript
_trampleTimer = TIMER_TRAMPLE;
_uppercutTimer = TIMER_UPPERCUT;
- if (Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
{
Position pos = xt002->GetPosition();
me->GetMotionMaster()->MovePoint(0, pos);
@@ -668,7 +668,7 @@ class npc_boombot : public CreatureScript
me->SetFloatValue(UNIT_FIELD_MAXDAMAGE, 18000.0f);
/// @todo proper waypoints?
- if (Creature* pXT002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 4a5c0291ce0..41dd1a165f2 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -206,7 +206,7 @@ public:
Summons.DespawnAll();
me->SetSpeed(MOVE_FLIGHT, 3.0f);
- if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted())
+ if ((ObjectAccessor::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted())
me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
instance->SetBossState(DATA_SKADI_THE_RUTHLESS, NOT_STARTED);
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
@@ -217,7 +217,7 @@ public:
me->SetCanFly(false);
me->Dismount();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
- if (!Unit::GetCreature(*me, m_uiGraufGUID))
+ if (!ObjectAccessor::GetCreature(*me, m_uiGraufGUID))
me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
}
@@ -469,7 +469,7 @@ public:
if (!instance)
return false;
- if (Creature* pSkadi = Unit::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS)))
+ if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS)))
player->CastSpell(pSkadi, SPELL_RAPID_FIRE, true);
return false;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index a33d02fb083..de4d6c32c97 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -369,7 +369,7 @@ public:
void DespawnBoatGhosts(uint64& m_uiCreatureGUID)
{
if (m_uiCreatureGUID)
- if (Creature* temp = Unit::GetCreature(*me, m_uiCreatureGUID))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, m_uiCreatureGUID))
temp->DisappearAndDie();
m_uiCreatureGUID = 0;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 205030947d1..ea5c5b9ee48 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -103,7 +103,7 @@ class boss_emalon : public CreatureScript
{
for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
- Creature* minion = Unit::GetCreature(*me, *itr);
+ Creature* minion = ObjectAccessor::GetCreature(*me, *itr);
if (minion && minion->IsAlive() && !minion->GetVictim() && minion->AI())
minion->AI()->AttackStart(who);
}
@@ -143,7 +143,7 @@ class boss_emalon : public CreatureScript
case EVENT_OVERCHARGE:
if (!summons.empty())
{
- Creature* minion = Unit::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons));
+ Creature* minion = ObjectAccessor::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons));
if (minion && minion->IsAlive())
{
minion->CastSpell(me, SPELL_OVERCHARGED, true);
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index 5cbd4cafffb..4aede5e5f46 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -242,7 +242,7 @@ public:
if (!m_waterElements.empty())
{
for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
- if (Creature* temp = Unit::GetCreature(*me, *itr))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
if (temp->IsAlive())
{
bIsWaterElementsAlive = true;
@@ -362,7 +362,7 @@ public:
{
if (uiRangeCheck_Timer < uiDiff)
{
- if (Creature* pIchoron = Unit::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
+ if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
{
if (me->IsWithinDist(pIchoron, 2.0f, false))
{
@@ -379,7 +379,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
DoCast(me, SPELL_SPLASH);
- if (Creature* pIchoron = Unit::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
+ if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
if (pIchoron->AI())
pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED);
}
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index de08022b5ed..2bac444a558 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -254,7 +254,7 @@ public:
if (uiRangeCheck_Timer < uiDiff)
{
- if (Creature* pXevozz = Unit::GetCreature(*me, instance->GetData64(DATA_XEVOZZ)))
+ if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XEVOZZ)))
{
float fDistance = me->GetDistance2d(pXevozz);
if (fDistance <= 3)
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index a4f142e1c89..b623d5e6ddc 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -535,7 +535,7 @@ public:
{
me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false);
me->DisappearAndDie();
- Creature* pSaboPort = Unit::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL));
+ Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL));
if (pSaboPort)
pSaboPort->DisappearAndDie();
instance->SetData(DATA_START_BOSS_ENCOUNTER, 1);
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index c226edf28b8..38d73e0673d 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -1071,8 +1071,8 @@ public:
if (phaseTimer <= diff)
{
- Creature* talbot = me->GetCreature(*me, talbotGUID);
- Creature* arthas = me->GetCreature(*me, arthasGUID);
+ Creature* talbot = ObjectAccessor::GetCreature(*me, talbotGUID);
+ Creature* arthas = ObjectAccessor::GetCreature(*me, arthasGUID);
switch (phase)
{
case 1:
@@ -1209,9 +1209,9 @@ public:
break;
case 17:
- if (Creature* leryssa = me->GetCreature(*me, leryssaGUID))
+ if (Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID))
leryssa->RemoveFromWorld();
- if (Creature* arlos= me->GetCreature(*me, arlosGUID))
+ if (Creature* arlos= ObjectAccessor::GetCreature(*me, arlosGUID))
arlos->RemoveFromWorld();
if (talbot)
talbot->RemoveFromWorld();
@@ -1230,16 +1230,16 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* talbot = me->GetCreature(*me, talbotGUID))
+ if (Creature* talbot = ObjectAccessor::GetCreature(*me, talbotGUID))
talbot->RemoveFromWorld();
- if (Creature* leryssa = me->GetCreature(*me, leryssaGUID))
+ if (Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID))
leryssa->RemoveFromWorld();
- if (Creature* arlos = me->GetCreature(*me, arlosGUID))
+ if (Creature* arlos = ObjectAccessor::GetCreature(*me, arlosGUID))
arlos->RemoveFromWorld();
- if (Creature* arthas = me->GetCreature(*me, arthasGUID))
+ if (Creature* arthas = ObjectAccessor::GetCreature(*me, arthasGUID))
arthas->RemoveFromWorld();
}
};
@@ -1433,8 +1433,8 @@ public:
if (!leryssaGUID || !arlosGUID)
return;
- Creature* leryssa = Unit::GetCreature(*me, leryssaGUID);
- Creature* arlos = Unit::GetCreature(*me, arlosGUID);
+ Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID);
+ Creature* arlos = ObjectAccessor::GetCreature(*me, arlosGUID);
if (!leryssa || !arlos)
return;
diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
index a5ff2271316..e4bd9c469fb 100644
--- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
@@ -97,7 +97,7 @@ public:
}
- if (Creature* pOrb = me->GetCreature(*me, targetGUID))
+ if (Creature* pOrb = ObjectAccessor::GetCreature(*me, targetGUID))
DoCast(pOrb, SPELL_TRANSITUS_SHIELD_BEAM);
}
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index e98d424abd5..d0fd948ce6a 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -85,18 +85,18 @@ public:
_mrfloppyGUID = Mrfloppy->GetGUID();
break;
case 10:
- if (Unit::GetCreature(*me, _mrfloppyGUID))
+ if (ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
Talk(SAY_WORGHAGGRO1);
me->SummonCreature(NPC_HUNGRY_WORG, me->GetPositionX()+5, me->GetPositionY()+2, me->GetPositionZ()+1, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
}
break;
case 11:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break;
case 17:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
Talk(SAY_WORGRAGGRO3);
if (Creature* RWORG = me->SummonCreature(NPC_RAVENOUS_WORG, me->GetPositionX()+10, me->GetPositionY()+8, me->GetPositionZ()+2, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000))
@@ -106,31 +106,31 @@ public:
}
break;
case 18:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
- if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
+ if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
DoCast(Mrfloppy, SPELL_MRFLOPPY);
}
break;
case 19:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
{
- if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
+ if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
Mrfloppy->EnterVehicle(RWORG);
}
}
break;
case 20:
- if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
+ if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
RWORG->HandleEmoteCommand(34);
break;
case 21:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
- if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
+ if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
{
RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle();
@@ -141,11 +141,11 @@ public:
}
break;
case 22:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
if (Mrfloppy->isDead())
{
- if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
+ if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
RWORG->DisappearAndDie();
me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE);
@@ -167,7 +167,7 @@ public:
break;
case 27:
me->DisappearAndDie();
- if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
+ if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->DisappearAndDie();
break;
}
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index 93e1f19b195..32b9805470e 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -595,14 +595,14 @@ public:
break;
case EVENT_INTRO_1:
{
- if (Creature* Dalfors = me->GetCreature(*me, guidDalfors))
+ if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
Dalfors->AI()->Talk(DALFORS_SAY_PRE_1);
events.ScheduleEvent(EVENT_INTRO_2, 5000);
}
break;
case EVENT_INTRO_2:
{
- if (Creature* Dalfors = me->GetCreature(*me, guidDalfors))
+ if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
{
Dalfors->SetFacingTo(6.215f);
Dalfors->AI()->Talk(DALFORS_SAY_PRE_2);
@@ -612,37 +612,37 @@ public:
break;
case EVENT_INTRO_3:
{
- if (Creature* Dalfors = me->GetCreature(*me, guidDalfors))
+ if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
{
Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[2]);
Dalfors->SetHomePosition(DalforsPos[2]);
}
- if (Creature* Priest1 = me->GetCreature(*me, guidPriest[0]))
+ if (Creature* Priest1 = ObjectAccessor::GetCreature(*me, guidPriest[0]))
{
Priest1->SetFacingTo(5.7421f);
Priest1->SetHomePosition(Priest1Pos[1]);
}
- if (Creature* Priest2 = me->GetCreature(*me, guidPriest[1]))
+ if (Creature* Priest2 = ObjectAccessor::GetCreature(*me, guidPriest[1]))
{
Priest2->SetFacingTo(5.7421f);
Priest2->SetHomePosition(Priest2Pos[1]);
}
- if (Creature* Priest3 = me->GetCreature(*me, guidPriest[2]))
+ if (Creature* Priest3 = ObjectAccessor::GetCreature(*me, guidPriest[2]))
{
Priest3->SetFacingTo(5.7421f);
Priest3->SetHomePosition(Priest3Pos[1]);
}
- if (Creature* Mason1 = me->GetCreature(*me, guidMason[0]))
+ if (Creature* Mason1 = ObjectAccessor::GetCreature(*me, guidMason[0]))
{
Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[2]);
Mason1->SetHomePosition(Mason1Pos[2]);
}
- if (Creature* Mason2 = me->GetCreature(*me, guidMason[1]))
+ if (Creature* Mason2 = ObjectAccessor::GetCreature(*me, guidMason[1]))
{
Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[2]);
Mason2->SetHomePosition(Mason2Pos[2]);
}
- if (Creature* Mason3 = me->GetCreature(*me, guidMason[2]))
+ if (Creature* Mason3 = ObjectAccessor::GetCreature(*me, guidMason[2]))
{
Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[2]);
Mason3->SetHomePosition(Mason3Pos[2]);
@@ -653,17 +653,17 @@ public:
break;
case EVENT_MASON_ACTION:
{
- if (Creature* Mason1 = me->GetCreature(*me, guidMason[0]))
+ if (Creature* Mason1 = ObjectAccessor::GetCreature(*me, guidMason[0]))
{
Mason1->SetFacingTo(2.8972f);
Mason1->AI()->SetData(1, 1); // triggers SAI actions on npc
}
- if (Creature* Mason2 = me->GetCreature(*me, guidMason[1]))
+ if (Creature* Mason2 = ObjectAccessor::GetCreature(*me, guidMason[1]))
{
Mason2->SetFacingTo(3.1241f);
Mason2->AI()->SetData(1, 1); // triggers SAI actions on npc
}
- if (Creature* Mason3 = me->GetCreature(*me, guidMason[2]))
+ if (Creature* Mason3 = ObjectAccessor::GetCreature(*me, guidMason[2]))
{
Mason3->SetFacingTo(3.6651f);
Mason3->AI()->SetData(1, 1); // triggers SAI actions on npc
@@ -674,7 +674,7 @@ public:
{
if (Creature* LK = GetClosestCreatureWithEntry(me, NPC_LK, 100))
LK->AI()->Talk(LK_TALK_1);
- if (Creature* Dalfors = me->GetCreature(*me, guidDalfors))
+ if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
Dalfors->AI()->Talk(DALFORS_SAY_START);
events.ScheduleEvent(EVENT_WAVE_SPAWN, 1000);
}
@@ -763,7 +763,7 @@ public:
}
if (PhaseCount == 8)
- if (Creature* Halof = me->GetCreature(*me, guidHalof))
+ if (Creature* Halof = ObjectAccessor::GetCreature(*me, guidHalof))
if (Halof->isDead())
{
DoCast(me, SPELL_CRUSADERS_SPIRE_VICTORY, true);
@@ -771,7 +771,7 @@ public:
Summons.DespawnEntry(NPC_REANIMATED_CAPTAIN);
Summons.DespawnEntry(NPC_SCOURGE_DRUDGE);
Summons.DespawnEntry(NPC_HALOF_THE_DEATHBRINGER);
- if (Creature* Dalfors = me->GetCreature(*me, guidDalfors))
+ if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
Dalfors->AI()->Talk(DALFORS_YELL_FINISHED);
events.ScheduleEvent(EVENT_ENDED, 10000);
}
@@ -963,35 +963,35 @@ class npc_margrave_dhakar : public CreatureScript
}
case EVENT_LK_SAY_1:
{
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_1);
_events.ScheduleEvent(EVENT_LK_SAY_2, 5000);
break;
}
case EVENT_LK_SAY_2:
{
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_2);
_events.ScheduleEvent(EVENT_LK_SAY_3, 5000);
break;
}
case EVENT_LK_SAY_3:
{
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_3);
_events.ScheduleEvent(EVENT_LK_SAY_4, 5000);
break;
}
case EVENT_LK_SAY_4:
{
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_4);
_events.ScheduleEvent(EVENT_OUTRO, 12000);
break;
}
case EVENT_LK_SAY_5:
{
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_5);
_events.ScheduleEvent(EVENT_OUTRO, 8000);
break;
@@ -1001,7 +1001,7 @@ class npc_margrave_dhakar : public CreatureScript
if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true))
olakin->AI()->Talk(SAY_OLAKIN_PAY);
- if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid))
lichKing->DespawnOrUnsummon(0);
_events.ScheduleEvent(EVENT_START, 5000);
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 78b9a99b2e4..cf8c4cd9b36 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -91,7 +91,7 @@ public:
{
if (caster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE)
{
- if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID))
+ if (Creature* rageclaw = ObjectAccessor::GetCreature(*me, _rageclawGUID))
{
UnlockRageclaw(caster, rageclaw);
caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID);
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
index 9ab35aa188b..ea877435acf 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -223,7 +223,7 @@ public:
summoned->SetDisplayId(soulmodel);
summoned->setFaction(me->getFaction());
- if (Unit* target = Unit::GetUnit(*me, soulholder))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, soulholder))
{
CAST_AI(npc_stolen_soul::npc_stolen_soulAI, summoned->AI())->SetMyClass(soulclass);
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
index bd65cd9fc89..26e9df6620c 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
@@ -92,7 +92,7 @@ public:
summoned->SetLevel(me->getLevel());
summoned->AddUnitState(UNIT_STATE_ROOT);
- if (Unit* pFocusedTarget = Unit::GetUnit(*me, FocusedTargetGUID))
+ if (Unit* pFocusedTarget = ObjectAccessor::GetUnit(*me, FocusedTargetGUID))
summoned->AI()->AttackStart(pFocusedTarget);
}
}
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index 427265e2562..5edae14d47a 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -155,11 +155,11 @@ public:
case EVENT_SET_CHANNELERS:
{
for (std::list<uint64>::const_iterator itr = bloodmage.begin(); itr != bloodmage.end(); ++itr)
- if (Creature* bloodmage = (Unit::GetCreature(*me, *itr)))
+ if (Creature* bloodmage = (ObjectAccessor::GetCreature(*me, *itr)))
bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
for (std::list<uint64>::const_iterator itr = deathshaper.begin(); itr != deathshaper.end(); ++itr)
- if (Creature* deathshaper = (Unit::GetCreature(*me, *itr)))
+ if (Creature* deathshaper = (ObjectAccessor::GetCreature(*me, *itr)))
deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
index 1f8c090230b..0004df68016 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
@@ -150,7 +150,7 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container
{
- Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
//only on alive players
if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
targets.push_back(target);
@@ -184,7 +184,7 @@ public:
void RevertThreatOnTarget(uint64 guid)
{
- if (Unit* unit = Unit::GetUnit(*me, guid))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, guid))
{
if (DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index f0498d8a5c2..b1c3d607396 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -596,9 +596,9 @@ public:
if (Conversation[count].creature == ILLIDAN_STORMRAGE)
creature = me;
else if (Conversation[count].creature == AKAMA)
- creature = (Unit::GetCreature((*me), AkamaGUID));
+ creature = (ObjectAccessor::GetCreature((*me), AkamaGUID));
else if (Conversation[count].creature == MAIEV_SHADOWSONG)
- creature = (Unit::GetCreature((*me), MaievGUID));
+ creature = (ObjectAccessor::GetCreature((*me), MaievGUID));
if (creature)
{
@@ -831,7 +831,7 @@ public:
{
if (GlaiveGUID[i])
{
- Unit* Glaive = Unit::GetUnit(*me, GlaiveGUID[i]);
+ Unit* Glaive = ObjectAccessor::GetUnit(*me, GlaiveGUID[i]);
if (Glaive)
{
Glaive->CastSpell(me, SPELL_GLAIVE_RETURNS, false); // Make it look like the Glaive flies back up to us
@@ -1437,7 +1437,7 @@ public:
std::vector<Unit*> eliteList;
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(unit);
}
@@ -1588,9 +1588,9 @@ public:
Unit* Spirit[2] = { NULL, NULL };
if (ChannelCount <= 5)
{
- Channel = Unit::GetUnit(*me, ChannelGUID);
- Spirit[0] = Unit::GetUnit(*me, SpiritGUID[0]);
- Spirit[1] = Unit::GetUnit(*me, SpiritGUID[1]);
+ Channel = ObjectAccessor::GetUnit(*me, ChannelGUID);
+ Spirit[0] = ObjectAccessor::GetUnit(*me, SpiritGUID[0]);
+ Spirit[1] = ObjectAccessor::GetUnit(*me, SpiritGUID[1]);
if (!Channel || !Spirit[0] || !Spirit[1])
return;
}
@@ -2007,7 +2007,7 @@ public:
// if (IllidanGUID && !SummonedBeams)
// {
- // if (Unit* Illidan = Unit::GetUnit(*me, IllidanGUID)
+ // if (Unit* Illidan = ObjectAccessor::GetUnit(*me, IllidanGUID)
// {
// /// @todo Find proper spells and properly apply 'caged' Illidan effect
// }
@@ -2068,7 +2068,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Unit* target = Unit::GetUnit(*me, TargetGUID))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID))
target->RemoveAurasDueToSpell(SPELL_PARALYZE);
}
@@ -2157,7 +2157,7 @@ public:
if (!me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND)
&& !me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2))
{
- if (Creature* illidan = Unit::GetCreature((*me), IllidanGUID))// summon only in 1. phase
+ if (Creature* illidan = ObjectAccessor::GetCreature((*me), IllidanGUID))// summon only in 1. phase
if (CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL)
me->CastSpell(me->GetVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); // do not stack
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index ac91c2ac034..db3fcea35db 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -245,7 +245,7 @@ public:
{
if (TargetGUID[i])
{
- if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i]))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index 39edb6b04aa..9b304c3cd7b 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -229,7 +229,7 @@ public:
ThreatContainer::StorageType threatlist = target->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
{
DoModifyThreatPercent(unit, -100);
@@ -258,7 +258,7 @@ public:
Creature* Essence = NULL;
if (EssenceGUID)
{
- Essence = Unit::GetCreature(*me, EssenceGUID);
+ Essence = ObjectAccessor::GetCreature(*me, EssenceGUID);
if (!Essence)
{
EnterEvadeMode();
@@ -378,7 +378,7 @@ public:
void npc_enslaved_soul::npc_enslaved_soulAI::JustDied(Unit* /*killer*/)
{
if (ReliquaryGUID)
- if (Creature* Reliquary = (Unit::GetCreature((*me), ReliquaryGUID)))
+ if (Creature* Reliquary = (ObjectAccessor::GetCreature((*me), ReliquaryGUID)))
++(CAST_AI(boss_reliquary_of_souls::boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount);
DoCast(me, SPELL_SOUL_RELEASE, true);
@@ -454,7 +454,7 @@ public:
ThreatContainer::StorageType::const_iterator itr = threatlist.begin();
for (; itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->IsAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
targets.push_back(unit);
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index 8e5eb5ca888..b59d073c17d 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -777,7 +777,7 @@ public:
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid)))
+ if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid)))
CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me);
}
@@ -883,7 +883,7 @@ public:
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid)))
+ if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid)))
CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me);
}
@@ -973,7 +973,7 @@ public:
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid)))
+ if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid)))
CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me);
}
@@ -1053,7 +1053,7 @@ public:
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid)))
+ if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid)))
CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me);
}
@@ -1135,7 +1135,7 @@ public:
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid)))
+ if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid)))
CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me);
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
index 98a349f3606..a705659337f 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -178,7 +178,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
{
if (unit->GetHealth() > health)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 35521a783be..0d9537b8b7a 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -95,7 +95,7 @@ public:
{
DoZoneInCombat();
- Creature* Teron = (Unit::GetCreature((*me), TeronGUID));
+ Creature* Teron = (ObjectAccessor::GetCreature((*me), TeronGUID));
if ((Teron) && (!Teron->IsAlive() || Teron->IsInEvadeMode()))
Despawn();
}
@@ -177,7 +177,7 @@ public:
std::list<Unit*> targets;
for (; itr != threatlist.end(); ++itr)
{
- Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->IsAlive())
targets.push_back(unit);
}
@@ -200,7 +200,7 @@ public:
if (CheckTeronTimer <= diff)
{
- Creature* Teron = (Unit::GetCreature((*me), TeronGUID));
+ Creature* Teron = (ObjectAccessor::GetCreature((*me), TeronGUID));
if (!Teron || !Teron->IsAlive() || Teron->IsInEvadeMode())
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -324,7 +324,7 @@ public:
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && unit->IsAlive())
{
float threat = DoGetThreat(unit);
@@ -344,7 +344,7 @@ public:
Unit* ghost = NULL;
if (GhostGUID)
- ghost = Unit::GetUnit(*me, GhostGUID);
+ ghost = ObjectAccessor::GetUnit(*me, GhostGUID);
if (ghost && ghost->IsAlive() && ghost->HasAura(SPELL_SHADOW_OF_DEATH))
{
/*float x, y, z;
@@ -391,7 +391,7 @@ public:
Done = true;
if (AggroTargetGUID)
{
- Unit* unit = Unit::GetUnit(*me, AggroTargetGUID);
+ Unit* unit = ObjectAccessor::GetUnit(*me, AggroTargetGUID);
if (unit)
AttackStart(unit);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 5228f891294..2362f534b05 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -141,7 +141,7 @@ public:
if (!SpineTargetGUID)
return false;
- Unit* target = Unit::GetUnit(*me, SpineTargetGUID);
+ Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
if (target && target->HasAura(SPELL_IMPALING_SPINE))
target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
SpineTargetGUID=0;
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 4a4addd253e..8fd9a421a49 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -182,7 +182,7 @@ public:
{
if (AggroYellTimer <= diff)
{
- if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter]))
+ if (Creature* pMember = ObjectAccessor::GetCreature(*me, Council[YellCounter]))
{
pMember->AI()->Talk(CouncilAggro[YellCounter].entry);
AggroYellTimer = CouncilAggro[YellCounter].timer;
@@ -197,7 +197,7 @@ public:
{
if (EnrageTimer <= diff)
{
- if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter]))
+ if (Creature* pMember = ObjectAccessor::GetCreature(*me, Council[YellCounter]))
{
pMember->CastSpell(pMember, SPELL_BERSERK, true);
pMember->AI()->Talk(CouncilEnrage[YellCounter].entry);
@@ -251,7 +251,7 @@ public:
Creature* pMember = NULL;
for (uint8 i = 0; i < 4; ++i)
{
- pMember = Unit::GetCreature((*me), Council[i]);
+ pMember = ObjectAccessor::GetCreature((*me), Council[i]);
if (!pMember)
continue;
@@ -330,7 +330,7 @@ public:
return;
}
- Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount]));
+ Creature* pMember = (ObjectAccessor::GetCreature(*me, Council[DeathCount]));
if (pMember && pMember->IsAlive())
pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
++DeathCount;
@@ -347,7 +347,7 @@ public:
{
if (Council[i])
{
- if (Creature* Member = (Unit::GetCreature((*me), Council[i])))
+ if (Creature* Member = (ObjectAccessor::GetCreature((*me), Council[i])))
{
// This is the evade/death check.
if (Member->IsAlive() && !Member->GetVictim())
@@ -407,7 +407,7 @@ struct boss_illidari_councilAI : public ScriptedAI
{
for (uint8 i = 0; i < 4; ++i)
{
- if (Unit* unit = Unit::GetUnit(*me, Council[i]))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, Council[i]))
if (unit != me && unit->GetVictim())
{
AttackStart(unit->GetVictim());
@@ -425,7 +425,7 @@ struct boss_illidari_councilAI : public ScriptedAI
damage /= 4;
for (uint8 i = 0; i < 4; ++i)
{
- if (Creature* unit = Unit::GetCreature(*me, Council[i]))
+ if (Creature* unit = ObjectAccessor::GetCreature(*me, Council[i]))
if (unit != me && damage < unit->GetHealth())
{
unit->ModifyHealth(-int32(damage));
@@ -493,7 +493,7 @@ public:
member = urand(1, 3);
if (member != 2) // No need to create another pointer to us using Unit::GetUnit
- unit = Unit::GetUnit(*me, Council[member]);
+ unit = ObjectAccessor::GetUnit(*me, Council[member]);
return unit;
}
@@ -507,7 +507,7 @@ public:
}
for (uint8 i = 0; i < 4; ++i)
{
- Unit* unit = Unit::GetUnit(*me, Council[i]);
+ Unit* unit = ObjectAccessor::GetUnit(*me, Council[i]);
if (unit)
unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID());
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index 6d43b0e910c..c6b62ee8de7 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -216,7 +216,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
{
AttackStart(target);
GetAdvisors();
@@ -357,7 +357,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -484,7 +484,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -515,7 +515,7 @@ public:
if (Spitfire_Timer <= diff)
{
DoCast(me, SPELL_SPITFIRE_TOTEM);
- if (Unit* SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM))
+ if (Unit* SpitfireTotem = ObjectAccessor::GetUnit(*me, CREATURE_SPITFIRE_TOTEM))
SpitfireTotem->ToCreature()->AI()->AttackStart(me->GetVictim());
Spitfire_Timer = 60000;
@@ -599,7 +599,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -675,13 +675,13 @@ public:
switch (rand()%4)
{
case 0:
- unit = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESS));
break;
case 1:
- unit = Unit::GetUnit(*me, instance->GetData64(DATA_SHARKKIS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SHARKKIS));
break;
case 2:
- unit = Unit::GetUnit(*me, instance->GetData64(DATA_TIDALVESS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_TIDALVESS));
break;
case 3:
unit = me;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
index c4d21d30328..bcde75584fb 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
@@ -162,7 +162,7 @@ public:
{
for (uint8 i = 0; i < 2; ++i)
{
- if (Creature* mob = Unit::GetCreature(*me, beams[i]))
+ if (Creature* mob = ObjectAccessor::GetCreature(*me, beams[i]))
{
mob->setDeathState(DEAD);
mob->RemoveCorpse();
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
index dbf0c419fad..0745a85bf02 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -207,7 +207,7 @@ public:
{
if (ShieldGeneratorChannel[i])
{
- if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]))
+ if (Unit* remo = ObjectAccessor::GetUnit(*me, ShieldGeneratorChannel[i]))
{
remo->setDeathState(JUST_DIED);
ShieldGeneratorChannel[i] = 0;
@@ -431,7 +431,7 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (target && target->IsWithinDistInMap(me, 5)) // if in melee range
{
inMeleeRange = true;
@@ -620,7 +620,7 @@ public:
if (me->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3))
DoCast(me, SPELL_SURGE);
}
- if (Creature* vashj = Unit::GetCreature(*me, VashjGUID))
+ if (Creature* vashj = ObjectAccessor::GetCreature(*me, VashjGUID))
if (!vashj->IsInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase != 2 || vashj->isDead())
me->Kill(me);
Move = 1000;
@@ -662,7 +662,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* vashj = Unit::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ)))
+ if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ)))
CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath();
}
@@ -778,7 +778,7 @@ public:
if (CheckTimer <= diff)
{
// check if vashj is death
- Unit* Vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
+ Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
if (!Vashj || !Vashj->IsAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3)
{
// remove
@@ -833,7 +833,7 @@ public:
{
if (CheckTimer <= diff)
{
- Unit* vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
+ Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
if (vashj && vashj->IsAlive())
{
@@ -865,7 +865,7 @@ public:
return true;
}
- Creature* vashj = Unit::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ));
+ Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ));
if (vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2))
{
if (GameObject* gObj = targets.GetGOTarget())
@@ -901,7 +901,7 @@ public:
}
// get and remove channel
- if (Unit* channel = Unit::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier]))
+ if (Unit* channel = ObjectAccessor::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier]))
channel->setDeathState(JUST_DIED); // call Unsummon()
instance->SetData(identifier, 1);
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index 462babdc597..cc09952d336 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -112,7 +112,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- Unit* unit = Unit::GetUnit(*me, victimGUID);
+ Unit* unit = ObjectAccessor::GetUnit(*me, victimGUID);
if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER))
unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
}
@@ -141,7 +141,7 @@ public:
if (me->EnsureVictim()->GetGUID() != victimGUID)
{
DoModifyThreatPercent(me->GetVictim(), -100);
- Unit* owner = Unit::GetUnit(*me, victimGUID);
+ Unit* owner = ObjectAccessor::GetUnit(*me, victimGUID);
if (owner && owner->IsAlive())
{
me->AddThreat(owner, 999999);
@@ -249,7 +249,7 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
- if (Creature* add = Unit::GetCreature(*me, SpellBinderGUID[i]))
+ if (Creature* add = ObjectAccessor::GetCreature(*me, SpellBinderGUID[i]))
add->DisappearAndDie();
float nx = x;
@@ -297,7 +297,7 @@ public:
uint8 AliveChannelers = 0;
for (uint8 i = 0; i < 3; ++i)
{
- Unit* add = Unit::GetUnit(*me, SpellBinderGUID[i]);
+ Unit* add = ObjectAccessor::GetUnit(*me, SpellBinderGUID[i]);
if (add && add->IsAlive())
++AliveChannelers;
}
@@ -350,7 +350,7 @@ public:
if (InnderDemon[i])
{
//delete creature
- Creature* creature = Unit::GetCreature((*me), InnderDemon[i]);
+ Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]);
if (creature && creature->IsAlive())
{
creature->DespawnOrUnsummon();
@@ -368,10 +368,10 @@ public:
{
if (InnderDemon[i] > 0)
{
- Creature* unit = Unit::GetCreature((*me), InnderDemon[i]);
+ Creature* unit = ObjectAccessor::GetCreature((*me), InnderDemon[i]);
if (unit && unit->IsAlive())
{
- Unit* unit_target = Unit::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM));
+ Unit* unit_target = ObjectAccessor::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM));
if (unit_target && unit_target->IsAlive())
{
unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
@@ -397,7 +397,7 @@ public:
//despawn copy
if (Demon)
{
- if (Creature* pDemon = Unit::GetCreature(*me, Demon))
+ if (Creature* pDemon = ObjectAccessor::GetCreature(*me, Demon))
pDemon->DespawnOrUnsummon();
}
instance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE);
@@ -518,7 +518,7 @@ public:
std::vector<Unit*> TargetList;
for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{
- Unit* tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ Unit* tempTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->EnsureVictim()->GetGUID() && TargetList.size()<5)
TargetList.push_back(tempTarget);
}
@@ -701,7 +701,7 @@ public:
Earthshock_Timer = urand(5000, 10000);
instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0);
- Creature* leotheras = Unit::GetCreature(*me, leotherasGUID);
+ Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID);
if (leotheras && leotheras->IsAlive())
CAST_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/);
}
@@ -724,7 +724,7 @@ public:
{
if (leotherasGUID)
{
- Creature* leotheras = Unit::GetCreature(*me, leotherasGUID);
+ Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID);
if (leotheras && leotheras->IsAlive())
DoCast(leotheras, BANISH_BEAM);
}
@@ -739,7 +739,7 @@ public:
if (!me->IsInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
- victim = Unit::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
+ victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
AttackStart(victim);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
index 4f8c9390ba4..7e37c22565a 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
@@ -98,7 +98,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i)
- if (Creature* strider = Unit::GetCreature(*me, *i))
+ if (Creature* strider = ObjectAccessor::GetCreature(*me, *i))
strider->DisappearAndDie();
}
@@ -132,7 +132,7 @@ public:
{
if (LevitatedTarget_Timer <= diff)
{
- if (Unit* target = Unit::GetUnit(*me, LevitatedTarget))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, LevitatedTarget))
{
if (!target->HasAura(SPELL_LEVITATE))
{
diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
index c1e9d0a2b91..89aad2534f0 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -530,7 +530,7 @@ public:
std::vector<Unit*> target_list;
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
//15 yard radius minimum
if (target && target->IsWithinDist(me, 15, false))
target_list.push_back(target);
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index 066772cb0f7..c85a26a25ab 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -118,7 +118,7 @@ class boss_kelidan_the_breaker : public CreatureScript
}
for (uint8 i=0; i<5; ++i)
{
- Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
+ Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (who && channeler && !channeler->IsInCombat())
channeler->AI()->AttackStart(who);
}
@@ -128,7 +128,7 @@ class boss_kelidan_the_breaker : public CreatureScript
{
for (uint8 i=0; i<5; ++i)
{
- Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
+ Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (channeler && channeler->IsAlive())
return;
}
@@ -147,7 +147,7 @@ class boss_kelidan_the_breaker : public CreatureScript
uint8 i;
for (i=0; i<5; ++i)
{
- Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
+ Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (channeler && channeler->GetGUID() == channeler1->GetGUID())
break;
}
@@ -158,7 +158,7 @@ class boss_kelidan_the_breaker : public CreatureScript
{
for (uint8 i=0; i<5; ++i)
{
- Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
+ Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (!channeler || channeler->isDead())
channeler = me->SummonCreature(ENTRY_CHANNELER, ShadowmoonChannelers[i][0], ShadowmoonChannelers[i][1], ShadowmoonChannelers[i][2], ShadowmoonChannelers[i][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
if (channeler)
@@ -313,7 +313,7 @@ class npc_shadowmoon_channeler : public CreatureScript
if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
{
uint64 channeler = CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me);
- if (Unit* channeled = Unit::GetUnit(*me, channeler))
+ if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler))
DoCast(channeled, SPELL_CHANNELING);
}
check_Timer = 5000;
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
index 424090c87d0..b15bd18c97c 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
@@ -124,7 +124,7 @@ class boss_nazan : public CreatureScript
if (flight) // phase 1 - the flight
{
- Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID);
+ Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID);
if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20)))
{
flight = false;
@@ -300,7 +300,7 @@ class boss_vazruden_the_herald : public CreatureScript
{
if (summoned)
{
- Creature* Nazan = Unit::GetCreature(*me, NazanGUID);
+ Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID);
if (!Nazan)
Nazan = me->FindNearestCreature(NPC_NAZAN, 5000);
if (Nazan)
@@ -309,7 +309,7 @@ class boss_vazruden_the_herald : public CreatureScript
NazanGUID = 0;
}
- Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID);
+ Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID);
if (!Vazruden)
Vazruden = me->FindNearestCreature(NPC_VAZRUDEN, 5000);
if (Vazruden)
@@ -404,8 +404,8 @@ class boss_vazruden_the_herald : public CreatureScript
default: // adds do the job now
if (check <= diff)
{
- Creature* Nazan = Unit::GetCreature(*me, NazanGUID);
- Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID);
+ Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID);
+ Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID);
if ((Nazan && Nazan->IsAlive()) || (Vazruden && Vazruden->IsAlive()))
{
if ((Nazan && Nazan->GetVictim()) || (Vazruden && Vazruden->GetVictim()))
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 91aad3c00eb..1bdaf4fc260 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -257,7 +257,7 @@ class boss_magtheridon : public CreatureScript
{
// to avoid multiclicks from 1 cube
if (uint64 guid = Cube[cubeGUID])
- DebuffClicker(Unit::GetUnit(*me, guid));
+ DebuffClicker(ObjectAccessor::GetUnit(*me, guid));
Cube[cubeGUID] = clickerGUID;
NeedCheckCube = true;
}
@@ -280,7 +280,7 @@ class boss_magtheridon : public CreatureScript
// if not - apply mind exhaustion and delete from clicker's list
for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i)
{
- Unit* clicker = Unit::GetUnit(*me, (*i).second);
+ Unit* clicker = ObjectAccessor::GetUnit(*me, (*i).second);
if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP))
{
DebuffClicker(clicker);
@@ -588,7 +588,7 @@ public:
if (instance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS)
return true;
- Creature* Magtheridon =Unit::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON));
+ Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON));
if (!Magtheridon || !Magtheridon->IsAlive())
return true;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 187e5b4993b..88c3041b62c 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -323,7 +323,7 @@ class npc_fel_orc_convert : public CreatureScript
{
events.ScheduleEvent(EVENT_HEMORRHAGE, 3000);
- if (Creature* Kurse = Unit::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
+ if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
if (me->IsWithinDist(Kurse, 45.0f))
Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_AGGRO);
}
@@ -333,7 +333,7 @@ class npc_fel_orc_convert : public CreatureScript
if (instance->GetBossState(DATA_NETHEKURSE) != IN_PROGRESS)
return;
- if (Creature* Kurse = Unit::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
+ if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_DEATH);
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
index 69be4b46eff..b03fc651e12 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -142,13 +142,13 @@ class boss_warbringer_omrogg : public CreatureScript
void Reset() override
{
- if (Unit* LeftHead = Unit::GetUnit(*me, LeftHeadGUID))
+ if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID))
{
LeftHead->setDeathState(JUST_DIED);
LeftHeadGUID = 0;
}
- if (Unit* RightHead = Unit::GetUnit(*me, RightHeadGUID))
+ if (Unit* RightHead = ObjectAccessor::GetUnit(*me, RightHeadGUID))
{
RightHead->setDeathState(JUST_DIED);
RightHeadGUID = 0;
@@ -172,8 +172,8 @@ class boss_warbringer_omrogg : public CreatureScript
void DoYellForThreat()
{
- Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID);
- Creature* RightHead = Unit::GetCreature(*me, RightHeadGUID);
+ Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID);
+ Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID);
if (!LeftHead || !RightHead)
return;
@@ -193,7 +193,7 @@ class boss_warbringer_omrogg : public CreatureScript
me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
- if (Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID))
+ if (Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID))
{
iaggro = rand()%3;
@@ -221,8 +221,8 @@ class boss_warbringer_omrogg : public CreatureScript
void KilledUnit(Unit* /*victim*/) override
{
- Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID);
- Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID);
+ Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID);
+ Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID);
if (!LeftHead || !RightHead)
return;
@@ -247,8 +247,8 @@ class boss_warbringer_omrogg : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID);
- Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID);
+ Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID);
+ Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID);
if (!LeftHead || !RightHead)
return;
@@ -266,8 +266,8 @@ class boss_warbringer_omrogg : public CreatureScript
{
Delay_Timer = 3500;
- Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID);
- Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID);
+ Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID);
+ Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID);
if (!LeftHead || !RightHead)
return;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index f918038b369..66aa02bbeaf 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -145,7 +145,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
{
for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
{
- Creature* creature = Unit::GetCreature(*me, *itr);
+ Creature* creature = ObjectAccessor::GetCreature(*me, *itr);
if (creature && creature->IsAlive())
{
creature->GetMotionMaster()->Clear(true);
@@ -157,7 +157,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
{
- Creature* creature = Unit::GetCreature(*me, *itr);
+ Creature* creature = ObjectAccessor::GetCreature(*me, *itr);
if (creature && creature->IsAlive())
{
creature->GetMotionMaster()->Clear(true);
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index ead163b3a82..bcc8b0c5a48 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -494,7 +494,7 @@ class npc_ember_of_alar : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (instance->GetData(DATA_ALAREVENT) == 2)
{
- if (Unit* Alar = Unit::GetUnit(*me, instance->GetData64(DATA_ALAR)))
+ if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALAR)))
{
int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3));
if (AlarHealth > 0)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 5f92445f9dd..2cac4a0be1a 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -464,7 +464,7 @@ class npc_solarium_priest : public CreatureScript
switch (urand(0, 1))
{
case 0:
- target = Unit::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER));
+ target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER));
break;
case 1:
target = me;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 016e68a4e8d..a24e1d5d34f 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -143,7 +143,7 @@ uint32 m_auiSpellSummonWeapon[]=
};
const float CAPERNIAN_DISTANCE = 20.0f; //she casts away from the target
-const float KAEL_VISIBLE_RANGE = 50.0f;
+//const float KAEL_VISIBLE_RANGE = 50.0f;
const float afGravityPos[3] = {795.0f, 0.0f, 70.0f};
@@ -183,7 +183,7 @@ struct advisorbase_ai : public ScriptedAI
//reset encounter
if (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3)
- if (Creature* Kaelthas = Unit::GetCreature(*me, instance->GetData64(DATA_KAELTHAS)))
+ if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KAELTHAS)))
Kaelthas->AI()->EnterEvadeMode();
}
@@ -262,7 +262,7 @@ struct advisorbase_ai : public ScriptedAI
DelayRes_Timer = 0;
FakeDeath = false;
- Unit* Target = Unit::GetUnit(*me, DelayRes_Target);
+ Unit* Target = ObjectAccessor::GetUnit(*me, DelayRes_Target);
if (!Target)
Target = me->GetVictim();
@@ -351,7 +351,7 @@ class boss_kaelthas : public CreatureScript
{
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
{
- if (Creature* creature = Unit::GetCreature(*me, m_auiAdvisorGuid[i]))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[i]))
{
creature->Respawn();
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -468,7 +468,7 @@ class boss_kaelthas : public CreatureScript
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
{
- if (Unit* pAdvisor = Unit::GetUnit(*me, m_auiAdvisorGuid[i]))
+ if (Unit* pAdvisor = ObjectAccessor::GetUnit(*me, m_auiAdvisorGuid[i]))
pAdvisor->Kill(pAdvisor);
}
}
@@ -502,7 +502,7 @@ class boss_kaelthas : public CreatureScript
case 1:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[0]));
if (Advisor)
{
@@ -520,7 +520,7 @@ class boss_kaelthas : public CreatureScript
//Subphase 2 - Start
case 2:
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[0]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
@@ -536,7 +536,7 @@ class boss_kaelthas : public CreatureScript
case 3:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[1]));
if (Advisor)
{
@@ -554,7 +554,7 @@ class boss_kaelthas : public CreatureScript
//Subphase 3 - Start
case 4:
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[1]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
@@ -570,7 +570,7 @@ class boss_kaelthas : public CreatureScript
case 5:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[2]));
if (Advisor)
{
@@ -588,7 +588,7 @@ class boss_kaelthas : public CreatureScript
//Subphase 4 - Start
case 6:
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[2]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
@@ -604,7 +604,7 @@ class boss_kaelthas : public CreatureScript
case 7:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[3]));
if (Advisor)
{
@@ -623,7 +623,7 @@ class boss_kaelthas : public CreatureScript
//End of phase 1
case 8:
- Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3]));
+ Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[3]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
@@ -692,7 +692,7 @@ class boss_kaelthas : public CreatureScript
Creature* Advisor;
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
{
- Advisor = Unit::GetCreature(*me, m_auiAdvisorGuid[i]);
+ Advisor = ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[i]);
if (!Advisor)
TC_LOG_ERROR("scripts", "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
@@ -896,7 +896,7 @@ class boss_kaelthas : public CreatureScript
// 1) Kael'thas will portal the whole raid right into his body
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
//Use work around packet to prevent player from being dropped from combat
@@ -917,7 +917,7 @@ class boss_kaelthas : public CreatureScript
// 2) At that point he will put a Gravity Lapse debuff on everyone
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
{
DoCast(unit, SPELL_KNOCKBACK, true);
//Gravity lapse - needs an exception in Spell system to work
@@ -949,7 +949,7 @@ class boss_kaelthas : public CreatureScript
//Remove flight
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
- if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
{
//Using packet workaround
WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
@@ -1288,7 +1288,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i!= threatlist.end(); ++i)
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
//if in melee range
if (unit && unit->IsWithinDistInMap(me, 5))
{
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
index 58b5972c25c..634d54ed58b 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -122,7 +122,7 @@ class boss_void_reaver : public CreatureScript
std::vector<Unit*> target_list;
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
- target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
+ target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (!target)
continue;
// exclude pets & totems, 18 yard radius minimum
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
index 53727db2f4b..2c15a6dd30d 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
@@ -151,7 +151,7 @@ class boss_high_botanist_freywinn : public CreatureScript
{
for (std::list<uint64>::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr)
{
- if (Unit* temp = Unit::GetUnit(*me, *itr))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr))
{
if (!temp->IsAlive())
{
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index c9dd31cdc76..a1335290d5a 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -97,7 +97,7 @@ class npc_warp_splinter_treant : public CreatureScript
{
if (WarpGuid && check_Timer <= diff)
{
- if (Unit* Warp = Unit::GetUnit(*me, WarpGuid))
+ if (Unit* Warp = ObjectAccessor::GetUnit(*me, WarpGuid))
{
if (me->IsWithinMeleeRange(Warp, 2.5f))
{
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 7b9b2be4674..0da70207a04 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -318,7 +318,7 @@ public:
if (type != POINT_MOTION_TYPE || id != 1)
return;
- if (Creature* helboar = me->GetCreature(*me, helboarGUID))
+ if (Creature* helboar = ObjectAccessor::GetCreature(*me, helboarGUID))
{
helboar->RemoveCorpse();
DoCast(SPELL_SUMMON_POO);
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 8fac7853f26..cb75ee3b2ad 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -243,7 +243,7 @@ public:
case 1:
if (someplayer)
{
- Unit* u = Unit::GetUnit(*me, someplayer);
+ Unit* u = ObjectAccessor::GetUnit(*me, someplayer);
if (u && u->GetTypeId() == TYPEID_PLAYER)
Talk(EMOTE_START, u);
}
@@ -795,7 +795,7 @@ public:
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
{
- if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (unit->GetCreateMana() > 0)
UnitsWithMana.push_back(unit);
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 4efa108429a..cfcc05a625c 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -133,7 +133,7 @@ public:
{
if (bCanEat && !bIsEating)
{
- if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, uiPlayerGUID))
{
if (GameObject* go = unit->FindNearestGameObject(GO_CARCASS, 10))
{
@@ -273,7 +273,7 @@ public:
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit(*me, PlayerGUID);
+ Unit* player = ObjectAccessor::GetUnit(*me, PlayerGUID);
if (player)
DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true);
@@ -1225,7 +1225,7 @@ public:
if (TorlothAnim[AnimationCount].creature == 1)
{
- creature = (Unit::GetCreature(*me, LordIllidanGUID));
+ creature = (ObjectAccessor::GetCreature(*me, LordIllidanGUID));
if (!creature)
return;
@@ -1326,7 +1326,7 @@ public:
break;
}
- if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID)))
+ if (Creature* LordIllidan = (ObjectAccessor::GetCreature(*me, LordIllidanGUID)))
LordIllidan->AI()->EnterEvadeMode();
}
};
@@ -1507,7 +1507,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
me->RemoveCorpse();
- if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID)))
+ if (Creature* LordIllidan = (ObjectAccessor::GetCreature(*me, LordIllidanGUID)))
if (LordIllidan)
CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter();
}
@@ -1813,7 +1813,6 @@ public:
enum ZuluhedChains
{
- QUEST_ZULUHED = 10866,
NPC_KARYNAKU = 22112,
};
@@ -1828,9 +1827,9 @@ class spell_unlocking_zuluheds_chains : public SpellScriptLoader
void HandleAfterHit()
{
- if (GetCaster()->GetTypeId() == TYPEID_PLAYER)
- if (Creature* karynaku = GetCaster()->FindNearestCreature(NPC_KARYNAKU, 15.0f))
- GetCaster()->ToPlayer()->KilledMonsterCredit(NPC_KARYNAKU, karynaku->GetGUID());
+ if (Player* caster = GetCaster()->ToPlayer())
+ if (Creature* karynaku = caster->FindNearestCreature(NPC_KARYNAKU, 15.0f))
+ caster->KilledMonsterCredit(NPC_KARYNAKU, karynaku->GetGUID());
}
void Register() override
@@ -1867,13 +1866,6 @@ public:
{
npc_shadowmoon_tuber_nodeAI(Creature* creature) : ScriptedAI(creature) { }
- void Reset() override
- {
- tapped = false;
- tuberGUID = 0;
- resetTimer = 60000;
- }
-
void SetData(uint32 id, uint32 data) override
{
if (id == TYPE_BOAR && data == DATA_BOAR)
@@ -1884,49 +1876,23 @@ public:
// Despawn the tuber
if (GameObject* tuber = me->FindNearestGameObject(GO_SHADOWMOON_TUBER_MOUND, 5.0f))
{
- tuberGUID = tuber->GetGUID();
- // @Workaround: find how to properly despawn the GO
- tuber->SetPhaseMask(2, true);
+ tuber->SetLootState(GO_JUST_DEACTIVATED);
+ me->DespawnOrUnsummon();
}
}
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
{
- if (!tapped && spell->Id == SPELL_WHISTLE)
+ if (spell->Id == SPELL_WHISTLE)
{
if (Creature* boar = me->FindNearestCreature(NPC_BOAR_ENTRY, 30.0f))
{
- // Disable trigger and force nearest boar to walk to him
- tapped = true;
boar->SetWalk(false);
boar->GetMotionMaster()->MovePoint(POINT_TUBER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
}
}
}
-
- void UpdateAI(uint32 diff) override
- {
- if (tapped)
- {
- if (resetTimer <= diff)
- {
- // Respawn the tuber
- if (tuberGUID)
- if (GameObject* tuber = GameObject::GetGameObject(*me, tuberGUID))
- // @Workaround: find how to properly respawn the GO
- tuber->SetPhaseMask(1, true);
-
- Reset();
- }
- else
- resetTimer -= diff;
- }
- }
- private:
- bool tapped;
- uint64 tuberGUID;
- uint32 resetTimer;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 6a6ee144aac..5ae0e1601c5 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -322,13 +322,14 @@ class spell_dk_blood_gorged : public SpellScriptLoader
class CorpseExplosionCheck
{
public:
- explicit CorpseExplosionCheck(uint64 casterGUID) : _casterGUID(casterGUID) { }
+ explicit CorpseExplosionCheck(uint64 casterGUID, bool allowGhoul) : _casterGUID(casterGUID),
+ _allowGhoul(allowGhoul) { }
bool operator()(WorldObject* obj) const
{
if (Unit* target = obj->ToUnit())
{
- if ((target->isDead() || (target->GetEntry() == NPC_DK_GHOUL && target->GetOwnerGUID() == _casterGUID))
+ if ((target->isDead() || (_allowGhoul && target->GetEntry() == NPC_DK_GHOUL && target->GetOwnerGUID() == _casterGUID))
&& !(target->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)
&& target->GetDisplayId() == target->GetNativeDisplayId())
return false;
@@ -339,6 +340,7 @@ public:
private:
uint64 _casterGUID;
+ bool _allowGhoul;
};
// 49158 - Corpse Explosion (51325, 51326, 51327, 51328)
@@ -369,7 +371,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
void CheckTarget(WorldObject*& target)
{
- if (CorpseExplosionCheck(GetCaster()->GetGUID())(target))
+ if (CorpseExplosionCheck(GetCaster()->GetGUID(), true)(target))
target = NULL;
_target = target;
@@ -380,7 +382,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
WorldObject* target = _target;
if (!target)
{
- targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID()));
+ targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID(), false));
if (targets.empty())
{
FinishCast(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 77a4faa7e8c..4c72d790059 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -509,7 +509,7 @@ class spell_gen_break_shield: public SpellScriptLoader
class spell_gen_break_shield_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_break_shield_SpellScript)
+ PrepareSpellScript(spell_gen_break_shield_SpellScript);
void HandleScriptEffect(SpellEffIndex effIndex)
{
@@ -671,7 +671,7 @@ class spell_gen_chaos_blast : public SpellScriptLoader
class spell_gen_chaos_blast_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_chaos_blast_SpellScript)
+ PrepareSpellScript(spell_gen_chaos_blast_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -895,7 +895,7 @@ class spell_gen_count_pct_from_max_hp : public SpellScriptLoader
class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript)
+ PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript);
public:
spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { }
@@ -1446,6 +1446,7 @@ class spell_gen_elune_candle : public SpellScriptLoader
class spell_gen_elune_candle_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_elune_candle_SpellScript);
+
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD) ||
@@ -1511,7 +1512,7 @@ class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader
class spell_gen_gadgetzan_transporter_backfire_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript)
+ PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -1612,7 +1613,7 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader
class spell_gen_gnomish_transporter_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript)
+ PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -2093,7 +2094,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader
class spell_gen_mounted_charge_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_mounted_charge_SpellScript)
+ PrepareSpellScript(spell_gen_mounted_charge_SpellScript);
void HandleScriptEffect(SpellEffIndex effIndex)
{
@@ -2794,7 +2795,7 @@ class spell_gen_parachute_ic : public SpellScriptLoader
class spell_gen_parachute_ic_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_gen_parachute_ic_AuraScript)
+ PrepareAuraScript(spell_gen_parachute_ic_AuraScript);
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
{
@@ -2842,30 +2843,28 @@ class spell_gen_pet_summoned : public SpellScriptLoader
if (player->GetLastPetNumber())
{
PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
- if (Pet* newPet = new Pet(player, newPetType))
+ Pet* newPet = new Pet(player, newPetType);
+ if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true))
{
- if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true))
- {
- // revive the pet if it is dead
- if (newPet->getDeathState() == DEAD)
- newPet->setDeathState(ALIVE);
+ // revive the pet if it is dead
+ if (newPet->getDeathState() == DEAD)
+ newPet->setDeathState(ALIVE);
- newPet->SetFullHealth();
- newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType()));
+ newPet->SetFullHealth();
+ newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType()));
- switch (newPet->GetEntry())
- {
- case NPC_DOOMGUARD:
- case NPC_INFERNAL:
- newPet->SetEntry(NPC_IMP);
- break;
- default:
- break;
- }
+ switch (newPet->GetEntry())
+ {
+ case NPC_DOOMGUARD:
+ case NPC_INFERNAL:
+ newPet->SetEntry(NPC_IMP);
+ break;
+ default:
+ break;
}
- else
- delete newPet;
}
+ else
+ delete newPet;
}
}
@@ -3123,7 +3122,7 @@ class spell_gen_spectator_cheer_trigger : public SpellScriptLoader
class spell_gen_spectator_cheer_trigger_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript)
+ PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
@@ -3615,7 +3614,7 @@ class spell_gen_vendor_bark_trigger : public SpellScriptLoader
class spell_gen_vendor_bark_trigger_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_gen_vendor_bark_trigger_SpellScript)
+ PrepareSpellScript(spell_gen_vendor_bark_trigger_SpellScript);
void HandleDummy(SpellEffIndex /* effIndex */)
{
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index dc0c70975dd..85bf85fa2d2 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -296,7 +296,7 @@ class spell_pilgrims_bounty_buff_food : public SpellScriptLoader
class spell_pilgrims_bounty_buff_food_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_pilgrims_bounty_buff_food_AuraScript)
+ PrepareAuraScript(spell_pilgrims_bounty_buff_food_AuraScript);
private:
uint32 const _triggeredSpellId;
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 2739a8453df..c3f994135aa 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -202,16 +202,21 @@ class spell_hun_chimera_shot : public SpellScriptLoader
flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
continue;
- if (AuraEffect const* aurEff = aura->GetEffect(0))
+ if (AuraEffect* aurEff = aura->GetEffect(0))
{
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
if (familyFlag[0] & 0x4000)
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT;
- basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
+ basePoint = aurEff->GetDamage();
ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
+
+ // Recalculate bonus damage on roll.
+ uint32 damage = std::max(aurEff->GetAmount(), 0);
+ sScriptMgr->ModifyPeriodicDamageAurasTick(unitTarget, caster, damage);
+ aurEff->SetDamage(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), damage, DOT) * aurEff->GetDonePct());
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
@@ -744,8 +749,13 @@ class spell_hun_sniper_training : public SpellScriptLoader
{
Unit* target = GetTarget();
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
- if (!target->HasAura(spellId))
- target->CastSpell(target, spellId, true, 0, aurEff);
+ target->CastSpell(target, spellId, true, 0, aurEff);
+ if (Player* playerTarget = GetUnitOwner()->ToPlayer())
+ {
+ int32 baseAmount = aurEff->GetBaseAmount();
+ int32 amount = playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount);
+ GetEffect(EFFECT_0)->SetAmount(amount);
+ }
}
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index be3b48b114d..a17d7dce2ea 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -2231,7 +2231,8 @@ class spell_item_nitro_boots : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
- caster->CastSpell(caster, roll_chance_i(95) ? SPELL_NITRO_BOOTS_SUCCESS : SPELL_NITRO_BOOTS_BACKFIRE, true, GetCastItem());
+ bool success = caster->GetMap()->IsDungeon() || roll_chance_i(95);
+ caster->CastSpell(caster, success ? SPELL_NITRO_BOOTS_SUCCESS : SPELL_NITRO_BOOTS_BACKFIRE, true, GetCastItem());
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index bf4f1b77a19..447cb645e76 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -866,8 +866,8 @@ class spell_pal_improved_aura : public SpellScriptLoader
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
- if (!target->GetOwnedAura(_spellId))
- target->CastSpell(target, _spellId, true);
+ GetTarget()->RemoveOwnedAura(_spellId, GetCasterGUID()); // need to remove to reapply spellmods
+ target->CastSpell(target, _spellId, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index f96a30c903a..76781e0fdc2 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -205,7 +205,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader
void Register() override
{
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -336,7 +336,7 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader
void Register() override
{
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -531,10 +531,17 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
+ Unit* caster = GetCaster();
// Refresh Shadow Word: Pain on target
- if (Unit* unitTarget = GetHitUnit())
- if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID()))
+ if (Unit* target = GetHitUnit())
+ if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, caster->GetGUID()))
+ {
+ uint32 damage = std::max(aur->GetAmount(), 0);
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+ aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT) * aur->GetDonePct());
+ aur->CalculatePeriodic(caster, false, false);
aur->GetBase()->RefreshDuration();
+ }
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 590cad7007f..61ff79c505e 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -775,7 +775,7 @@ class spell_sha_lava_lash : public SpellScriptLoader
class spell_sha_lava_lash_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_sha_lava_lash_SpellScript)
+ PrepareSpellScript(spell_sha_lava_lash_SpellScript);
bool Load() override
{
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 18979d24ecb..3f935077b22 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -405,10 +405,17 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Unit* unitTarget = GetHitUnit())
+ Unit* caster = GetCaster();
+ if (Unit* target = GetHitUnit())
// Refresh corruption on target
- if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID()))
- aur->GetBase()->RefreshDuration();
+ if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, caster->GetGUID()))
+ {
+ uint32 damage = std::max(aur->GetAmount(), 0);
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+ aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT) * aur->GetDonePct());
+ aur->CalculatePeriodic(caster, false, false);
+ aur->GetBase()->RefreshDuration(true);
+ }
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index fd1c785cf50..40d939c6394 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -36,7 +36,7 @@ enum WarriorSpells
SPELL_WARRIOR_DEEP_WOUNDS_RANK_1 = 12162,
SPELL_WARRIOR_DEEP_WOUNDS_RANK_2 = 12850,
SPELL_WARRIOR_DEEP_WOUNDS_RANK_3 = 12868,
- SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC = 12721,
+ SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC = 12721,
SPELL_WARRIOR_EXECUTE = 20647,
SPELL_WARRIOR_GLYPH_OF_EXECUTION = 58367,
SPELL_WARRIOR_GLYPH_OF_VIGILANCE = 63326,
@@ -268,23 +268,18 @@ class spell_warr_deep_wounds : public SpellScriptLoader
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
- // apply percent damage mods
- damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
-
ApplyPct(damage, 16 * GetSpellInfo()->GetRank());
- damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
-
- SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC);
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC);
uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
// Add remaining ticks to damage done
- if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID()))
- damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());
+ if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, EFFECT_0, caster->GetGUID()))
+ damage += aurEff->GetDamage() * (ticks - aurEff->GetTickNumber());
damage /= ticks;
- caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
+ caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, &damage, NULL, NULL, true);
}
}
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index 73093037689..fb438c38efb 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -461,11 +461,11 @@ public:
if (player->GetQuestStatus(QUEST_THE_LONESOME_WATCHER) != QUEST_STATUS_INCOMPLETE)
return false;
- Creature* stormforgedMonitor = Creature::GetCreature(*player, stormforgedMonitorGUID);
+ Creature* stormforgedMonitor = ObjectAccessor::GetCreature(*player, stormforgedMonitorGUID);
if (stormforgedMonitor)
return false;
- Creature* stormforgedEradictor = Creature::GetCreature(*player, stormforgedEradictorGUID);
+ Creature* stormforgedEradictor = ObjectAccessor::GetCreature(*player, stormforgedEradictorGUID);
if (stormforgedEradictor)
return false;
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index 362c02e1af5..950b4cd10e9 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -781,4 +781,4 @@ void AddSC_emerald_dragons()
// dragon spellscripts
new spell_dream_fog_sleep();
new spell_mark_of_nature();
-};
+}
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index 416cab8efcd..21a81d37868 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -282,7 +282,7 @@ public:
{
if (exileTimer <= diff)
{
- if (Unit* temp = Unit::GetUnit(*me, playerGUID))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, playerGUID))
{
temp->CastSpell(temp, SPELL_EXILE, true);
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
@@ -347,7 +347,7 @@ public:
{
if (exileTimer <= diff)
{
- if (Unit* temp = Unit::GetUnit(*me, playerGUID))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, playerGUID))
{
temp->CastSpell(temp, SPELL_EXILE, true);
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 891ffd83628..c32edff09bc 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -56,6 +56,7 @@ EndContentData */
#include "CellImpl.h"
#include "SpellAuras.h"
#include "Pet.h"
+#include "CreatureTextMgr.h"
/*########
# npc_air_force_bots
@@ -175,7 +176,7 @@ public:
Creature* GetSummonedGuard()
{
- Creature* creature = Unit::GetCreature(*me, SpawnedGUID);
+ Creature* creature = ObjectAccessor::GetCreature(*me, SpawnedGUID);
if (creature && creature->IsAlive())
return creature;
@@ -671,7 +672,7 @@ public:
std::list<uint64>::const_iterator itr;
for (itr = Patients.begin(); itr != Patients.end(); ++itr)
{
- if (Creature* patient = Unit::GetCreature((*me), *itr))
+ if (Creature* patient = ObjectAccessor::GetCreature((*me), *itr))
patient->setDeathState(JUST_DIED);
}
}
@@ -768,7 +769,7 @@ public:
if (player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)
if (DoctorGUID)
- if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID))
+ if (Creature* doctor = ObjectAccessor::GetCreature(*me, DoctorGUID))
CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord);
//make not selectable
@@ -814,7 +815,7 @@ public:
me->SetFlag(UNIT_DYNAMIC_FLAGS, 32);
if (DoctorGUID)
- if (Creature* doctor = Unit::GetCreature((*me), DoctorGUID))
+ if (Creature* doctor = ObjectAccessor::GetCreature((*me), DoctorGUID))
CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord);
}
}
@@ -1064,7 +1065,7 @@ public:
{
if (RunAwayTimer <= diff)
{
- if (Unit* unit = Unit::GetUnit(*me, CasterGUID))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, CasterGUID))
{
switch (me->GetEntry())
{
@@ -2319,7 +2320,7 @@ public:
{
if (jumpTimer <= diff)
{
- if (Unit* rabbit = Unit::GetUnit(*me, rabbitGUID))
+ if (Unit* rabbit = ObjectAccessor::GetUnit(*me, rabbitGUID))
DoCast(rabbit, SPELL_SPRING_RABBIT_JUMP);
jumpTimer = urand(5000, 10000);
} else jumpTimer -= diff;
@@ -2353,6 +2354,60 @@ public:
};
};
+class npc_imp_in_a_ball : public CreatureScript
+{
+private:
+ enum
+ {
+ SAY_RANDOM,
+
+ EVENT_TALK = 1,
+ };
+
+public:
+ npc_imp_in_a_ball() : CreatureScript("npc_imp_in_a_ball") { }
+
+ struct npc_imp_in_a_ballAI : public ScriptedAI
+ {
+ npc_imp_in_a_ballAI(Creature* creature) : ScriptedAI(creature)
+ {
+ summonerGUID = 0;
+ }
+
+ void IsSummonedBy(Unit* summoner) override
+ {
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
+ {
+ summonerGUID = summoner->GetGUID();
+ events.ScheduleEvent(EVENT_TALK, 3000);
+ }
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ events.Update(diff);
+
+ if (events.ExecuteEvent() == EVENT_TALK)
+ {
+ if (Player* owner = ObjectAccessor::GetPlayer(*me, summonerGUID))
+ {
+ sCreatureTextMgr->SendChat(me, SAY_RANDOM, owner,
+ owner->GetGroup() ? CHAT_MSG_MONSTER_PARTY : CHAT_MSG_MONSTER_WHISPER, LANG_ADDON, TEXT_RANGE_NORMAL);
+ }
+ }
+ }
+
+ private:
+ EventMap events;
+ uint64 summonerGUID;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_imp_in_a_ballAI(creature);
+ }
+};
+
void AddSC_npcs_special()
{
new npc_air_force_bots();
@@ -2375,4 +2430,5 @@ void AddSC_npcs_special()
new npc_experience();
new npc_firework();
new npc_spring_rabbit();
+ new npc_imp_in_a_ball();
}
diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h
index d6ba98e4ed4..9121fbe2a97 100644
--- a/src/server/shared/Containers.h
+++ b/src/server/shared/Containers.h
@@ -64,6 +64,34 @@ namespace Trinity
std::advance(it, urand(0, container.size() - 1));
return *it;
}
+
+ /**
+ * @fn bool Trinity::Containers::Intersects(Iterator first1, Iterator last1, Iterator first2, Iterator last2)
+ *
+ * @brief Checks if two SORTED containers have a common element
+ *
+ * @param first1 Iterator pointing to start of the first container
+ * @param last1 Iterator pointing to end of the first container
+ * @param first2 Iterator pointing to start of the second container
+ * @param last2 Iterator pointing to end of the second container
+ *
+ * @return true if containers have a common element, false otherwise.
+ */
+ template<class Iterator1, class Iterator2>
+ bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
+ {
+ while (first1 != last1 && first2 != last2)
+ {
+ if (*first1 < *first2)
+ ++first1;
+ else if (*first2 < *first1)
+ ++first2;
+ else
+ return true;
+ }
+
+ return false;
+ }
}
//! namespace Containers
}
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index c60458323f7..9c56c75bf71 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -49,8 +49,10 @@ class DatabaseWorkerPool
{
public:
/* Activity state */
- DatabaseWorkerPool() : _queue(new ACE_Activation_Queue()), _connectionInfo(NULL)
+ DatabaseWorkerPool() : _connectionInfo(NULL)
{
+ _messageQueue = new ACE_Message_Queue<ACE_SYNCH>(8 * 1024 * 1024, 8 * 1024 * 1024);
+ _queue = new ACE_Activation_Queue(_messageQueue);
memset(_connectionCount, 0, sizeof(_connectionCount));
_connections.resize(IDX_SIZE);
@@ -97,7 +99,7 @@ class DatabaseWorkerPool
(_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
else
TC_LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
- "for specific errors.", GetDatabaseName());
+ "for specific errors. Read wiki at http://collab.kpsn.org/display/tc/TrinityCore+Home", GetDatabaseName());
return res;
}
@@ -131,6 +133,7 @@ class DatabaseWorkerPool
//! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
delete _queue;
+ delete _messageQueue;
TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName());
@@ -520,6 +523,7 @@ class DatabaseWorkerPool
IDX_SIZE
};
+ ACE_Message_Queue<ACE_SYNCH>* _messageQueue; //! Message Queue used by ACE_Activation_Queue
ACE_Activation_Queue* _queue; //! Queue shared by async worker threads.
std::vector< std::vector<T*> > _connections;
uint32 _connectionCount[2]; //! Counter of MySQL connections;
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index 3b6bd3d2cc8..81825c9055b 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -45,7 +45,7 @@ inline LPTSTR ErrorMessage(DWORD dw)
sprintf(msgBuf, "Unknown error: %u", dw);
return msgBuf;
}
-
+
}
//============================== Global Variables =============================
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h
index f6d6b7f4b9e..e1cc3050929 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.h
+++ b/src/server/shared/Debugging/WheatyExceptionReport.h
@@ -83,7 +83,7 @@ struct SymbolPair
bool operator<(const SymbolPair& other) const
{
- return _offset < other._offset ||
+ return _offset < other._offset ||
(_offset == other._offset && _type < other._type);
}
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index bc002668b3b..dc9bda62bfb 100644
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -250,13 +250,13 @@ void Log::ReadLoggersFromConfig()
AppenderConsole* appender = new AppenderConsole(NextAppenderId(), "Console", LOG_LEVEL_DEBUG, APPENDER_FLAGS_NONE);
appenders[appender->getId()] = appender;
- Logger& rootLogger = loggers[LOGGER_ROOT];
- rootLogger.Create(LOGGER_ROOT, LOG_LEVEL_ERROR);
- rootLogger.addAppender(appender->getId(), appender);
+ Logger& logger = loggers[LOGGER_ROOT];
+ logger.Create(LOGGER_ROOT, LOG_LEVEL_ERROR);
+ logger.addAppender(appender->getId(), appender);
- Logger& serverLogger = loggers["server"];
- serverLogger.Create("server", LOG_LEVEL_INFO);
- serverLogger.addAppender(appender->getId(), appender);
+ logger = loggers["server"];
+ logger.Create("server", LOG_LEVEL_ERROR);
+ logger.addAppender(appender->getId(), appender);
}
}
@@ -267,7 +267,7 @@ void Log::vlog(std::string const& filter, LogLevel level, char const* str, va_li
write(new LogMessage(level, filter, text));
}
-void Log::write(LogMessage* msg)
+void Log::write(LogMessage* msg) const
{
Logger const* logger = GetLoggerByType(msg->type);
msg->text.append("\n");
@@ -376,7 +376,6 @@ void Log::Close()
delete worker;
worker = NULL;
loggers.clear();
- cachedLoggers.clear();
for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
{
delete it->second;
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 5fa638e2f40..a118e6e8773 100644
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -35,7 +35,6 @@ class Log
friend class ACE_Singleton<Log, ACE_Thread_Mutex>;
typedef std::unordered_map<std::string, Logger> LoggerMap;
- typedef std::unordered_map<std::string, Logger const*> CachedLoggerContainer;
private:
Log();
@@ -44,7 +43,7 @@ class Log
public:
void LoadFromConfig();
void Close();
- bool ShouldLog(std::string const& type, LogLevel level);
+ bool ShouldLog(std::string const& type, LogLevel level) const;
bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
void outMessage(std::string const& f, LogLevel level, char const* str, ...) ATTR_PRINTF(4, 5);
@@ -57,9 +56,9 @@ class Log
private:
static std::string GetTimestampStr();
void vlog(std::string const& f, LogLevel level, char const* str, va_list argptr);
- void write(LogMessage* msg);
+ void write(LogMessage* msg) const;
- Logger const* GetLoggerByType(std::string const& type);
+ Logger const* GetLoggerByType(std::string const& type) const;
Appender* GetAppenderByName(std::string const& name);
uint8 NextAppenderId();
void CreateAppenderFromConfig(std::string const& name);
@@ -69,7 +68,6 @@ class Log
AppenderMap appenders;
LoggerMap loggers;
- CachedLoggerContainer cachedLoggers;
uint8 AppenderId;
std::string m_logsDir;
@@ -78,37 +76,29 @@ class Log
LogWorker* worker;
};
-inline Logger const* Log::GetLoggerByType(std::string const& originalType)
+inline Logger const* Log::GetLoggerByType(std::string const& type) const
{
- // Check if already cached
- CachedLoggerContainer::const_iterator itCached = cachedLoggers.find(originalType);
- if (itCached != cachedLoggers.end())
- return itCached->second;
-
- Logger const* logger = NULL;
- std::string type(originalType);
-
- do
- {
- // Search for the logger "type.subtype"
- LoggerMap::const_iterator it = loggers.find(type);
- if (it == loggers.end())
- {
- // Search for the logger "type", if our logger contains '.', otherwise search for LOGGER_ROOT
- size_t found = type.find_last_of(".");
- type = found != std::string::npos ? type.substr(0, found) : LOGGER_ROOT;
- }
- else
- logger = &(it->second);
- }
- while (!logger);
-
- cachedLoggers[originalType] = logger;
- return logger;
+ LoggerMap::const_iterator it = loggers.find(type);
+ if (it != loggers.end())
+ return &(it->second);
+
+ if (type == LOGGER_ROOT)
+ return NULL;
+
+ std::string parentLogger = LOGGER_ROOT;
+ size_t found = type.find_last_of(".");
+ if (found != std::string::npos)
+ parentLogger = type.substr(0,found);
+
+ return GetLoggerByType(parentLogger);
}
-inline bool Log::ShouldLog(std::string const& type, LogLevel level)
+inline bool Log::ShouldLog(std::string const& type, LogLevel level) const
{
+ // TODO: Use cache to store "Type.sub1.sub2": "Type" equivalence, should
+ // Speed up in cases where requesting "Type.sub1.sub2" but only configured
+ // Logger "Type"
+
Logger const* logger = GetLoggerByType(type);
if (!logger)
return false;
diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp
index b8cb5215665..f446592e922 100644
--- a/src/server/shared/Packets/ByteBuffer.cpp
+++ b/src/server/shared/Packets/ByteBuffer.cpp
@@ -27,11 +27,10 @@ ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos,
size_t size, size_t valueSize)
{
std::ostringstream ss;
- ACE_Stack_Trace trace;
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
- << ")\n\n" << trace.c_str();
+ << ")";
message().assign(ss.str());
}
@@ -40,12 +39,10 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size,
size_t valueSize)
{
std::ostringstream ss;
- ACE_Stack_Trace trace;
ss << "Attempted to put a "
<< (valueSize > 0 ? "NULL-pointer" : "zero-sized value")
- << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n"
- << trace.c_str();
+ << " in ByteBuffer (pos: " << pos << " size: " << size << ")";
message().assign(ss.str());
}
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index bc46b87fa27..11e835566e9 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -31,6 +31,7 @@
#include <vector>
#include <cstring>
#include <time.h>
+#include <math.h>
// Root of ByteBuffer exception hierarchy
class ByteBufferException : public std::exception
@@ -241,12 +242,16 @@ class ByteBuffer
ByteBuffer &operator>>(float &value)
{
value = read<float>();
+ if (!std::isfinite(value))
+ throw ByteBufferException();
return *this;
}
ByteBuffer &operator>>(double &value)
{
value = read<double>();
+ if (!std::isfinite(value))
+ throw ByteBufferException();
return *this;
}
@@ -377,9 +382,19 @@ class ByteBuffer
return *this;
}
- uint8 * contents() { return &_storage[0]; }
+ uint8 * contents()
+ {
+ if (_storage.empty())
+ throw ByteBufferException();
+ return &_storage[0];
+ }
- const uint8 *contents() const { return &_storage[0]; }
+ const uint8 *contents() const
+ {
+ if (_storage.empty())
+ throw ByteBufferException();
+ return &_storage[0];
+ }
size_t size() const { return _storage.size(); }
bool empty() const { return _storage.empty(); }
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index b086a28134c..d6ead607c55 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -26,6 +26,7 @@
#include <string>
#include <vector>
#include <list>
+#include <map>
#include <ace/INET_Addr.h>
// Searcher for map of structs
@@ -565,4 +566,353 @@ bool CompareValues(ComparisionType type, T val1, T val2)
}
}
+class EventMap
+{
+ /**
+ * Internal storage type.
+ * Key: Time as uint32 when the event should occur.
+ * Value: The event data as uint32.
+ *
+ * Structure of event data:
+ * - Bit 0 - 15: Event Id.
+ * - Bit 16 - 23: Group
+ * - Bit 24 - 31: Phase
+ * - Pattern: 0xPPGGEEEE
+ */
+ typedef std::multimap<uint32, uint32> EventStore;
+
+ public:
+ EventMap() : _time(0), _phase(0), _lastEvent(0) { }
+
+ /**
+ * @name Reset
+ * @brief Removes all scheduled events and resets time and phase.
+ */
+ void Reset()
+ {
+ _eventMap.clear();
+ _time = 0;
+ _phase = 0;
+ }
+
+ /**
+ * @name Update
+ * @brief Updates the timer of the event map.
+ * @param time Value to be added to time.
+ */
+ void Update(uint32 time)
+ {
+ _time += time;
+ }
+
+ /**
+ * @name GetTimer
+ * @return Current timer value.
+ */
+ uint32 GetTimer() const
+ {
+ return _time;
+ }
+
+ /**
+ * @name GetPhaseMask
+ * @return Active phases as mask.
+ */
+ uint8 GetPhaseMask() const
+ {
+ return _phase;
+ }
+
+ /**
+ * @name Empty
+ * @return True, if there are no events scheduled.
+ */
+ bool Empty() const
+ {
+ return _eventMap.empty();
+ }
+
+ /**
+ * @name SetPhase
+ * @brief Sets the phase of the map (absolute).
+ * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
+ */
+ void SetPhase(uint8 phase)
+ {
+ if (!phase)
+ _phase = 0;
+ else if (phase <= 8)
+ _phase = (1 << (phase - 1));
+ }
+
+ /**
+ * @name AddPhase
+ * @brief Activates the given phase (bitwise).
+ * @param phase Phase which should be activated. Values: 1 - 8
+ */
+ void AddPhase(uint8 phase)
+ {
+ if (phase && phase <= 8)
+ _phase |= (1 << (phase - 1));
+ }
+
+ /**
+ * @name RemovePhase
+ * @brief Deactivates the given phase (bitwise).
+ * @param phase Phase which should be deactivated. Values: 1 - 8.
+ */
+ void RemovePhase(uint8 phase)
+ {
+ if (phase && phase <= 8)
+ _phase &= ~(1 << (phase - 1));
+ }
+
+ /**
+ * @name ScheduleEvent
+ * @brief Creates new event entry in map.
+ * @param eventId The id of the new event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
+ {
+ if (group && group <= 8)
+ eventId |= (1 << (group + 15));
+
+ if (phase && phase <= 8)
+ eventId |= (1 << (phase + 23));
+
+ _eventMap.insert(EventStore::value_type(_time + time, eventId));
+ }
+
+ /**
+ * @name RescheduleEvent
+ * @brief Cancels the given event and reschedules it.
+ * @param eventId The id of the event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
+ {
+ CancelEvent(eventId);
+ ScheduleEvent(eventId, time, group, phase);
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event.
+ * @param time Time until the event occurs.
+ */
+ void Repeat(uint32 time)
+ {
+ _eventMap.insert(EventStore::value_type(_time + time, _lastEvent));
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event.
+ * @param time Time until the event occurs. Equivalent to Repeat(urand(minTime, maxTime).
+ */
+ void Repeat(uint32 minTime, uint32 maxTime)
+ {
+ Repeat(urand(minTime, maxTime));
+ }
+
+ /**
+ * @name ExecuteEvent
+ * @brief Returns the next event to execute and removes it from map.
+ * @return Id of the event to execute.
+ */
+ uint32 ExecuteEvent()
+ {
+ while (!Empty())
+ {
+ EventStore::iterator itr = _eventMap.begin();
+
+ if (itr->first > _time)
+ return 0;
+ else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
+ _eventMap.erase(itr);
+ else
+ {
+ uint32 eventId = (itr->second & 0x0000FFFF);
+ _lastEvent = itr->second; // include phase/group
+ _eventMap.erase(itr);
+ return eventId;
+ }
+ }
+
+ return 0;
+ }
+
+ /**
+ * @name DelayEvents
+ * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
+ * @param delay Amount of delay.
+ */
+ void DelayEvents(uint32 delay)
+ {
+ _time = delay < _time ? _time - delay : 0;
+ }
+
+ /**
+ * @name DelayEvents
+ * @brief Delay all events of the same group.
+ * @param delay Amount of delay.
+ * @param group Group of the events.
+ */
+ void DelayEvents(uint32 delay, uint32 group)
+ {
+ if (!group || group > 8 || Empty())
+ return;
+
+ EventStore delayed;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (itr->second & (1 << (group + 15)))
+ {
+ delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
+ _eventMap.erase(itr++);
+ }
+ else
+ ++itr;
+ }
+
+ _eventMap.insert(delayed.begin(), delayed.end());
+ }
+
+ /**
+ * @name CancelEvent
+ * @brief Cancels all events of the specified id.
+ * @param eventId Event id to cancel.
+ */
+ void CancelEvent(uint32 eventId)
+ {
+ if (Empty())
+ return;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (eventId == (itr->second & 0x0000FFFF))
+ _eventMap.erase(itr++);
+ else
+ ++itr;
+ }
+ }
+
+ /**
+ * @name CancelEventGroup
+ * @brief Cancel events belonging to specified group.
+ * @param group Group to cancel.
+ */
+ void CancelEventGroup(uint32 group)
+ {
+ if (!group || group > 8 || Empty())
+ return;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (itr->second & (1 << (group + 15)))
+ _eventMap.erase(itr++);
+ else
+ ++itr;
+ }
+ }
+
+ /**
+ * @name GetNextEventTime
+ * @brief Returns closest occurence of specified event.
+ * @param eventId Wanted event id.
+ * @return Time of found event.
+ */
+ uint32 GetNextEventTime(uint32 eventId) const
+ {
+ if (Empty())
+ return 0;
+
+ for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
+ if (eventId == (itr->second & 0x0000FFFF))
+ return itr->first;
+
+ return 0;
+ }
+
+ /**
+ * @name GetNextEventTime
+ * @return Time of next event.
+ */
+ uint32 GetNextEventTime() const
+ {
+ return Empty() ? 0 : _eventMap.begin()->first;
+ }
+
+ /**
+ * @name IsInPhase
+ * @brief Returns wether event map is in specified phase or not.
+ * @param phase Wanted phase.
+ * @return True, if phase of event map contains specified phase.
+ */
+ bool IsInPhase(uint8 phase)
+ {
+ return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
+ }
+
+ /**
+ * @name GetTimeUntilEvent
+ * @brief Returns time in milliseconds until next event.
+ * @param Id of the event.
+ * @return Time of next event.
+ */
+ uint32 GetTimeUntilEvent(uint32 eventId) const
+ {
+ for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
+ if (eventId == (itr->second & 0x0000FFFF))
+ return itr->first - _time;
+
+ return std::numeric_limits<uint32>::max();
+ }
+
+ private:
+ /**
+ * @name _time
+ * @brief Internal timer.
+ *
+ * This does not represent the real date/time value.
+ * It's more like a stopwatch: It can run, it can be stopped,
+ * it can be resetted and so on. Events occur when this timer
+ * has reached their time value. Its value is changed in the
+ * Update method.
+ */
+ uint32 _time;
+
+ /**
+ * @name _phase
+ * @brief Phase mask of the event map.
+ *
+ * Contains the phases the event map is in. Multiple
+ * phases from 1 to 8 can be set with SetPhase or
+ * AddPhase. RemovePhase deactives a phase.
+ */
+ uint8 _phase;
+
+ /**
+ * @name _eventMap
+ * @brief Internal event storage map. Contains the scheduled events.
+ *
+ * See typedef at the beginning of the class for more
+ * details.
+ */
+ EventStore _eventMap;
+
+
+ /**
+ * @name _lastEvent
+ * @brief Stores information on the most recently executed event
+ */
+ uint32 _lastEvent;
+};
+
#endif
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index c5424374f5a..6e4214603cb 100644
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -201,24 +201,24 @@ int Master::Run()
ACE_Based::Thread rarThread(new RARunnable);
#if defined(_WIN32) || defined(__linux__)
-
+
///- Handle affinity for multiple processors and process priority
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
#ifdef _WIN32 // Windows
-
+
HANDLE hProcess = GetCurrentProcess();
-
+
if (affinity > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
-
+
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
-
+
if (!currentAffinity)
TC_LOG_ERROR("server.worldserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff);
else if (SetProcessAffinityMask(hProcess, currentAffinity))
@@ -227,7 +227,7 @@ int Master::Run()
TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x", currentAffinity);
}
}
-
+
if (highPriority)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
@@ -235,9 +235,9 @@ int Master::Run()
else
TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class.");
}
-
+
#else // Linux
-
+
if (affinity > 0)
{
cpu_set_t mask;
@@ -264,7 +264,7 @@ int Master::Run()
else
TC_LOG_INFO("server.worldserver", "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
}
-
+
#endif
#endif
diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp
index 19112d84266..7832cef18de 100644
--- a/src/tools/mmaps_generator/TerrainBuilder.cpp
+++ b/src/tools/mmaps_generator/TerrainBuilder.cpp
@@ -906,7 +906,7 @@ namespace MMAP
float p0[3], p1[3];
uint32 mid, tx, ty;
float size;
- if (sscanf(buf, "%d %d,%d (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
+ if (sscanf(buf, "%u %u,%u (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
&p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size) != 10)
continue;