aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2014-06-23 16:35:54 -0500
committerSubv <subv2112@gmail.com>2014-06-23 16:35:54 -0500
commit0db743c4ff2885ae51319c897158cc8774b41a88 (patch)
tree06b1e7950dac31b879ae7802d40b7493b0c61ec4 /src
parent28b61812cf0d87b84aefaa0889844b6288f93b93 (diff)
parentaa93a975469cca56e35adc1b5b501f4536be61f1 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into boost
Conflicts: src/server/authserver/Server/AuthSession.cpp src/server/game/Server/WorldSession.h src/server/shared/Packets/ByteBuffer.cpp src/server/shared/Utilities/Util.h
Diffstat (limited to 'src')
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp2
-rw-r--r--src/server/authserver/Authentication/AuthCodes.h2
-rw-r--r--src/server/authserver/Server/AuthSession.cpp14
-rw-r--r--src/server/authserver/authserver.conf.dist7
-rw-r--r--src/server/collision/CMakeLists.txt1
-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.cpp10
-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.cpp12
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp56
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp24
-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/Battlegrounds/Zones/BattlegroundIC.cpp3
-rw-r--r--src/server/game/CMakeLists.txt2
-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/DBCEnums.h1
-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/DungeonFinding/LFGScripts.cpp2
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp28
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp15
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp68
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h3
-rw-r--r--src/server/game/Entities/Item/Item.cpp2
-rw-r--r--src/server/game/Entities/Object/Object.cpp5
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp4
-rw-r--r--src/server/game/Entities/Player/Player.cpp165
-rw-r--r--src/server/game/Entities/Player/Player.h30
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp2
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp41
-rw-r--r--src/server/game/Entities/Transport/Transport.h11
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp901
-rw-r--r--src/server/game/Entities/Unit/Unit.h21
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp45
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp26
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.cpp7
-rw-r--r--src/server/game/Groups/Group.cpp2
-rw-r--r--src/server/game/Guilds/Guild.cpp8
-rw-r--r--src/server/game/Handlers/ArenaTeamHandler.cpp6
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp98
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp37
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp2
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp2
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp79
-rw-r--r--src/server/game/Handlers/LootHandler.cpp3
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp16
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp42
-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/Loot/LootMgr.h3
-rw-r--r--src/server/game/Maps/Map.cpp15
-rw-r--r--src/server/game/Maps/MapUpdater.cpp30
-rw-r--r--src/server/game/Miscellaneous/Language.h3
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h13
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp4
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp2
-rw-r--r--src/server/game/Scripting/ScriptLoader.cpp14
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp52
-rw-r--r--src/server/game/Scripting/ScriptMgr.h49
-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.h37
-rw-r--r--src/server/game/Server/WorldSocket.cpp59
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp234
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h12
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp121
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h4
-rw-r--r--src/server/game/Spells/Spell.cpp39
-rw-r--r--src/server/game/Spells/Spell.h2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp44
-rw-r--r--src/server/game/Spells/SpellInfo.cpp19
-rw-r--r--src/server/game/Spells/SpellMgr.cpp27
-rw-r--r--src/server/game/Spells/SpellMgr.h13
-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/game/World/World.cpp4
-rw-r--r--src/server/game/World/World.h2
-rw-r--r--src/server/scripts/CMakeLists.txt2
-rw-r--r--src/server/scripts/Commands/cs_account.cpp11
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp7
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp26
-rw-r--r--src/server/scripts/Custom/CMakeLists.txt3
-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_golemagg.cpp2
-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.cpp15
-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/CMakeLists.txt4
-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/Ahnkahet/instance_ahnkahet.cpp18
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp4
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt1
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp20
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp14
-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.cpp10
-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_deathbringer_saurfang.cpp16
-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/IcecrownCitadel/boss_the_lich_king.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp1
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp1
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp1
-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/Naxxramas/instance_naxxramas.cpp4
-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/Nexus/Oculus/instance_oculus.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp212
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp44
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-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/Ulduar/Ulduar/instance_ulduar.cpp39
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp124
-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.cpp16
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp1
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp9
-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_gurtogg_bloodboil.cpp (renamed from src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp)97
-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/CMakeLists.txt2
-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.cpp99
-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/CMakeLists.txt15
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp315
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp35
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp2
-rw-r--r--src/server/scripts/World/go_scripts.cpp5
-rw-r--r--src/server/scripts/World/guards.cpp10
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp2
-rw-r--r--src/server/scripts/World/npc_innkeeper.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp137
-rw-r--r--src/server/shared/Containers.h28
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h8
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.cpp12
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.h7
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp378
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.h137
-rw-r--r--src/server/shared/Logging/Log.cpp15
-rw-r--r--src/server/shared/Logging/Log.h52
-rw-r--r--src/server/shared/Packets/ByteBuffer.cpp4
-rw-r--r--src/server/shared/Packets/ByteBuffer.h19
-rw-r--r--src/server/shared/Utilities/Util.cpp9
-rw-r--r--src/server/shared/Utilities/Util.h343
-rw-r--r--src/server/worldserver/CMakeLists.txt1
-rw-r--r--src/server/worldserver/Master.cpp18
-rw-r--r--src/server/worldserver/worldserver.conf.dist7
-rw-r--r--src/tools/mmaps_generator/CMakeLists.txt2
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.cpp2
320 files changed, 5233 insertions, 3582 deletions
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/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp
index 304d593fa3d..5b56a99d640 100644
--- a/src/server/authserver/Server/AuthSession.cpp
+++ b/src/server/authserver/Server/AuthSession.cpp
@@ -593,10 +593,22 @@ bool AuthSession::_HandleLogonProof()
GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str());
uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0);
+
+ // We can not include the failed account login hook. However, this is a workaround to still log this.
+ if (sConfigMgr->GetBoolDefault("Additional.IP.Based.Login.Logging", false))
+ {
+ PreparedStatement* logstmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FALP_IP_LOGGING);
+ logstmt->setString(0, _login);
+ logstmt->setString(1, socket().getRemoteAddress());
+ logstmt->setString(2, "Logged on failed AccountLogin due wrong password");
+
+ LoginDatabase.Execute(logstmt);
+ }
+
if (MaxWrongPassCount > 0)
{
//Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS);
stmt->setString(0, _login);
LoginDatabase.Execute(stmt);
diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist
index 83edf9669ac..b7dee9ac08b 100644
--- a/src/server/authserver/authserver.conf.dist
+++ b/src/server/authserver/authserver.conf.dist
@@ -148,6 +148,13 @@ LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth"
LoginDatabase.WorkerThreads = 1
#
+# Wrong.Password.Login.Logging
+# Description: Additionally log attempted wrong password logging
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+Wrong.Password.Login.Logging = 0
+#
###################################################################################################
###################################################################################################
diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt
index a83bb9dad1c..a2024bff7cb 100644
--- a/src/server/collision/CMakeLists.txt
+++ b/src/server/collision/CMakeLists.txt
@@ -34,6 +34,7 @@ include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
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..8032568434f 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;
@@ -182,7 +183,11 @@ void PetAI::UpdateAI(uint32 diff)
}
if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST))
+ {
+ if (!spellUsed)
+ delete spell;
continue; // Pets must only jump to target
+ }
// No enemy, check friendly
if (!spellUsed)
@@ -459,9 +464,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..e36433dd8c0 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)
@@ -944,7 +944,7 @@ class SmartTrigger : public AreaTriggerScript
}
};
-void AddSC_SmartSCripts()
+void AddSC_SmartScripts()
{
new SmartTrigger();
}
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index dff9ddbaf2f..114a48c60ca 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",
@@ -488,9 +488,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CAST:
{
- if (!me)
- break;
-
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
@@ -502,31 +499,36 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
{
- if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
- me->InterruptNonMeleeSpells(false);
-
- if (e.action.cast.flags & SMARTCAST_COMBAT_MOVE)
+ if (me)
{
- // If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed
- // unless target is outside spell range, out of mana, or LOS.
+ if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
+ me->InterruptNonMeleeSpells(false);
+
+ if (e.action.cast.flags & SMARTCAST_COMBAT_MOVE)
+ {
+ // If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed
+ // unless target is outside spell range, out of mana, or LOS.
- bool _allowMove = false;
- SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(e.action.cast.spell);
- int32 mana = me->GetPower(POWER_MANA);
+ bool _allowMove = false;
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(e.action.cast.spell);
+ int32 mana = me->GetPower(POWER_MANA);
- if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) ||
- me->GetDistance(*itr) < spellInfo->GetMinRange(true) ||
- !me->IsWithinLOSInMap(*itr) ||
- mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
+ if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) ||
+ me->GetDistance(*itr) < spellInfo->GetMinRange(true) ||
+ !me->IsWithinLOSInMap(*itr) ||
+ mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
_allowMove = true;
- CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove);
- }
+ CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove);
+ }
- me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
+ me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
+ }
+ else if (go)
+ go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
- TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u",
- me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
+ TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u",
+ GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
@@ -2602,7 +2604,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 +3464,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..ff30fe7ba35 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -21,6 +21,7 @@
#include "DatabaseEnv.h"
#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptMgr.h"
#include "Util.h"
#include "SHA1.h"
#include "WorldSession.h"
@@ -166,10 +167,16 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPass
std::string username;
if (!GetName(accountId, username))
+ {
+ sScriptMgr->OnFailedPasswordChange(accountId);
return AOR_NAME_NOT_EXIST; // account doesn't exist
+ }
if (utf8length(newPassword) > MAX_ACCOUNT_STR)
+ {
+ sScriptMgr->OnFailedPasswordChange(accountId);
return AOR_PASS_TOO_LONG;
+ }
normalizeString(username);
normalizeString(newPassword);
@@ -189,6 +196,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPass
LoginDatabase.Execute(stmt);
+ sScriptMgr->OnPasswordChange(accountId);
return AOR_OK;
}
@@ -197,10 +205,16 @@ AccountOpResult AccountMgr::ChangeEmail(uint32 accountId, std::string newEmail)
std::string username;
if (!GetName(accountId, username))
+ {
+ sScriptMgr->OnFailedEmailChange(accountId);
return AOR_NAME_NOT_EXIST; // account doesn't exist
+ }
if (utf8length(newEmail) > MAX_EMAIL_STR)
+ {
+ sScriptMgr->OnFailedEmailChange(accountId);
return AOR_EMAIL_TOO_LONG;
+ }
normalizeString(username);
normalizeString(newEmail);
@@ -212,6 +226,7 @@ AccountOpResult AccountMgr::ChangeEmail(uint32 accountId, std::string newEmail)
LoginDatabase.Execute(stmt);
+ sScriptMgr->OnEmailChange(accountId);
return AOR_OK;
}
@@ -220,10 +235,16 @@ AccountOpResult AccountMgr::ChangeRegEmail(uint32 accountId, std::string newEmai
std::string username;
if (!GetName(accountId, username))
+ {
+ sScriptMgr->OnFailedEmailChange(accountId);
return AOR_NAME_NOT_EXIST; // account doesn't exist
+ }
if (utf8length(newEmail) > MAX_EMAIL_STR)
+ {
+ sScriptMgr->OnFailedEmailChange(accountId);
return AOR_EMAIL_TOO_LONG;
+ }
normalizeString(username);
normalizeString(newEmail);
@@ -235,6 +256,7 @@ AccountOpResult AccountMgr::ChangeRegEmail(uint32 accountId, std::string newEmai
LoginDatabase.Execute(stmt);
+ sScriptMgr->OnEmailChange(accountId);
return AOR_OK;
}
@@ -517,7 +539,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/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 9e9cc6c63ee..faa71fd2ffa 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -80,12 +80,11 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
if (!player)
return;
- player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
+ (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->AddPassenger(player);
player->m_movementInfo.transport.pos.m_positionX = TransportMovementInfo.GetPositionX();
player->m_movementInfo.transport.pos.m_positionY = TransportMovementInfo.GetPositionY();
player->m_movementInfo.transport.pos.m_positionZ = TransportMovementInfo.GetPositionZ();
- player->m_movementInfo.transport.guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(),
TeleportToTransportPosition.GetPositionY(),
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index bf46c1fd7c6..26fd0814dcb 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -103,7 +103,9 @@ set(game_STAT_SRCS
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast/Include
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/SFMT
${CMAKE_SOURCE_DIR}/dep/zlib
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/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index ec048e167ac..8e186e9d094 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -442,6 +442,7 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_EJECTABLE = 0x00000020, // ejectable
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
+ VEHICLE_SEAT_FLAG_B_KEEP_PET = 0x00020000,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4 = 0x02000000,
VEHICLE_SEAT_FLAG_B_CAN_SWITCH = 0x04000000,
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000 // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
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/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index aadf1529ffd..181e04e04fc 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -46,7 +46,7 @@ void LFGPlayerScript::OnLogout(Player* player)
}
}
-void LFGPlayerScript::OnLogin(Player* player)
+void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index 87881ed7524..1ed37bd9d05 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -36,7 +36,7 @@ class LFGPlayerScript : public PlayerScript
// Player Hooks
void OnLogout(Player* player);
- void OnLogin(Player* player);
+ void OnLogin(Player* player, bool loginFirst);
void OnMapChanged(Player* player);
};
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 36997eb884a..c81ba409495 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))
@@ -567,13 +567,13 @@ void Creature::Update(uint32 diff)
if (!IsInEvadeMode() && (!bInCombat || IsPolymorphed())) // regenerate health if not in combat or if polymorphed
RegenerateHealth();
- if (getPowerType() == POWER_ENERGY)
+ if (HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER))
{
- if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE)
+ if (getPowerType() == POWER_ENERGY)
Regenerate(POWER_ENERGY);
+ else
+ RegenerateMana();
}
- else
- RegenerateMana();
/*if (!bIsPolymorphed) // only increase the timer if not polymorphed
m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
@@ -1173,14 +1173,22 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const*
SetOriginalEntry(entry);
- if (!vehId)
- vehId = cinfo->VehicleId;
-
- Object::_Create(guidlow, entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
+ Object::_Create(guidlow, entry, (vehId || cinfo->VehicleId) ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
if (!UpdateEntry(entry, data))
return false;
+ if (!vehId)
+ {
+ if (GetCreatureTemplate()->VehicleId)
+ {
+ vehId = GetCreatureTemplate()->VehicleId;
+ entry = GetCreatureTemplate()->Entry;
+ }
+ else
+ vehId = cinfo->VehicleId;
+ }
+
if (vehId)
CreateVehicleKit(vehId, entry);
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 7cc94d992a1..e008146bb85 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -48,18 +48,6 @@ DynamicObject::~DynamicObject()
delete _removedAura;
}
-void DynamicObject::CleanupsBeforeDelete(bool finalCleanup /* = true */)
-{
- WorldObject::CleanupsBeforeDelete(finalCleanup);
-
- if (Transport* transport = GetTransport())
- {
- transport->RemovePassenger(this);
- SetTransport(NULL);
- m_movementInfo.transport.Reset();
- }
-}
-
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup and for caster
@@ -124,14 +112,11 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
Transport* transport = caster->GetTransport();
if (transport)
{
- m_movementInfo.transport.guid = GetGUID();
-
float x, y, z, o;
pos.GetPosition(x, y, z, o);
transport->CalculatePassengerOffset(x, y, z, &o);
m_movementInfo.transport.pos.Relocate(x, y, z, o);
- SetTransport(transport);
// This object must be added to transport before adding to map for the client to properly display it
transport->AddPassenger(this);
}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index f52c86afdee..c9fd1d29f8b 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -41,8 +41,6 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ
void AddToWorld();
void RemoveFromWorld();
- void CleanupsBeforeDelete(bool finalCleanup = true) override;
-
bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
void Update(uint32 p_time);
void Remove();
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 40488df9ef3..ae08a4251a5 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -98,20 +98,12 @@ std::string GameObject::GetAIName() const
return "";
}
-void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
+void GameObject::CleanupsBeforeDelete(bool finalCleanup)
{
- if (IsInWorld())
- RemoveFromWorld();
+ WorldObject::CleanupsBeforeDelete(finalCleanup);
if (m_uint32Values) // field array can be not exist if GameOBject not loaded
RemoveFromOwner();
-
- if (GetTransport() && !ToTransport())
- {
- GetTransport()->RemovePassenger(this);
- SetTransport(NULL);
- m_movementInfo.transport.Reset();
- }
}
void GameObject::RemoveFromOwner()
@@ -561,7 +553,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)
@@ -696,12 +688,39 @@ void GameObject::getFishLoot(Loot* fishloot, Player* loot_owner)
fishloot->clear();
uint32 zone, subzone;
+ uint32 defaultzone = 1;
+ GetZoneAndAreaId(zone, subzone);
+
+ // if subzone loot exist use it
+ fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true);
+ if (fishloot->empty()) //use this becase if zone or subzone has set LOOT_MODE_JUNK_FISH,Even if no normal drop, fishloot->FillLoot return true. it wrong.
+ {
+ //subzone no result,use zone loot
+ fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true);
+ //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
+ if (fishloot->empty())
+ fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true);
+ }
+}
+
+void GameObject::getFishLootJunk(Loot* fishloot, Player* loot_owner)
+{
+ fishloot->clear();
+
+ uint32 zone, subzone;
+ uint32 defaultzone = 1;
GetZoneAndAreaId(zone, subzone);
// if subzone loot exist use it
- if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true))
- // else use zone loot (must exist in like case)
- fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true);
+ fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
+ if (fishloot->empty()) //use this becase if zone or subzone has normal mask drop, then fishloot->FillLoot return true.
+ {
+ //use zone loot
+ fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
+ if (fishloot->empty())
+ //use zone 1 as default
+ fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
+ }
}
void GameObject::SaveToDB()
@@ -1100,7 +1119,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 +1423,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);
@@ -1415,10 +1435,8 @@ void GameObject::Use(Unit* user)
else
player->SendLoot(GetGUID(), LOOT_FISHING);
}
- /// @todo else: junk
- else
- m_respawnTime = time(NULL);
-
+ else // else: junk
+ player->SendLoot(GetGUID(), LOOT_FISHING_JUNK);
break;
}
case GO_JUST_DEACTIVATED: // nothing to do, will be deleted at next update
@@ -1729,7 +1747,7 @@ void GameObject::Use(Unit* user)
CastSpell(user, spellId);
}
-void GameObject::CastSpell(Unit* target, uint32 spellId)
+void GameObject::CastSpell(Unit* target, uint32 spellId, bool triggered /*= true*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -1748,7 +1766,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
if (self)
{
if (target)
- target->CastSpell(target, spellInfo, true);
+ target->CastSpell(target, spellInfo, triggered);
return;
}
@@ -1762,14 +1780,14 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
trigger->setFaction(owner->getFaction());
// needed for GO casts for proper target validation checks
trigger->SetOwnerGUID(owner->GetGUID());
- trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
+ trigger->CastSpell(target ? target : trigger, spellInfo, triggered, 0, 0, owner->GetGUID());
}
else
{
trigger->setFaction(14);
// Set owner guid for target if no owner available - needed by trigger auras
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
- trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : 0);
+ trigger->CastSpell(target ? target : trigger, spellInfo, triggered, 0, 0, target ? target->GetGUID() : 0);
}
}
@@ -2013,6 +2031,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/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index a99c5db93aa..8f70fc0e907 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -713,6 +713,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
void Refresh();
void Delete();
void getFishLoot(Loot* loot, Player* loot_owner);
+ void getFishLootJunk(Loot* loot, Player* loot_owner);
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
@@ -790,7 +791,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
GameObject* LookupFishingHoleAround(float range);
- void CastSpell(Unit* target, uint32 spell);
+ void CastSpell(Unit* target, uint32 spell, bool triggered = true);
void SendCustomAnim(uint32 anim);
bool IsInRange(float x, float y, float z, float radius) const;
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/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index f2215fa2d6d..4ff0153dea8 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1163,6 +1163,9 @@ void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
{
if (IsInWorld())
RemoveFromWorld();
+
+ if (Transport* transport = GetTransport())
+ transport->RemovePassenger(this);
}
void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
@@ -1215,7 +1218,7 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
float sizefactor = GetObjectSize() + obj->GetObjectSize();
float maxdist = dist2compare + sizefactor;
- if (m_transport && obj->GetTransport() && obj->GetTransport()->GetGUIDLow() == m_transport->GetGUIDLow())
+ if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUIDLow() == GetTransport()->GetGUIDLow())
{
float dtx = m_movementInfo.transport.pos.m_positionX - obj->m_movementInfo.transport.pos.m_positionX;
float dty = m_movementInfo.transport.pos.m_positionY - obj->m_movementInfo.transport.pos.m_positionY;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index eb4e2fcf2ee..cc199969174 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
@@ -1916,6 +1916,8 @@ bool Pet::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint3
if (!InitEntry(Entry))
return false;
+ // Force regen flag for player pets, just like we do for players themselves
+ SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
SetSheath(SHEATH_STATE_MELEE);
return true;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e7d14d68377..9733c0f2b52 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();
@@ -2127,11 +2131,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
TC_LOG_DEBUG("maps", "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid);
- if (GetTransport())
+ if (Transport* transport = GetTransport())
{
- m_transport->RemovePassenger(this);
- m_transport = NULL;
- m_movementInfo.transport.Reset();
+ transport->RemovePassenger(this);
RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :)
}
@@ -2149,16 +2151,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
SetUnitMovementFlags(GetUnitMovementFlags() & MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE);
DisableSpline();
- if (m_transport)
+ if (Transport* transport = GetTransport())
{
if (options & TELE_TO_NOT_LEAVE_TRANSPORT)
AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
else
- {
- m_transport->RemovePassenger(this);
- m_transport = NULL;
- m_movementInfo.transport.Reset();
- }
+ transport->RemovePassenger(this);
}
// The player was ported to another map and loses the duel immediately.
@@ -2293,8 +2291,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// send transfer packets
WorldPacket data(SMSG_TRANSFER_PENDING, 4 + 4 + 4);
data << uint32(mapid);
- if (m_transport)
- data << m_transport->GetEntry() << GetMapId();
+ if (Transport* transport = GetTransport())
+ data << transport->GetEntry() << GetMapId();
GetSession()->SendPacket(&data);
}
@@ -2312,7 +2310,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
WorldPacket data(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4);
data << uint32(mapid);
- if (m_transport)
+ if (GetTransport())
data << m_movementInfo.transport.pos.PositionXYZOStream();
else
data << m_teleport_dest.PositionXYZOStream();
@@ -5936,32 +5934,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);
@@ -6430,7 +6429,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
if (newVal < currVal)
UpdateSkillEnchantments(id, currVal, newVal);
// update step
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_PAIR32(id, step));
+ SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), MAKE_PAIR32(id, step));
// update value
SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_SKILL_VALUE(newVal, maxVal));
if (itr->second.uState != SKILL_NEW)
@@ -6755,6 +6754,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);
@@ -7474,10 +7482,24 @@ void Player::UpdateArea(uint32 newArea)
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
pvpInfo.IsInNoPvPArea = true;
- CombatStopWithPets();
+ if (!duel)
+ CombatStopWithPets();
}
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 +7585,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 +8222,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);
+ }
}
}
@@ -8756,7 +8784,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
- if (!go || (loot_type != LOOT_FISHINGHOLE && (loot_type != LOOT_FISHING || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this, INTERACTION_DISTANCE)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault()))
+ if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this, INTERACTION_DISTANCE)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault()))
{
SendLootRelease(guid);
return;
@@ -8794,6 +8822,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (loot_type == LOOT_FISHING)
go->getFishLoot(loot, this);
+ else if (loot_type == LOOT_FISHING_JUNK)
+ go->getFishLootJunk(loot, this);
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.groupLootRules)
{
@@ -9036,6 +9066,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
{
case LOOT_INSIGNIA: loot_type = LOOT_SKINNING; break;
case LOOT_FISHINGHOLE: loot_type = LOOT_FISHING; break;
+ case LOOT_FISHING_JUNK: loot_type = LOOT_FISHING; break;
default: break;
}
@@ -16350,12 +16381,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 +16400,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 +16416,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;
@@ -17367,15 +17395,15 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
uint64 transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_MO_TRANSPORT);
+ Transport* transport = NULL;
if (GameObject* go = HashMapHolder<GameObject>::Find(transGUID))
- m_transport = go->ToTransport();
+ transport = go->ToTransport();
- if (m_transport)
+ if (transport)
{
- m_movementInfo.transport.guid = transGUID;
float x = fields[26].GetFloat(), y = fields[27].GetFloat(), z = fields[28].GetFloat(), o = fields[29].GetFloat();
m_movementInfo.transport.pos.Relocate(x, y, z, o);
- m_transport->CalculatePassengerPosition(x, y, z, &o);
+ transport->CalculatePassengerPosition(x, y, z, &o);
if (!Trinity::IsValidMapCoord(x, y, z, o) ||
// transport size limited
@@ -17386,7 +17414,6 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
guid, x, y, z, o);
- m_transport = NULL;
m_movementInfo.transport.Reset();
RelocateToHomebind();
@@ -17394,10 +17421,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
else
{
Relocate(x, y, z, o);
- mapId = m_transport->GetMapId();
+ mapId = transport->GetMapId();
- m_transport->AddPassenger(this);
- AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ transport->AddPassenger(this);
}
}
else
@@ -22645,7 +22671,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 +23951,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());
@@ -24950,7 +24976,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
base_skill = 1; // skill mast be known and then > 0 in any case
if (GetPureSkillValue(SKILL_FIRST_AID) < base_skill)
- SetSkill(SKILL_FIRST_AID, 0, base_skill, base_skill);
+ SetSkill(SKILL_FIRST_AID, 4 /*artisan*/, base_skill, 300);
if (GetPureSkillValue(SKILL_AXES) < base_skill)
SetSkill(SKILL_AXES, 0, base_skill, base_skill);
if (GetPureSkillValue(SKILL_DEFENSE) < base_skill)
@@ -26726,3 +26752,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..fdebbde0ae2 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
{
@@ -915,7 +918,7 @@ class PlayerTaxi
bool SetTaximaskNode(uint32 nodeidx)
{
uint8 field = uint8((nodeidx - 1) / 32);
- uint32 submask = 1 << ((nodeidx-1) % 32);
+ uint32 submask = 1 << ((nodeidx - 1) % 32);
if ((m_taximask[field] & submask) != submask)
{
m_taximask[field] |= submask;
@@ -948,7 +951,7 @@ class PlayerTaxi
std::deque<uint32> m_TaxiDestinations;
};
-std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
+std::ostringstream& operator << (std::ostringstream& ss, PlayerTaxi const& taxi);
class Player;
@@ -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;
@@ -2627,8 +2635,8 @@ class Player : public Unit, public GridObject<Player>
uint32 _activeCheats;
};
-void AddItemsSetItem(Player*player, Item* item);
-void RemoveItemsSetItem(Player*player, ItemTemplate const* proto);
+void AddItemsSetItem(Player* player, Item* item);
+void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
// "the bodies of template functions must be made available in a header file"
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
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/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 8bc07732bb6..d907274f8d1 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -35,7 +35,7 @@
Transport::Transport() : GameObject(),
_transportInfo(NULL), _isMoving(true), _pendingStop(false),
- _triggeredArrivalEvent(false), _triggeredDepartureEvent(false)
+ _triggeredArrivalEvent(false), _triggeredDepartureEvent(false), _passengerTeleportItr(_passengers.begin())
{
m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION;
}
@@ -107,9 +107,6 @@ void Transport::CleanupsBeforeDelete(bool finalCleanup /*= true*/)
while (!_passengers.empty())
{
WorldObject* obj = *_passengers.begin();
- obj->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
- obj->m_movementInfo.transport.Reset();
- obj->SetTransport(NULL);
RemovePassenger(obj);
}
@@ -231,6 +228,9 @@ void Transport::AddPassenger(WorldObject* passenger)
if (_passengers.insert(passenger).second)
{
+ passenger->SetTransport(this);
+ passenger->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ passenger->m_movementInfo.transport.guid = GetGUID();
TC_LOG_DEBUG("entities.transport", "Object %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str());
if (Player* plr = passenger->ToPlayer())
@@ -240,8 +240,27 @@ void Transport::AddPassenger(WorldObject* passenger)
void Transport::RemovePassenger(WorldObject* passenger)
{
- if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) // static passenger can remove itself in case of grid unload
+ bool erased = false;
+ if (_passengerTeleportItr != _passengers.end())
{
+ PassengerSet::iterator itr = _passengers.find(passenger);
+ if (itr != _passengers.end())
+ {
+ if (itr == _passengerTeleportItr)
+ ++_passengerTeleportItr;
+
+ _passengers.erase(itr);
+ erased = true;
+ }
+ }
+ else
+ erased = _passengers.erase(passenger) > 0;
+
+ if (erased || _staticPassengers.erase(passenger)) // static passenger can remove itself in case of grid unload
+ {
+ passenger->SetTransport(NULL);
+ passenger->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ passenger->m_movementInfo.transport.Reset();
TC_LOG_DEBUG("entities.transport", "Object %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str());
if (Player* plr = passenger->ToPlayer())
@@ -570,9 +589,9 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
GetMap()->RemoveFromMap<Transport>(this, false);
SetMap(newMap);
- for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end();)
+ for (_passengerTeleportItr = _passengers.begin(); _passengerTeleportItr != _passengers.end();)
{
- WorldObject* obj = (*itr++);
+ WorldObject* obj = (*_passengerTeleportItr++);
float destX, destY, destZ, destO;
obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
@@ -595,7 +614,7 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
}
case TYPEID_PLAYER:
if (!obj->ToPlayer()->TeleportTo(newMapid, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
- _passengers.erase(obj);
+ RemovePassenger(obj);
break;
case TYPEID_DYNAMICOBJECT:
obj->AddObjectToRemoveList();
@@ -613,7 +632,7 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
else
{
// Teleport players, they need to know it
- for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
+ for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER)
{
@@ -630,9 +649,9 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
}
}
-void Transport::UpdatePassengerPositions(std::set<WorldObject*>& passengers)
+void Transport::UpdatePassengerPositions(PassengerSet& passengers)
{
- for (std::set<WorldObject*>::iterator itr = passengers.begin(); itr != passengers.end(); ++itr)
+ for (PassengerSet::iterator itr = passengers.begin(); itr != passengers.end(); ++itr)
{
WorldObject* passenger = *itr;
// transport teleported but passenger not yet (can happen for players)
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 293d4334a2e..e644417f1ac 100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -31,6 +31,8 @@ class Transport : public GameObject, public TransportBase
Transport();
public:
+ typedef std::set<WorldObject*> PassengerSet;
+
~Transport();
bool Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress);
@@ -42,7 +44,7 @@ class Transport : public GameObject, public TransportBase
void AddPassenger(WorldObject* passenger);
void RemovePassenger(WorldObject* passenger);
- std::set<WorldObject*> const& GetPassengers() const { return _passengers; }
+ PassengerSet const& GetPassengers() const { return _passengers; }
Creature* CreateNPCPassenger(uint32 guid, CreatureData const* data);
GameObject* CreateGOPassenger(uint32 guid, GameObjectData const* data);
@@ -99,7 +101,7 @@ class Transport : public GameObject, public TransportBase
void MoveToNextWaypoint();
float CalculateSegmentPos(float perc);
bool TeleportTransport(uint32 newMapid, float x, float y, float z, float o);
- void UpdatePassengerPositions(std::set<WorldObject*>& passengers);
+ void UpdatePassengerPositions(PassengerSet& passengers);
void DoEventIfAny(KeyFrame const& node, bool departure);
//! Helpers to know if stop frame was reached
@@ -118,8 +120,9 @@ class Transport : public GameObject, public TransportBase
bool _triggeredArrivalEvent;
bool _triggeredDepartureEvent;
- std::set<WorldObject*> _passengers;
- std::set<WorldObject*> _staticPassengers;
+ PassengerSet _passengers;
+ PassengerSet::iterator _passengerTeleportItr;
+ PassengerSet _staticPassengers;
};
#endif
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 00172face5f..492197db64e 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);
}
}
@@ -3346,7 +3352,7 @@ void Unit::_ApplyAuraEffect(Aura* aura, uint8 effIndex)
AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID());
ASSERT(aurApp);
if (!aurApp->GetEffectMask())
- _ApplyAura(aurApp, 1<<effIndex);
+ _ApplyAura(aurApp, 1 << effIndex);
else
aurApp->_HandleEffect(effIndex, true);
}
@@ -3379,11 +3385,12 @@ 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)
{
- if (effMask & 1<<i && (!aurApp->GetRemoveMode()))
+ if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
aurApp->_HandleEffect(i, true);
}
}
@@ -3496,6 +3503,19 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
if (spellProto->IsPassiveStackableWithRanks())
return;
+ if (!IsHighestExclusiveAura(aura))
+ {
+ if (!aura->GetSpellInfo()->IsAffectingArea())
+ {
+ Unit* caster = aura->GetCaster();
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
+ Spell::SendCastResult(caster->ToPlayer(), aura->GetSpellInfo(), 1, SPELL_FAILED_AURA_BOUNCED);
+ }
+
+ RemoveAura(aura);
+ return;
+ }
+
bool remove = false;
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
{
@@ -3825,6 +3845,8 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except,
{
Aura* aura = (*iter)->GetBase();
AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID());
+ if (!aurApp)
+ continue;
++iter;
if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
@@ -6029,11 +6051,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 34299;
if (triggeredByAura->GetCasterGUID() != GetGUID())
break;
- int32 basepoints1 = triggerAmount * 2;
+ int32 basepoints1 = CalculatePct(GetMaxPower(Powers(POWER_MANA)), triggerAmount * 2);
// Improved Leader of the Pack
// Check cooldown of heal spell cooldown
if (GetTypeId() == TYPEID_PLAYER && !ToPlayer()->HasSpellCooldown(34299))
- CastCustomSpell(this, 60889, &basepoints1, 0, 0, true, 0, triggeredByAura);
+ CastCustomSpell(this, 68285, &basepoints1, 0, 0, true, 0, triggeredByAura);
break;
}
// Healing Touch (Dreamwalker Raiment set)
@@ -8153,23 +8175,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);
-
- // dunno if it's really needed but will prevent any possible crashes
- if (!item)
- return false;
+ averageDmg = (GetFloatValue(UNIT_FIELD_MINDAMAGE) + GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
- 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)
@@ -8647,25 +8660,30 @@ void Unit::setPowerType(Powers new_powertype)
}
}
+ float powerMultiplier = 1.0f;
+ if (!IsPet())
+ if (Creature* creature = ToCreature())
+ powerMultiplier = creature->GetCreatureTemplate()->ModMana;
+
switch (new_powertype)
{
default:
case POWER_MANA:
break;
case POWER_RAGE:
- SetMaxPower(POWER_RAGE, GetCreatePowers(POWER_RAGE));
+ SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
SetPower(POWER_RAGE, 0);
break;
case POWER_FOCUS:
- SetMaxPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
- SetPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
+ SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
+ SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
break;
case POWER_ENERGY:
- SetMaxPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
+ SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
break;
case POWER_HAPPINESS:
- SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
- SetPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
+ SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
+ SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
break;
}
}
@@ -9842,49 +9860,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 +10034,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 +10091,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 +10256,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 +10278,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 +10298,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)
@@ -10282,53 +10317,60 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
case 2109:
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
{
- if (GetTypeId() != TYPEID_PLAYER)
- continue;
- float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
+ // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
+ // is 22.5% critical strike damage reduction, or 444 resilience.
+ // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
+ float mod = -1.0f * GetMeleeCritDamageReduction(400);
AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
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());
-
- // 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;
+ int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
- // Default calculation
- if (TakenAdvertisedBenefit)
- {
- if (!bonus || coeff < 0)
- coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
+ // 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;
- 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;
@@ -10402,16 +10444,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)
@@ -10427,7 +10474,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:
@@ -10459,17 +10506,21 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
{
if (!((*i)->IsAffectedOnSpell(spellProto)))
continue;
- int32 modChance = 0;
+
switch ((*i)->GetMiscValue())
{
- // Shatter
- case 911: modChance+= 16;
- case 910: modChance+= 17;
- case 849: modChance+= 17;
- if (!victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
- break;
- crit_chance+=modChance;
+ case 911: // Shatter (Rank 1)
+ if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
+ crit_chance += 17;
break;
+ case 910: // Shatter (Rank 2)
+ if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
+ crit_chance += 34;
+ break;
+ case 849: // Shatter (Rank 3)
+ if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
+ crit_chance += 50;
+ break;
case 7917: // Glyph of Shadowburn
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
crit_chance+=(*i)->GetAmount();
@@ -10489,7 +10540,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
case SPELLFAMILY_MAGE:
// Glyph of Fire Blast
if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
- if (victim->HasAuraWithMechanic((1<<MECHANIC_STUN) | (1<<MECHANIC_KNOCKOUT)))
+ if (victim->HasAuraWithMechanic((1 << MECHANIC_STUN) | (1 << MECHANIC_KNOCKOUT)))
if (AuraEffect const* aurEff = GetAuraEffect(56369, EFFECT_0))
crit_chance += aurEff->GetAmount();
break;
@@ -10510,7 +10561,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
crit_chance += aurEff->GetAmount();
break;
}
- break;
+ break;
case SPELLFAMILY_ROGUE:
// Shiv-applied poisons can't crit
if (FindCurrentSpellBySpellId(5938))
@@ -10529,20 +10580,20 @@ 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;
+ break;
case SPELLFAMILY_SHAMAN:
// Lava Burst
if (spellProto->SpellFamilyFlags[1] & 0x00001000)
{
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;
+ break;
}
}
break;
@@ -10563,17 +10614,17 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
crit_chance += rendAndTear->GetAmount();
break;
}
- break;
+ break;
case SPELLFAMILY_WARRIOR:
- // Victory Rush
- if (spellProto->SpellFamilyFlags[1] & 0x100)
- {
- // Glyph of Victory Rush
- if (AuraEffect const* aurEff = GetAuraEffect(58382, 0))
- crit_chance += aurEff->GetAmount();
- break;
- }
- break;
+ // Victory Rush
+ if (spellProto->SpellFamilyFlags[1] & 0x100)
+ {
+ // Glyph of Victory Rush
+ if (AuraEffect const* aurEff = GetAuraEffect(58382, 0))
+ crit_chance += aurEff->GetAmount();
+ break;
+ }
+ break;
}
}
/// Intentional fallback. Calculate critical strike chance for both Ranged and Melee spells
@@ -10587,17 +10638,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)
@@ -10681,14 +10729,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);
@@ -10703,43 +10745,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;
}
@@ -10812,8 +10817,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);
@@ -10821,6 +10826,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;
@@ -11107,8 +11183,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;
}
@@ -11177,7 +11252,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)
@@ -11360,9 +11435,10 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
case 2109:
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
{
- if (GetTypeId() != TYPEID_PLAYER)
- continue;
- float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
+ // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
+ // is 22.5% critical strike damage reduction, or 444 resilience.
+ // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
+ float mod = -1.0f * GetMeleeCritDamageReduction(400);
AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
@@ -12831,19 +12907,24 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
return std::max(duration, 0);
}
-void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell)
+void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell* spell)
{
- if (!spellProto || castTime < 0)
+ if (!spellInfo || castTime < 0)
return;
+
+ if (spellInfo->IsChanneled() && !(spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION))
+ return;
+
// called from caster
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
+ modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
- if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && ((GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
+ if (!((spellInfo->Attributes & (SPELL_ATTR0_ABILITY | SPELL_ATTR0_TRADESPELL)) || (spellInfo->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)) &&
+ ((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
- else if (spellProto->Attributes & SPELL_ATTR0_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG))
+ else if (spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO && !(spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG))
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
- else if (spellProto->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
+ else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
castTime = 500;
}
@@ -12988,21 +13069,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)
@@ -13513,12 +13579,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
{
CleanupBeforeRemoveFromMap(finalCleanup);
- if (GetTransport())
- {
- GetTransport()->RemovePassenger(this);
- SetTransport(NULL);
- m_movementInfo.transport.Reset();
- }
+ WorldObject::CleanupsBeforeDelete(finalCleanup);
}
void Unit::UpdateCharmAI()
@@ -15248,8 +15309,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;
@@ -17042,12 +17103,14 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
bool turn = (GetOrientation() != orientation);
bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
+ // TODO: Check if orientation transport offset changed instead of only global orientation
if (turn)
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
if (relocated)
{
- RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
+ if (!GetVehicle())
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
// move and update visible state if need
if (GetTypeId() == TYPEID_PLAYER)
@@ -17703,3 +17766,73 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c
data << uint32(itr->second);
}
}
+
+int32 Unit::GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const* aurEff, AuraType auraType, bool checkMiscValue /*= false*/, int32 miscValue /*= 0*/) const
+{
+ int32 val = 0;
+ SpellSpellGroupMapBounds spellGroup = sSpellMgr->GetSpellSpellGroupMapBounds(aurEff->GetSpellInfo()->GetFirstRankSpell()->Id);
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
+ {
+ if (sSpellMgr->GetSpellGroupStackRule(itr->second) == SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT)
+ {
+ AuraEffectList const& auraEffList = GetAuraEffectsByType(auraType);
+ for (AuraEffectList::const_iterator auraItr = auraEffList.begin(); auraItr != auraEffList.end(); ++auraItr)
+ {
+ if (aurEff != (*auraItr) && (!checkMiscValue || (*auraItr)->GetMiscValue() == miscValue) &&
+ sSpellMgr->IsSpellMemberOfSpellGroup((*auraItr)->GetSpellInfo()->Id, itr->second))
+ {
+ // absolute value only
+ if (abs(val) < abs((*auraItr)->GetAmount()))
+ val = (*auraItr)->GetAmount();
+ }
+ }
+ }
+ }
+ return val;
+}
+
+bool Unit::IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications /*= false*/)
+{
+ for (uint32 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (AuraEffect const* aurEff = aura->GetEffect(i))
+ {
+ AuraType const auraType = AuraType(aura->GetSpellInfo()->Effects[i].ApplyAuraName);
+ AuraEffectList const& auras = GetAuraEffectsByType(auraType);
+ for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end();)
+ {
+ AuraEffect const* existingAurEff = (*itr);
+ ++itr;
+
+ if (sSpellMgr->CheckSpellGroupStackRules(aura->GetSpellInfo(), existingAurEff->GetSpellInfo())
+ == SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST)
+ {
+ int32 diff = abs(aurEff->GetAmount()) - abs(existingAurEff->GetAmount());
+ if (!diff)
+ diff = int32(aura->GetEffectMask()) - int32(existingAurEff->GetBase()->GetEffectMask());
+
+ if (diff > 0)
+ {
+ Aura const* base = existingAurEff->GetBase();
+ // no removing of area auras from the original owner, as that completely cancels them
+ if (removeOtherAuraApplications && (!base->IsArea() || base->GetOwner() != this))
+ {
+ if (AuraApplication* aurApp = existingAurEff->GetBase()->GetApplicationOfTarget(GetGUID()))
+ {
+ bool hasMoreThanOneEffect = base->HasMoreThanOneEffectForType(auraType);
+ uint32 removedAuras = m_removedAurasCount;
+ RemoveAura(aurApp);
+ if (hasMoreThanOneEffect || m_removedAurasCount > removedAuras + 1)
+ itr = auras.begin();
+ }
+ }
+ }
+ else if (diff < 0)
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 9926403f7af..535d75af204 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1289,7 +1289,7 @@ class Unit : public WorldObject
void RemoveFromWorld();
void CleanupBeforeRemoveFromMap(bool finalCleanup);
- void CleanupsBeforeDelete(bool finalCleanup = true); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
+ void CleanupsBeforeDelete(bool finalCleanup = true) override; // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
DiminishingLevels GetDiminishing(DiminishingGroup group);
void IncrDiminishing(DiminishingGroup group);
@@ -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; }
@@ -2155,6 +2155,9 @@ class Unit : public WorldObject
time_t GetLastDamagedTime() const { return _lastDamagedTime; }
void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
+ int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const* aurEff, AuraType auraType, bool checkMiscValue = false, int32 miscValue = 0) const;
+ bool IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications = false);
+
protected:
explicit Unit (bool isWorldObject);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index fae4f0c6b6a..915e6016e22 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -76,41 +76,12 @@ Vehicle::~Vehicle()
void Vehicle::Install()
{
- if (Creature* creature = _me->ToCreature())
+ if (_me->GetTypeId() == TYPEID_UNIT)
{
- 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 (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(_vehicleInfo->m_powerDisplayId))
+ _me->setPowerType(Powers(powerDisplay->PowerType));
+ else if (_me->getClass() == CLASS_ROGUE)
+ _me->setPowerType(POWER_ENERGY);
}
_status = STATUS_INSTALLED;
@@ -808,6 +779,8 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
Passenger->InterruptNonMeleeSpells(false);
Passenger->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ VehicleSeatEntry const* veSeat = Seat->second.SeatInfo;
+
Player* player = Passenger->ToPlayer();
if (player)
{
@@ -818,14 +791,14 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
player->StopCastingCharm();
player->StopCastingBindSight();
player->SendOnCancelExpectedVehicleRideAura();
- player->UnsummonPetTemporaryIfAny();
+ if (!(veSeat->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET))
+ player->UnsummonPetTemporaryIfAny();
}
if (Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE)
Passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Passenger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
- VehicleSeatEntry const* veSeat = Seat->second.SeatInfo;
Passenger->m_movementInfo.transport.pos.Relocate(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
Passenger->m_movementInfo.transport.time = 0;
Passenger->m_movementInfo.transport.seat = Seat->first;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 1b2a68b2d4e..db97ea270ef 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2951,32 +2951,32 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
{
Field* fields = result->Fetch();
- uint32 uiEntry = fields[0].GetUInt32();
- uint32 uiAccessory = fields[1].GetUInt32();
- int8 uiSeat = int8(fields[2].GetInt8());
- bool bMinion = fields[3].GetBool();
- uint8 uiSummonType = fields[4].GetUInt8();
- uint32 uiSummonTimer= fields[5].GetUInt32();
+ uint32 entry = fields[0].GetUInt32();
+ uint32 accessory = fields[1].GetUInt32();
+ int8 seatId = fields[2].GetInt8();
+ bool isMinion = fields[3].GetBool();
+ uint8 summonType = fields[4].GetUInt8();
+ uint32 summonTimer = fields[5].GetUInt32();
- if (!sObjectMgr->GetCreatureTemplate(uiEntry))
+ if (!sObjectMgr->GetCreatureTemplate(entry))
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", entry);
continue;
}
- if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
+ if (!sObjectMgr->GetCreatureTemplate(accessory))
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", accessory);
continue;
}
- if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end())
+ if (_spellClickInfoStore.find(entry) == _spellClickInfoStore.end())
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", entry);
continue;
}
- _vehicleTemplateAccessoryStore[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer));
+ _vehicleTemplateAccessoryStore[entry].push_back(VehicleAccessory(accessory, seatId, isMinion, summonType, summonTimer));
++count;
}
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 472497ea5f2..270d598d53a 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -35,7 +35,8 @@ void VisibleNotifier::SendToSelf()
// at this moment i_clientGUIDs have guids that not iterate at grid level checks
// but exist one case when this possible and object not out of range: transports
if (Transport* transport = i_player.GetTransport())
- for (std::set<WorldObject*>::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end();++itr)
+ {
+ for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
{
if (vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
{
@@ -54,11 +55,15 @@ void VisibleNotifier::SendToSelf()
case TYPEID_UNIT:
i_player.UpdateVisibilityOf((*itr)->ToCreature(), i_data, i_visibleNow);
break;
+ case TYPEID_DYNAMICOBJECT:
+ i_player.UpdateVisibilityOf((*itr)->ToDynObject(), i_data, i_visibleNow);
+ break;
default:
break;
}
}
}
+ }
for (Player::ClientGUIDs::const_iterator it = vis_guids.begin();it != vis_guids.end(); ++it)
{
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 113df993f81..45ecbf0c3df 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -1572,7 +1572,7 @@ void Group::UpdatePlayerOutOfRange(Player* player)
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
member = itr->GetSource();
- if (member && !member->IsWithinDist(player, member->GetSightRange(), false))
+ if (member && member != player && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(), false)))
member->GetSession()->SendPacket(&data);
}
}
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/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index 632bd02def0..3bb3edac500 100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -121,6 +121,12 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
return;
}
+ if (GetPlayer()->GetArenaTeamId(arenaTeam->GetSlot()) != arenaTeamId)
+ {
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
+ return;
+ }
+
// OK result but don't send invite
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
return;
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 45d4d221d06..dd654fb3ad0 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -235,41 +235,76 @@ 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
{
+ // client limits the amount of players to be invited to 100
+ const uint32 MaxPlayerInvites = 100;
+
uint32 inviteCount;
- recvData >> inviteCount;
+ uint64 invitee[MaxPlayerInvites];
+ uint8 status[MaxPlayerInvites];
+ uint8 rank[MaxPlayerInvites];
+
+ memset(invitee, 0, sizeof(invitee));
+ memset(status, 0, sizeof(status));
+ memset(rank, 0, sizeof(rank));
- for (uint32 i = 0; i < inviteCount; ++i)
+ try
{
- uint64 invitee = 0;
- uint8 status = 0;
- uint8 rank = 0;
- recvData.readPackGUID(invitee);
- recvData >> status >> rank;
+ recvData >> inviteCount;
+
+ for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
+ {
+ recvData.readPackGUID(invitee[i]);
+ recvData >> status[i] >> rank[i];
+ }
+ }
+ catch (ByteBufferException const&)
+ {
+ delete calendarEvent;
+ calendarEvent = NULL;
+ throw;
+ }
+ SQLTransaction trans;
+ if (inviteCount > 1)
+ trans = CharacterDatabase.BeginTransaction();
+
+ for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
+ {
// 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[i], guid, 946684800, CalendarInviteStatus(status[i]), CalendarModerationRank(rank[i]), "");
+ 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 +329,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 +379,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..c2f93190a05 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);
@@ -699,10 +696,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
+ // Initiating
+ uint32 initAccountId = GetAccountId();
// can't delete loaded character
if (ObjectAccessor::FindPlayer(guid))
+ {
+ sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
return;
+ }
uint32 accountId = 0;
uint8 level = 0;
@@ -711,6 +713,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
// is guild leader
if (sGuildMgr->GetGuildByLeader(guid))
{
+ sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
@@ -720,6 +723,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
// is arena team captain
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
+ sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
@@ -738,12 +742,18 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
}
// prevent deleting other players' characters using cheating tools
- if (accountId != GetAccountId())
+ if (accountId != initAccountId)
+ {
+ sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
return;
+ }
std::string IP_str = GetRemoteAddress();
TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
- sScriptMgr->OnPlayerDelete(guid);
+
+ // To prevent hook failure, place hook before removing reference from DB
+ sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete.
+ // Shouldn't interfere with character deletion though
if (sLog->ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
@@ -758,15 +768,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;
}
@@ -1005,7 +1014,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendNotification(LANG_RESET_TALENTS);
}
- if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
+ bool firstLogin = pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST);
+ if (firstLogin)
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
// show time before shutdown if shutdown planned.
@@ -1030,7 +1040,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
// Handle Login-Achievements (should be handled after loading)
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ON_LOGIN, 1);
- sScriptMgr->OnPlayerLogin(pCurrChar);
+ sScriptMgr->OnPlayerLogin(pCurrChar, firstLogin);
+
delete holder;
}
@@ -1168,7 +1179,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 +1436,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 +1690,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/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index eae95d20610..97867e2f352 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -638,8 +638,6 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
recvData >> apply;
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_ASSISTANT);
-
- group->SendUpdate();
}
void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index c4b4b35bf37..60966ace011 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;
@@ -1424,6 +1443,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
return;
}
+ // Don't try to refund item currently being disenchanted
+ if (_player->GetLootGUID() == guid)
+ return;
+
GetPlayer()->RefundItem(item);
}
@@ -1454,3 +1477,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/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index f92c6e08e31..61f0b9afce2 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -338,7 +338,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
}
else
{
- if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db)
+ // Only delete item if no loot or money (unlooted loot is saved to db) or if it isn't an openable item
+ if (pItem->loot.isLooted() || !(proto->Flags & ITEM_PROTO_FLAG_OPENABLE))
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
}
return; // item can be looted only single player
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 40830d63d05..baa20f76a40 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;
@@ -506,10 +501,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);
}
@@ -794,10 +788,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..6fedc481a14 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -30,6 +30,7 @@
#include "WaypointMovementGenerator.h"
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
+#include "Vehicle.h"
#define MOVEMENT_PACKET_TIME_DELAY 0
@@ -284,7 +285,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
}
/* handle special cases */
- if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
+ if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
// transports size limited
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
@@ -307,27 +308,15 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
if (!plrMover->GetTransport())
{
if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))
- {
- plrMover->m_transport = transport;
transport->AddPassenger(plrMover);
- }
}
else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)
{
- bool foundNewTransport = false;
- plrMover->m_transport->RemovePassenger(plrMover);
+ plrMover->GetTransport()->RemovePassenger(plrMover);
if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))
- {
- foundNewTransport = true;
- plrMover->m_transport = transport;
transport->AddPassenger(plrMover);
- }
-
- if (!foundNewTransport)
- {
- plrMover->m_transport = NULL;
+ else
movementInfo.transport.Reset();
- }
}
}
@@ -335,13 +324,12 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
- movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
+ movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
}
else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave
{
- plrMover->m_transport->RemovePassenger(plrMover);
- plrMover->m_transport = NULL;
+ plrMover->GetTransport()->RemovePassenger(plrMover);
movementInfo.transport.Reset();
}
@@ -370,10 +358,20 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
mover->m_movementInfo = movementInfo;
- // this is almost never true (not sure why it is sometimes, but it is), normally use mover->IsVehicle()
- if (mover->GetVehicle())
+ // Some vehicles allow the passenger to turn by himself
+ if (Vehicle* vehicle = mover->GetVehicle())
{
- mover->SetOrientation(movementInfo.pos.GetOrientation());
+ if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover))
+ {
+ if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING)
+ {
+ if (movementInfo.pos.GetOrientation() != mover->GetOrientation())
+ {
+ mover->SetOrientation(movementInfo.pos.GetOrientation());
+ mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
+ }
+ }
+ }
return;
}
@@ -496,7 +494,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/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index ed0f3b9717b..9be745e622d 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -86,7 +86,8 @@ enum LootType
LOOT_MILLING = 8,
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
- LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead
+ LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
+ LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
};
// type of Loot Item in Loot View
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 96c784cc9d9..bdf42a26320 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2506,15 +2506,9 @@ void Map::SendInitSelf(Player* player)
// build other passengers at transport also (they always visible and marked as visible and will not send at visibility update at add to map
if (Transport* transport = player->GetTransport())
- {
- for (std::set<WorldObject*>::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
- {
+ for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
if (player != (*itr) && player->HaveAtClient(*itr))
- {
(*itr)->BuildCreateUpdateBlockForPlayer(&data, player);
- }
- }
- }
WorldPacket packet;
data.BuildPacket(&packet);
@@ -2854,10 +2848,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 c2d8123c2d2..2a6b810fcef 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -26,34 +26,6 @@
#include "DatabaseEnv.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:
@@ -86,7 +58,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..3a680e30217 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -1224,6 +1224,9 @@ enum TrinityStrings
LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD = 11006,
LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007,
+ LANG_NPCINFO_INHABIT_TYPE = 11008,
+ LANG_NPCINFO_FLAGS_EXTRA = 11009
+
// 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..9967b59ecec 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -41,7 +41,8 @@ enum LootModes
LOOT_MODE_HARD_MODE_1 = 0x2,
LOOT_MODE_HARD_MODE_2 = 0x4,
LOOT_MODE_HARD_MODE_3 = 0x8,
- LOOT_MODE_HARD_MODE_4 = 0x10
+ LOOT_MODE_HARD_MODE_4 = 0x10,
+ LOOT_MODE_JUNK_FISH = 0x8000
};
enum Expansions
@@ -396,7 +397,7 @@ enum SpellAttr3
SPELL_ATTR3_MAIN_HAND = 0x00000400, // 10 Main hand weapon required
SPELL_ATTR3_BATTLEGROUND = 0x00000800, // 11 Can only be cast in battleground
SPELL_ATTR3_ONLY_TARGET_GHOSTS = 0x00001000, // 12
- SPELL_ATTR3_UNK13 = 0x00002000, // 13
+ SPELL_ATTR3_DONT_DISPLAY_CHANNEL_BAR = 0x00002000, // 13 Clientside attribute - will not display channeling bar
SPELL_ATTR3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag
SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag
SPELL_ATTR3_CANT_TRIGGER_PROC = 0x00010000, // 16 confirmed with many patchnotes
@@ -427,7 +428,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 +534,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.
@@ -543,7 +544,7 @@ enum SpellAttr7
SPELL_ATTR7_UNK13 = 0x00002000, // 13 Not set in 3.2.2a.
SPELL_ATTR7_UNK14 = 0x00004000, // 14 Only 52150 (Raise Dead - Pet) spell.
SPELL_ATTR7_UNK15 = 0x00008000, // 15 Exorcism. Usable on players? 100% crit chance on undead and demons?
- SPELL_ATTR7_UNK16 = 0x00010000, // 16 Druid spells (29166, 54833, 64372, 68285).
+ SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER = 0x00010000, // 16 These spells can replenish a powertype, which is not the current powertype.
SPELL_ATTR7_UNK17 = 0x00020000, // 17 Only 27965 (Suicide) spell.
SPELL_ATTR7_HAS_CHARGE_EFFECT = 0x00040000, // 18 Only spells that have Charge among effects.
SPELL_ATTR7_ZONE_TELEPORT = 0x00080000, // 19 Teleports to specific zones.
@@ -1129,7 +1130,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/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index c181750a414..246d4682739 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -191,6 +191,10 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
}
else
{
+ // Set home position at place on waypoint movement.
+ if (!creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || !creature->GetTransGUID())
+ creature->SetHomePosition(creature->GetPosition());
+
if (creature->IsStopped())
Stop(STOP_TIME_FOR_PLAYER);
else if (creature->movespline->Finalized())
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/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 7365d592a62..f1359b70aa6 100644
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptLoader.h"
+#include "World.h"
//examples
void AddSC_example_creature();
@@ -41,7 +42,7 @@ void AddSC_item_spell_scripts();
void AddSC_example_spell_scripts();
void AddSC_holiday_spell_scripts();
-void AddSC_SmartSCripts();
+void AddSC_SmartScripts();
//Commands
void AddSC_account_commandscript();
@@ -97,6 +98,7 @@ void AddSC_npc_innkeeper();
void AddSC_npcs_special();
void AddSC_npc_taxi();
void AddSC_achievement_scripts();
+void AddSC_action_ip_logger();
//eastern kingdoms
void AddSC_alterac_valley(); //Alterac Valley
@@ -469,7 +471,6 @@ void AddSC_boss_xt002();
void AddSC_boss_kologarn();
void AddSC_boss_assembly_of_iron();
void AddSC_boss_general_vezax();
-void AddSC_ulduar_teleporter();
void AddSC_boss_mimiron();
void AddSC_boss_hodir();
void AddSC_boss_freya();
@@ -696,6 +697,7 @@ void AddSC_outdoorpvp_zm();
// player
void AddSC_chat_log();
+void AddSC_action_ip_logger();
#endif
@@ -703,7 +705,7 @@ void AddScripts()
{
AddExampleScripts();
AddSpellScripts();
- AddSC_SmartSCripts();
+ AddSC_SmartScripts();
AddCommandScripts();
#ifdef SCRIPTS
AddWorldScripts();
@@ -804,7 +806,10 @@ void AddWorldScripts()
AddSC_npcs_special();
AddSC_npc_taxi();
AddSC_achievement_scripts();
- AddSC_chat_log();
+ AddSC_chat_log(); // location: scripts\World\chat_log.cpp
+ // To avoid duplicate code, we check once /*ONLY*/ if logging is permitted or not.
+ if (sWorld->getBoolConfig(CONFIG_IP_BASED_ACTION_LOGGING))
+ AddSC_action_ip_logger(); // location: scripts\World\action_ip_logger.cpp
#endif
}
@@ -1309,7 +1314,6 @@ void AddNorthrendScripts()
AddSC_boss_general_vezax();
AddSC_boss_assembly_of_iron();
AddSC_boss_kologarn();
- AddSC_ulduar_teleporter();
AddSC_boss_mimiron();
AddSC_boss_hodir();
AddSC_boss_freya();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 94cf1047dfb..83f401d4e79 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -224,6 +224,7 @@ void ScriptMgr::Unload()
SCR_CLEAR(TransportScript);
SCR_CLEAR(AchievementCriteriaScript);
SCR_CLEAR(PlayerScript);
+ SCR_CLEAR(AccountScript);
SCR_CLEAR(GuildScript);
SCR_CLEAR(GroupScript);
SCR_CLEAR(UnitScript);
@@ -1242,9 +1243,9 @@ void ScriptMgr::OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck)
FOREACH_SCRIPT(PlayerScript)->OnSpellCast(player, spell, skipCheck);
}
-void ScriptMgr::OnPlayerLogin(Player* player)
+void ScriptMgr::OnPlayerLogin(Player* player, bool firstLogin)
{
- FOREACH_SCRIPT(PlayerScript)->OnLogin(player);
+ FOREACH_SCRIPT(PlayerScript)->OnLogin(player, firstLogin);
}
void ScriptMgr::OnPlayerLogout(Player* player)
@@ -1257,9 +1258,14 @@ void ScriptMgr::OnPlayerCreate(Player* player)
FOREACH_SCRIPT(PlayerScript)->OnCreate(player);
}
-void ScriptMgr::OnPlayerDelete(uint64 guid)
+void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId)
{
- FOREACH_SCRIPT(PlayerScript)->OnDelete(guid);
+ FOREACH_SCRIPT(PlayerScript)->OnDelete(guid, accountId);
+}
+
+void ScriptMgr::OnPlayerFailedDelete(uint64 guid, uint32 accountId)
+{
+ FOREACH_SCRIPT(PlayerScript)->OnFailedDelete(guid, accountId);
}
void ScriptMgr::OnPlayerSave(Player* player)
@@ -1277,6 +1283,37 @@ void ScriptMgr::OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newAre
FOREACH_SCRIPT(PlayerScript)->OnUpdateZone(player, newZone, newArea);
}
+// Account
+void ScriptMgr::OnAccountLogin(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnAccountLogin(accountId);
+}
+
+void ScriptMgr::OnFailedAccountLogin(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnFailedAccountLogin(accountId);
+}
+
+void ScriptMgr::OnEmailChange(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnEmailChange(accountId);
+}
+
+void ScriptMgr::OnFailedEmailChange(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnFailedEmailChange(accountId);
+}
+
+void ScriptMgr::OnPasswordChange(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnPasswordChange(accountId);
+}
+
+void ScriptMgr::OnFailedPasswordChange(uint32 accountId)
+{
+ FOREACH_SCRIPT(AccountScript)->OnFailedPasswordChange(accountId);
+}
+
// Guild
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
{
@@ -1539,6 +1576,12 @@ PlayerScript::PlayerScript(const char* name)
ScriptRegistry<PlayerScript>::AddScript(this);
}
+AccountScript::AccountScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry<AccountScript>::AddScript(this);
+}
+
GuildScript::GuildScript(const char* name)
: ScriptObject(name)
{
@@ -1581,6 +1624,7 @@ template class ScriptRegistry<PlayerScript>;
template class ScriptRegistry<GuildScript>;
template class ScriptRegistry<GroupScript>;
template class ScriptRegistry<UnitScript>;
+template class ScriptRegistry<AccountScript>;
// Undefine utility macros.
#undef GET_SCRIPT_RET
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index bc84192eca9..e31a8ec1328 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -29,6 +29,7 @@
#include "World.h"
#include "Weather.h"
+class AccountMgr;
class AuctionHouseObject;
class AuraScript;
class Battleground;
@@ -744,7 +745,7 @@ class PlayerScript : public UnitScript
virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { }
// Called when a player logs in.
- virtual void OnLogin(Player* /*player*/) { }
+ virtual void OnLogin(Player* /*player*/, bool /*firstLogin*/) { }
// Called when a player logs out.
virtual void OnLogout(Player* /*player*/) { }
@@ -753,7 +754,10 @@ class PlayerScript : public UnitScript
virtual void OnCreate(Player* /*player*/) { }
// Called when a player is deleted.
- virtual void OnDelete(uint64 /*guid*/) { }
+ virtual void OnDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
+
+ // Called when a player delete failed
+ virtual void OnFailedDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
// Called when a player is about to be saved.
virtual void OnSave(Player* /*player*/) { }
@@ -768,6 +772,33 @@ class PlayerScript : public UnitScript
virtual void OnMapChanged(Player* /*player*/) { }
};
+class AccountScript : public ScriptObject
+{
+ protected:
+
+ AccountScript(const char* name);
+
+ public:
+
+ // Called when an account logged in succesfully
+ virtual void OnAccountLogin(uint32 accountId) {}
+
+ // Called when an account login failed
+ virtual void OnFailedAccountLogin(uint32 accountId) {}
+
+ // Called when Email is successfully changed for Account
+ virtual void OnEmailChange(uint32 accountId) {}
+
+ // Called when Email failed to change for Account
+ virtual void OnFailedEmailChange(uint32 accountId) {}
+
+ // Called when Password is successfully changed for Account
+ virtual void OnPasswordChange(uint32 accountId) {}
+
+ // Called when Password failed to change for Account
+ virtual void OnFailedPasswordChange(uint32 accountId) {}
+};
+
class GuildScript : public ScriptObject
{
protected:
@@ -1034,14 +1065,24 @@ class ScriptMgr
void OnPlayerEmote(Player* player, uint32 emote);
void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid);
void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck);
- void OnPlayerLogin(Player* player);
+ void OnPlayerLogin(Player* player, bool firstLogin);
void OnPlayerLogout(Player* player);
void OnPlayerCreate(Player* player);
- void OnPlayerDelete(uint64 guid);
+ void OnPlayerDelete(uint64 guid, uint32 accountId);
+ void OnPlayerFailedDelete(uint64 guid, uint32 accountId);
void OnPlayerSave(Player* player);
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
+ public: /* AccountScript */
+
+ void OnAccountLogin(uint32 accountId);
+ void OnFailedAccountLogin(uint32 accountId);
+ void OnEmailChange(uint32 accountId);
+ void OnFailedEmailChange(uint32 accountId);
+ void OnPasswordChange(uint32 accountId);
+ void OnFailedPasswordChange(uint32 accountId);
+
public: /* GuildScript */
void OnGuildAddMember(Guild* guild, Player* player, uint8& plRank);
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..9f8b3785e92 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,28 @@ 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()))
+ uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode());
+
+ // Return true if there no limit for the opcode
+ if (!maxPacketCounterAllowed)
return true;
- // 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());
+ PacketCounter& packetCounter = _PacketThrottlingMap[p.GetOpcode()];
+ if (packetCounter.lastReceiveTime != time)
+ {
+ packetCounter.lastReceiveTime = time;
+ packetCounter.amountCounter = 0;
+ }
+
+ // Check if player is flooding some packets
+ if (++packetCounter.amountCounter <= maxPacketCounterAllowed)
+ return 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);
switch (_policy)
{
@@ -1272,3 +1294,238 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const
return true;
}
}
+
+
+uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) const
+{
+ uint32 maxPacketCounterAllowed;
+ switch (opcode)
+ {
+ // CPU usage sending 2000 packets/second on a 3.70 GHz 4 cores on Win x64
+ // [% CPU mysqld] [%CPU worldserver RelWithDebInfo]
+ case CMSG_PLAYER_LOGIN: // 0 0.5
+ case CMSG_NAME_QUERY: // 0 1
+ case CMSG_PET_NAME_QUERY: // 0 1
+ case CMSG_NPC_TEXT_QUERY: // 0 1
+ case CMSG_ATTACKSTOP: // 0 1
+ case CMSG_QUERY_QUESTS_COMPLETED: // 0 1
+ case CMSG_QUERY_TIME: // 0 1
+ case CMSG_CORPSE_MAP_POSITION_QUERY: // 0 1
+ case CMSG_MOVE_TIME_SKIPPED: // 0 1
+ case MSG_QUERY_NEXT_MAIL_TIME: // 0 1
+ case CMSG_SETSHEATHED: // 0 1
+ case MSG_RAID_TARGET_UPDATE: // 0 1
+ case CMSG_PLAYER_LOGOUT: // 0 1
+ case CMSG_LOGOUT_REQUEST: // 0 1
+ case CMSG_PET_RENAME: // 0 1
+ case CMSG_QUESTGIVER_CANCEL: // 0 1
+ case CMSG_QUESTGIVER_REQUEST_REWARD: // 0 1
+ case CMSG_COMPLETE_CINEMATIC: // 0 1
+ case CMSG_BANKER_ACTIVATE: // 0 1
+ case CMSG_BUY_BANK_SLOT: // 0 1
+ case CMSG_OPT_OUT_OF_LOOT: // 0 1
+ case CMSG_DUEL_ACCEPTED: // 0 1
+ case CMSG_DUEL_CANCELLED: // 0 1
+ case CMSG_CALENDAR_COMPLAIN: // 0 1
+ case CMSG_QUEST_QUERY: // 0 1.5
+ case CMSG_ITEM_QUERY_SINGLE: // 0 1.5
+ case CMSG_ITEM_NAME_QUERY: // 0 1.5
+ case CMSG_GAMEOBJECT_QUERY: // 0 1.5
+ case CMSG_CREATURE_QUERY: // 0 1.5
+ case CMSG_QUESTGIVER_STATUS_QUERY: // 0 1.5
+ case CMSG_GUILD_QUERY: // 0 1.5
+ case CMSG_ARENA_TEAM_QUERY: // 0 1.5
+ case CMSG_TAXINODE_STATUS_QUERY: // 0 1.5
+ case CMSG_TAXIQUERYAVAILABLENODES: // 0 1.5
+ case CMSG_QUESTGIVER_QUERY_QUEST: // 0 1.5
+ case CMSG_PAGE_TEXT_QUERY: // 0 1.5
+ case MSG_QUERY_GUILD_BANK_TEXT: // 0 1.5
+ case MSG_CORPSE_QUERY: // 0 1.5
+ case MSG_MOVE_SET_FACING: // 0 1.5
+ case CMSG_REQUEST_PARTY_MEMBER_STATS: // 0 1.5
+ case CMSG_QUESTGIVER_COMPLETE_QUEST: // 0 1.5
+ case CMSG_SET_ACTION_BUTTON: // 0 1.5
+ case CMSG_RESET_INSTANCES: // 0 1.5
+ case CMSG_HEARTH_AND_RESURRECT: // 0 1.5
+ case CMSG_TOGGLE_PVP: // 0 1.5
+ case CMSG_PET_ABANDON: // 0 1.5
+ case CMSG_ACTIVATETAXIEXPRESS: // 0 1.5
+ case CMSG_ACTIVATETAXI: // 0 1.5
+ case CMSG_SELF_RES: // 0 1.5
+ case CMSG_UNLEARN_SKILL: // 0 1.5
+ case CMSG_EQUIPMENT_SET_SAVE: // 0 1.5
+ case CMSG_DELETEEQUIPMENT_SET: // 0 1.5
+ case CMSG_DISMISS_CRITTER: // 0 1.5
+ case CMSG_REPOP_REQUEST: // 0 1.5
+ case CMSG_GROUP_INVITE: // 0 1.5
+ case CMSG_GROUP_DECLINE: // 0 1.5
+ case CMSG_GROUP_ACCEPT: // 0 1.5
+ case CMSG_GROUP_UNINVITE_GUID: // 0 1.5
+ case CMSG_GROUP_UNINVITE: // 0 1.5
+ case CMSG_GROUP_DISBAND: // 0 1.5
+ case CMSG_BATTLEMASTER_JOIN_ARENA: // 0 1.5
+ case CMSG_LEAVE_BATTLEFIELD: // 0 1.5
+ case MSG_GUILD_BANK_LOG_QUERY: // 0 2
+ case CMSG_LOGOUT_CANCEL: // 0 2
+ case CMSG_REALM_SPLIT: // 0 2
+ case CMSG_ALTER_APPEARANCE: // 0 2
+ case CMSG_QUEST_CONFIRM_ACCEPT: // 0 2
+ case MSG_GUILD_EVENT_LOG_QUERY: // 0 2.5
+ case CMSG_READY_FOR_ACCOUNT_DATA_TIMES: // 0 2.5
+ case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY: // 0 2.5
+ case CMSG_BEGIN_TRADE: // 0 2.5
+ case CMSG_INITIATE_TRADE: // 0 3
+ case CMSG_MESSAGECHAT: // 0 3.5
+ case CMSG_INSPECT: // 0 3.5
+ case CMSG_AREA_SPIRIT_HEALER_QUERY: // not profiled
+ {
+ // "0" is a magic number meaning there's no limit for the opcode.
+ // All the opcodes above must cause little CPU usage and no sync/async database queries at all
+ maxPacketCounterAllowed = 0;
+ break;
+ }
+
+ case CMSG_QUESTGIVER_ACCEPT_QUEST: // 0 4
+ case CMSG_QUESTLOG_REMOVE_QUEST: // 0 4
+ case CMSG_QUESTGIVER_CHOOSE_REWARD: // 0 4
+ case CMSG_CONTACT_LIST: // 0 5
+ case CMSG_LEARN_PREVIEW_TALENTS: // 0 6
+ case CMSG_AUTOBANK_ITEM: // 0 6
+ case CMSG_AUTOSTORE_BANK_ITEM: // 0 6
+ case CMSG_WHO: // 0 7
+ case CMSG_PLAYER_VEHICLE_ENTER: // 0 8
+ case CMSG_LEARN_PREVIEW_TALENTS_PET: // not profiled
+ case MSG_MOVE_HEARTBEAT:
+ {
+ maxPacketCounterAllowed = 200;
+ break;
+ }
+
+ case CMSG_GUILD_SET_PUBLIC_NOTE: // 1 2 1 async db query
+ case CMSG_GUILD_SET_OFFICER_NOTE: // 1 2 1 async db query
+ case CMSG_SET_CONTACT_NOTES: // 1 2.5 1 async db query
+ case CMSG_CALENDAR_GET_CALENDAR: // 0 1.5 medium upload bandwidth usage
+ case CMSG_GUILD_BANK_QUERY_TAB: // 0 3.5 medium upload bandwidth usage
+ case CMSG_QUERY_INSPECT_ACHIEVEMENTS: // 0 13 high upload bandwidth usage
+ {
+ maxPacketCounterAllowed = 50;
+ break;
+ }
+
+ case CMSG_QUEST_POI_QUERY: // 0 25 very high upload bandwidth usage
+ {
+ maxPacketCounterAllowed = MAX_QUEST_LOG_SIZE;
+ break;
+ }
+
+ case CMSG_GM_REPORT_LAG: // 1 3 1 async db query
+ case CMSG_SPELLCLICK: // not profiled
+ case CMSG_GAMEOBJ_USE: // not profiled
+ case CMSG_GAMEOBJ_REPORT_USE: // not profiled
+ case CMSG_REMOVE_GLYPH: // not profiled
+ {
+ maxPacketCounterAllowed = 20;
+ break;
+ }
+
+ case CMSG_PETITION_SIGN: // 9 4 2 sync 1 async db queries
+ case CMSG_TURN_IN_PETITION: // 8 5.5 2 sync db query
+ case CMSG_GROUP_CHANGE_SUB_GROUP: // 6 5 1 sync 1 async db queries
+ case CMSG_PETITION_QUERY: // 4 3.5 1 sync db query
+ case CMSG_CHAR_RACE_CHANGE: // 5 4 1 sync db query
+ case CMSG_CHAR_CUSTOMIZE: // 5 5 1 sync db query
+ case CMSG_CHAR_FACTION_CHANGE: // 5 5 1 sync db query
+ case CMSG_CHAR_DELETE: // 4 4 1 sync db query
+ case CMSG_DEL_FRIEND: // 7 5 1 async db query
+ case CMSG_ADD_FRIEND: // 6 4 1 async db query
+ case CMSG_CHAR_RENAME: // 5 3 1 async db query
+ case CMSG_GMSURVEY_SUBMIT: // 2 3 1 async db query
+ case CMSG_BUG: // 1 1 1 async db query
+ case CMSG_GROUP_SET_LEADER: // 1 2 1 async db query
+ case CMSG_GROUP_RAID_CONVERT: // 1 5 1 async db query
+ case CMSG_GROUP_ASSISTANT_LEADER: // 1 2 1 async db query
+ case CMSG_CALENDAR_ADD_EVENT: // 21 10 2 async db query
+ case CMSG_PETITION_BUY: // not profiled 1 sync 1 async db queries
+ case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE: // not profiled
+ case CMSG_REQUEST_VEHICLE_PREV_SEAT: // not profiled
+ case CMSG_REQUEST_VEHICLE_NEXT_SEAT: // not profiled
+ case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: // not profiled
+ case CMSG_DISMISS_CONTROLLED_VEHICLE: // not profiled
+ case CMSG_REQUEST_VEHICLE_EXIT: // not profiled
+ case CMSG_CONTROLLER_EJECT_PASSENGER: // not profiled
+ case CMSG_ITEM_REFUND: // not profiled
+ case CMSG_SOCKET_GEMS: // not profiled
+ case CMSG_WRAP_ITEM: // not profiled
+ case CMSG_REPORT_PVP_AFK: // not profiled
+ {
+ maxPacketCounterAllowed = 10;
+ break;
+ }
+
+ case CMSG_CHAR_CREATE: // 7 5 3 async db queries
+ case CMSG_CHAR_ENUM: // 22 3 2 async db queries
+ case CMSG_GMTICKET_CREATE: // 1 25 1 async db query
+ case CMSG_GMTICKET_UPDATETEXT: // 0 15 1 async db query
+ case CMSG_GMTICKET_DELETETICKET: // 1 25 1 async db query
+ case CMSG_GMRESPONSE_RESOLVE: // 1 25 1 async db query
+ case CMSG_CALENDAR_UPDATE_EVENT: // not profiled
+ case CMSG_CALENDAR_REMOVE_EVENT: // not profiled
+ case CMSG_CALENDAR_COPY_EVENT: // not profiled
+ case CMSG_CALENDAR_EVENT_INVITE: // not profiled
+ case CMSG_CALENDAR_EVENT_SIGNUP: // not profiled
+ case CMSG_CALENDAR_EVENT_RSVP: // not profiled
+ case CMSG_CALENDAR_EVENT_REMOVE_INVITE: // not profiled
+ case CMSG_CALENDAR_EVENT_MODERATOR_STATUS: // not profiled
+ case CMSG_ARENA_TEAM_INVITE: // not profiled
+ case CMSG_ARENA_TEAM_ACCEPT: // not profiled
+ case CMSG_ARENA_TEAM_DECLINE: // not profiled
+ case CMSG_ARENA_TEAM_LEAVE: // not profiled
+ case CMSG_ARENA_TEAM_DISBAND: // not profiled
+ case CMSG_ARENA_TEAM_REMOVE: // not profiled
+ case CMSG_ARENA_TEAM_LEADER: // not profiled
+ case CMSG_LOOT_METHOD: // not profiled
+ case CMSG_GUILD_INVITE: // not profiled
+ case CMSG_GUILD_ACCEPT: // not profiled
+ case CMSG_GUILD_DECLINE: // not profiled
+ case CMSG_GUILD_LEAVE: // not profiled
+ case CMSG_GUILD_DISBAND: // not profiled
+ case CMSG_GUILD_LEADER: // not profiled
+ case CMSG_GUILD_MOTD: // not profiled
+ case CMSG_GUILD_RANK: // not profiled
+ case CMSG_GUILD_ADD_RANK: // not profiled
+ case CMSG_GUILD_DEL_RANK: // not profiled
+ case CMSG_GUILD_INFO_TEXT: // not profiled
+ case CMSG_GUILD_BANK_DEPOSIT_MONEY: // not profiled
+ case CMSG_GUILD_BANK_WITHDRAW_MONEY: // not profiled
+ case CMSG_GUILD_BANK_BUY_TAB: // not profiled
+ case CMSG_GUILD_BANK_UPDATE_TAB: // not profiled
+ case CMSG_SET_GUILD_BANK_TEXT: // not profiled
+ case MSG_SAVE_GUILD_EMBLEM: // not profiled
+ case MSG_PETITION_RENAME: // not profiled
+ case MSG_PETITION_DECLINE: // not profiled
+ case MSG_TALENT_WIPE_CONFIRM: // not profiled
+ case MSG_SET_DUNGEON_DIFFICULTY: // not profiled
+ case MSG_SET_RAID_DIFFICULTY: // not profiled
+ case MSG_RANDOM_ROLL: // not profiled
+ case MSG_PARTY_ASSIGNMENT: // not profiled
+ case MSG_RAID_READY_CHECK: // not profiled
+ {
+ maxPacketCounterAllowed = 3;
+ break;
+ }
+
+ case CMSG_ITEM_REFUND_INFO: // not profiled
+ {
+ 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 5929726642c..099a270e886 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,8 +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;
- void AllowOpcode(uint16 opcode, bool allow) { _isOpcodeAllowed[opcode] = allow; }
+ bool EvaluateOpcode(WorldPacket& p, time_t time) const;
protected:
enum Policy
{
@@ -939,21 +945,15 @@ class WorldSession
POLICY_BAN,
};
- bool IsOpcodeAllowed(uint16 opcode) const
- {
- OpcodeStatusMap::const_iterator itr = _isOpcodeAllowed.find(opcode);
- if (itr == _isOpcodeAllowed.end())
- return true; // No presence in the map indicates this is the first time the opcode was sent this session, so allow
-
- 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 +963,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);
@@ -977,10 +979,11 @@ class WorldSession
// characters who failed on Player::BuildEnumData shouldn't login
std::set<uint32> _legitCharacters;
- uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
+ uint32 m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set)
Player* _player;
WorldSocket* m_Socket;
- std::string m_Address;
+ std::string m_Address; // Current Remote Address
+ // std::string m_LAddress; // Last Attempted Remote Adress - we can not set attempted ip for a non-existing session!
AccountTypes _security;
uint32 _accountId;
@@ -1008,8 +1011,10 @@ class WorldSession
uint32 recruiterId;
bool isRecruiter;
LockedQueue<WorldPacket*> _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/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 605b863bfa1..d35ee80099d 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -263,7 +263,7 @@ int WorldSocket::open (void *a)
return 0;
}
-int WorldSocket::close (u_long)
+int WorldSocket::close(u_long)
{
shutdown();
@@ -274,7 +274,7 @@ int WorldSocket::close (u_long)
return 0;
}
-int WorldSocket::handle_input (ACE_HANDLE)
+int WorldSocket::handle_input(ACE_HANDLE)
{
if (closing_)
return -1;
@@ -310,7 +310,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
ACE_NOTREACHED(return -1);
}
-int WorldSocket::handle_output (ACE_HANDLE)
+int WorldSocket::handle_output(ACE_HANDLE)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
@@ -356,7 +356,7 @@ int WorldSocket::handle_output (ACE_HANDLE)
ACE_NOTREACHED (return 0);
}
-int WorldSocket::handle_output_queue (GuardType& g)
+int WorldSocket::handle_output_queue(GuardType& g)
{
if (msg_queue()->is_empty())
return cancel_wakeup_output(g);
@@ -417,7 +417,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
ACE_NOTREACHED(return -1);
}
-int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask)
+int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
{
// Critical section
{
@@ -617,7 +617,7 @@ int WorldSocket::handle_input_missing_data (void)
return size_t(n) == recv_size ? 1 : 2;
}
-int WorldSocket::cancel_wakeup_output (GuardType& g)
+int WorldSocket::cancel_wakeup_output(GuardType& g)
{
if (!m_OutActive)
return 0;
@@ -637,7 +637,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
return 0;
}
-int WorldSocket::schedule_wakeup_output (GuardType& g)
+int WorldSocket::schedule_wakeup_output(GuardType& g)
{
if (m_OutActive)
return 0;
@@ -758,6 +758,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
uint64 unk4;
WorldPacket packet, SendAddonPacked;
BigNumber k;
+ bool wardenActive = sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED);
if (sWorld->IsClosed())
{
@@ -795,6 +796,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
// Stop if the account is not found
if (!result)
{
+ // We can not log here, as we do not know the account. Thus, no accountId.
SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
@@ -807,19 +809,34 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
if (expansion > world_expansion)
expansion = world_expansion;
+ // For hook purposes, we get Remoteaddress at this point.
+ std::string address = GetRemoteAddress();
+
+ // As we don't know if attempted login process by ip works, we update last_attempt_ip right away
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
+
+ stmt->setString(0, address);
+ stmt->setString(1, account);
+
+ LoginDatabase.Execute(stmt);
+ // This also allows to check for possible "hack" attempts on account
+
+ // id has to be fetched at this point, so that first actual account response that fails can be logged
+ id = fields[0].GetUInt32();
+
///- Re-check ip locking (same check as in realmd).
if (fields[3].GetUInt8() == 1) // if ip is locked
{
- if (strcmp (fields[2].GetCString(), GetRemoteAddress().c_str()))
+ if (strcmp (fields[2].GetCString(), address.c_str()))
{
SendAuthResponseError(AUTH_FAILED);
- TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
+ TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
+ // We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
+ sScriptMgr->OnFailedAccountLogin(id);
return -1;
}
}
- id = fields[0].GetUInt32();
-
k.SetHexStr(fields[1].GetCString());
int64 mutetime = fields[5].GetInt64();
@@ -844,10 +861,10 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
std::string os = fields[8].GetString();
// Must be done before WorldSession is created
- if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED) && os != "Win" && os != "OSX")
+ if (wardenActive && os != "Win" && os != "OSX")
{
SendAuthResponseError(AUTH_REJECT);
- TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", GetRemoteAddress().c_str(), os.c_str());
+ TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str());
return -1;
}
@@ -871,7 +888,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS);
stmt->setUInt32(0, id);
- stmt->setString(1, GetRemoteAddress());
+ stmt->setString(1, address);
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
@@ -879,6 +896,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
SendAuthResponseError(AUTH_BANNED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
+ sScriptMgr->OnFailedAccountLogin(id);
return -1;
}
@@ -889,6 +907,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
SendAuthResponseError(AUTH_UNAVAILABLE);
TC_LOG_INFO("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
+ sScriptMgr->OnFailedAccountLogin(id);
return -1;
}
@@ -903,8 +922,6 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
sha.UpdateBigNumbers(&k, NULL);
sha.Finalize();
- std::string address = GetRemoteAddress();
-
if (memcmp(sha.GetDigest(), digest, 20))
{
SendAuthResponseError(AUTH_FAILED);
@@ -927,8 +944,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
if (result)
isRecruiter = true;
- // Update the last_ip in the database
-
+ // Update the last_ip in the database as it was successful for login
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP);
stmt->setString(0, address);
@@ -946,8 +962,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
m_Session->ReadAddonsInfo(recvPacket);
m_Session->LoadPermissions();
+ // At this point, we can safely hook a successful login
+ sScriptMgr->OnAccountLogin(id);
+
// Initialize Warden system only if it is enabled by config
- if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
+ if (wardenActive)
m_Session->InitWarden(&k, os);
// Sleep this Network thread for
@@ -958,7 +977,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
return 0;
}
-int WorldSocket::HandlePing (WorldPacket& recvPacket)
+int WorldSocket::HandlePing(WorldPacket& recvPacket)
{
uint32 ping;
uint32 latency;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b87524357d2..152dc903825 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -379,6 +379,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster):
m_base(base), m_spellInfo(base->GetSpellInfo()),
m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints),
+m_damage(0), m_critChance(0.0f), m_donePct(1.0f),
m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
m_canBeRecalculated(true), m_isPeriodic(false)
{
@@ -890,19 +891,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 +1669,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 +1719,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 +1847,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 +2020,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())
{
@@ -3497,11 +3494,23 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8
return;
Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_RESISTANCE_PCT);
+ if (abs(spellGroupVal) >= abs(GetAmount()))
+ return;
for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
{
if (GetMiscValue() & int32(1<<i))
{
+ if (spellGroupVal)
+ {
+ target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, (float)spellGroupVal, !apply);
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
+ {
+ target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)spellGroupVal, !apply);
+ target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)spellGroupVal, !apply);
+ }
+ }
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
{
@@ -3561,19 +3570,29 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
- Unit* target = aurApp->GetTarget();
-
if (GetMiscValue() < -2 || GetMiscValue() > 4)
{
TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
return;
}
+ Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_STAT, true, GetMiscValue());
+ if (abs(spellGroupVal) >= abs(GetAmount()))
+ return;
+
for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
{
// -1 or -2 is all stats (misc < -2 checked in function beginning)
if (GetMiscValue() < 0 || GetMiscValue() == i)
{
+ if (spellGroupVal)
+ {
+ target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ target->ApplyStatBuffMod(Stats(i), float(spellGroupVal), !apply);
+ }
+
//target->ApplyStatMod(Stats(i), m_amount, apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
@@ -3685,14 +3704,30 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
- Unit* target = aurApp->GetTarget();
-
if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
}
+ Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, -1);
+ if (abs(spellGroupVal) >= abs(GetAmount()))
+ return;
+
+ if (spellGroupVal)
+ {
+ for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
+ {
+ if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
+ {
+ target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal), !apply);
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal), !apply);
+ }
+ }
+ }
+
// save current health state
float healthPct = target->GetHealthPct();
bool alive = target->IsAlive();
@@ -3701,6 +3736,17 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
{
if (GetMiscValue() == i || GetMiscValue() == -1)
{
+ int32 spellGroupVal2 = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, i);
+ if (abs(spellGroupVal2) >= abs(GetAmount()))
+ continue;
+
+ if (spellGroupVal2)
+ {
+ target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal2), !apply);
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal2), !apply);
+ }
+
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
@@ -4099,7 +4145,17 @@ void AuraEffect::HandleModCombatSpeedPct(AuraApplication const* aurApp, uint8 mo
return;
Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MELEE_SLOW);
+ if (abs(spellGroupVal) >= abs(GetAmount()))
+ return;
+ if (spellGroupVal)
+ {
+ target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
+ target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
+ target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
+ target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
+ }
target->ApplyCastTimePercentMod(float(m_amount), apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
@@ -4123,7 +4179,15 @@ void AuraEffect::HandleModMeleeSpeedPct(AuraApplication const* aurApp, uint8 mod
return;
Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_MELEE_HASTE);
+ if (abs(spellGroupVal) >= abs(GetAmount()))
+ return;
+ if (spellGroupVal)
+ {
+ target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
+ target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
+ }
target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
}
@@ -4360,7 +4424,8 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
return;
Unit* target = aurApp->GetTarget();
- if (!target)
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ if (abs(spellGroupVal) >= abs(GetAmount()))
return;
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -4372,12 +4437,23 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER))
{
+ if (spellGroupVal)
+ {
+ target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(spellGroupVal), !apply);
+ target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(spellGroupVal), !apply);
+ target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(spellGroupVal), !apply);
+ }
target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER)
- target->ToPlayer()->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float (GetAmount()), apply);
+ if (Player* player = target->ToPlayer())
+ {
+ if (spellGroupVal)
+ player->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float(spellGroupVal), !apply);
+
+ player->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float(GetAmount()), apply);
+ }
}
else
{
@@ -4524,28 +4600,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
// AT APPLY
if (apply)
{
- // Overpower
- if (caster && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&
- m_spellInfo->SpellFamilyFlags[0] & 0x4)
- {
- // In addition, if you strike a player..
- if (target->GetTypeId() != TYPEID_PLAYER)
- return;
- // ..while they are casting
- if (target->IsNonMeleeSpellCast(false, false, true, false, true))
- if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARRIOR, 2775, 0))
- switch (aurEff->GetId())
- {
- // Unrelenting Assault, rank 1
- case 46859:
- target->CastSpell(target, 64849, true, NULL, aurEff);
- break;
- // Unrelenting Assault, rank 2
- case 46860:
- target->CastSpell(target, 64850, true, NULL, aurEff);
- break;
- }
- }
switch (GetId())
{
case 1515: // Tame beast
@@ -5780,15 +5834,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 +5902,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 +5969,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 +6089,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 +6139,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);
@@ -6211,6 +6300,9 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
{
Powers powerType = Powers(GetMiscValue());
+ if (target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() != powerType && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
+ return;
+
if (!target->IsAlive() || !target->GetMaxPower(powerType))
return;
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..3e4786df870 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -539,6 +539,9 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
|| !CanBeAppliedOn(itr->first))
addUnit = false;
+ if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
+ addUnit = false;
+
if (addUnit)
{
// persistent area aura does not hit flying targets
@@ -746,9 +749,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 +839,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();
}
@@ -880,6 +897,18 @@ void Aura::RefreshSpellMods()
player->RestoreAllSpellMods(0, this);
}
+bool Aura::HasMoreThanOneEffectForType(AuraType auraType) const
+{
+ uint32 count = 0;
+ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (HasEffect(i) && GetSpellInfo()->Effects[i].ApplyAuraName == auraType)
+ ++count;
+ }
+
+ return count > 1;
+}
+
bool Aura::IsArea() const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -1631,26 +1660,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;
+ }
}
}
@@ -1708,13 +1773,19 @@ bool Aura::CanStackWith(Aura const* existingAura) const
return false;
// check spell group stack rules
- SpellGroupStackRule stackRule = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo);
- if (stackRule)
+ switch (sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo))
{
- if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
- return false;
- if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
+ case SPELL_GROUP_STACK_RULE_EXCLUSIVE:
+ case SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST: // if it reaches this point, existing aura is lower/equal
return false;
+ case SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER:
+ if (sameCaster)
+ return false;
+ break;
+ case SPELL_GROUP_STACK_RULE_DEFAULT:
+ case SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT:
+ default:
+ break;
}
if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index f62b1ff47b4..8c426ea2175 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; }
@@ -149,6 +149,7 @@ class Aura
uint8 GetCasterLevel() const { return m_casterLevel; }
+ bool HasMoreThanOneEffectForType(AuraType auraType) const;
bool IsArea() const;
bool IsPassive() const;
bool IsDeathPersistent() const;
@@ -190,6 +191,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 b36d857881d..48c2a76578d 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;
@@ -1292,10 +1292,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
dist = objSize + (dist - objSize) * float(rand_norm());
Position pos = dest._position;
- if (targetType.GetTarget() == TARGET_DEST_CASTER_FRONT_LEAP)
- m_caster->MovePositionToFirstCollision(pos, dist, angle);
- else
- m_caster->MovePosition(pos, dist, angle);
+ m_caster->MovePositionToFirstCollision(pos, dist, angle);
dest.Relocate(pos);
break;
@@ -1328,7 +1325,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici
dist = objSize + (dist - objSize) * float(rand_norm());
Position pos = dest._position;
- target->MovePosition(pos, dist, angle);
+ target->MovePositionToFirstCollision(pos, dist, angle);
dest.Relocate(pos);
break;
@@ -1367,7 +1364,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT
dist *= float(rand_norm());
Position pos = dest._position;
- m_caster->MovePosition(pos, dist, angle);
+ m_caster->MovePositionToFirstCollision(pos, dist, angle);
dest.Relocate(pos);
break;
@@ -2343,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)
{
@@ -2610,10 +2607,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
// Haste modifies duration of channeled spells
if (m_spellInfo->IsChanneled())
- {
- if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
- m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
- }
+ m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
// and duration of auras affected by SPELL_AURA_PERIODIC_HASTE
else if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
@@ -3237,9 +3231,9 @@ void Spell::handle_immediate()
// Apply duration mod
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
+
// Apply haste mods
- if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
- m_caster->ModSpellCastTime(m_spellInfo, duration, this);
+ m_caster->ModSpellCastTime(m_spellInfo, duration, this);
m_spellState = SPELL_STATE_CASTING;
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
@@ -3768,7 +3762,7 @@ void Spell::SendSpellStart()
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
if (m_spellInfo->RuneCostID && m_spellInfo->PowerType == POWER_RUNE)
- castFlags |= CAST_FLAG_UNKNOWN_19;
+ castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
if (m_CastItem)
@@ -3824,21 +3818,22 @@ void Spell::SendSpellGo()
if ((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
&& m_spellInfo->RuneCostID
- && m_spellInfo->PowerType == POWER_RUNE)
+ && m_spellInfo->PowerType == POWER_RUNE
+ && !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
{
- castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
+ castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
}
if (m_spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
- {
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
- castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
- }
if (m_targets.HasTraj())
castFlags |= CAST_FLAG_ADJUST_MISSILE;
+ if (!m_spellInfo->StartRecoveryTime)
+ castFlags |= CAST_FLAG_NO_GCD;
+
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
if (m_CastItem)
@@ -4191,7 +4186,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
? ""
@@ -6732,7 +6727,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/Spell.h b/src/server/game/Spells/Spell.h
index 341867ff787..584c20fdfb3 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -57,7 +57,7 @@ enum SpellCastFlags
CAST_FLAG_UNKNOWN_16 = 0x00008000,
CAST_FLAG_UNKNOWN_17 = 0x00010000,
CAST_FLAG_ADJUST_MISSILE = 0x00020000,
- CAST_FLAG_UNKNOWN_19 = 0x00040000,
+ CAST_FLAG_NO_GCD = 0x00040000, // no GCD for spell casts from charm/summon (vehicle spells is an example)
CAST_FLAG_VISUAL_CHAIN = 0x00080000,
CAST_FLAG_UNKNOWN_21 = 0x00100000,
CAST_FLAG_RUNE_LIST = 0x00200000,
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 65530b4b282..9cf0e1ae45c 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;
@@ -836,10 +836,10 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
{
// remove all harmful spells on you...
SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
- if ((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC // only affect magic spells
- || ((spell->GetDispelMask()) & dispelMask))
+ if (((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && spell->GetSchoolMask() != SPELL_SCHOOL_MASK_NORMAL) // only affect magic spells
+ || (spell->GetDispelMask() & dispelMask)) &&
// ignore positive and passive auras
- && !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive())
+ !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive())
{
m_caster->RemoveAura(iter);
}
@@ -1096,7 +1096,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
TC_LOG_DEBUG("spells", "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation);
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
- unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
+ unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL | TELE_TO_NOT_LEAVE_COMBAT : 0);
else if (mapid == unitTarget->GetMapId())
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
else
@@ -1751,6 +1751,12 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
+ if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
+ return;
+
+ if (unitTarget->GetMaxPower(power) == 0)
+ return;
+
// Some level depends spells
int level_multiplier = 0;
int level_diff = 0;
@@ -1796,9 +1802,6 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
if (damage < 0)
return;
- if (unitTarget->GetMaxPower(power) == 0)
- return;
-
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power);
// Mad Alchemist's Potion
@@ -1863,6 +1866,9 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
+ if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
+ return;
+
uint32 maxPower = unitTarget->GetMaxPower(power);
if (maxPower == 0)
return;
@@ -4049,26 +4055,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
break;
}
- case SPELLFAMILY_DEATHKNIGHT:
- {
- // Pestilence
- if (m_spellInfo->SpellFamilyFlags[1]&0x10000)
- {
- // 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)))
- {
- // And spread them on target
- // Blood Plague
- if (m_targets.GetUnitTarget()->GetAura(55078))
- m_caster->CastSpell(unitTarget, 55078, true);
- // Frost Fever
- if (m_targets.GetUnitTarget()->GetAura(55095))
- m_caster->CastSpell(unitTarget, 55095, true);
- }
- }
- break;
- }
}
// normal DB scripted effect
@@ -4542,7 +4528,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..4d97dc97e5b 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)
{
@@ -1206,10 +1207,8 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
return true;
- // these spells (Cyclone for example) can pierce all...
- if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)
- // ...but not these (Divine shield for example)
- && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY)))
+ // these spells (Cyclone for example) can pierce all... // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
+ if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || aura->Mechanic == MECHANIC_BANISH)))
return true;
return false;
@@ -1505,8 +1504,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..6f56c0ebc40 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -765,6 +765,15 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn
return rule;
}
+SpellGroupStackRule SpellMgr::GetSpellGroupStackRule(SpellGroup group) const
+{
+ SpellGroupStackMap::const_iterator itr = mSpellGroupStack.find(group);
+ if (itr != mSpellGroupStack.end())
+ return itr->second;
+
+ return SPELL_GROUP_STACK_RULE_DEFAULT;
+}
+
SpellProcEventEntry const* SpellMgr::GetSpellProcEvent(uint32 spellId) const
{
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
@@ -784,14 +793,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 +815,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 +824,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 +844,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 +3216,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 +3394,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/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 7b54aca3759..757bd813613 100644
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -349,14 +349,14 @@ typedef std::pair<SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_
enum SpellGroupStackRule
{
- SPELL_GROUP_STACK_RULE_DEFAULT = 0,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3
+ SPELL_GROUP_STACK_RULE_DEFAULT,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST,
+ SPELL_GROUP_STACK_RULE_MAX
};
-#define SPELL_GROUP_STACK_RULE_MAX 4
-
typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap;
struct SpellThreatEntry
@@ -655,6 +655,7 @@ class SpellMgr
// Spell Group Stack Rules table
bool AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int32 amount, std::map<SpellGroup, int32>& groups) const;
SpellGroupStackRule CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const;
+ SpellGroupStackRule GetSpellGroupStackRule(SpellGroup groupid) const;
// Spell proc event table
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const;
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 0fc5be97ae6..dea7dfa6819 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/game/World/World.cpp b/src/server/game/World/World.cpp
index 6f9a812ab3b..e5b207d9b46 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1253,6 +1253,10 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_BIRTHDAY_TIME] = sConfigMgr->GetIntDefault("BirthdayTime", 1222964635);
+ m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false);
+
+ m_bool_configs[CONFIG_IP_BASED_LOGIN_LOGGING] = sConfigMgr->GetBoolDefault("Wrong.Password.Login.Logging", false);
+
// call ScriptMgr if we're reloading the configuration
if (reload)
sScriptMgr->OnConfigLoad(reload);
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 3e836df1989..f5c0dd1cb8f 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -154,6 +154,8 @@ enum WorldBoolConfigs
CONFIG_EVENT_ANNOUNCE,
CONFIG_STATS_LIMITS_ENABLE,
CONFIG_INSTANCES_RESET_ANNOUNCE,
+ CONFIG_IP_BASED_ACTION_LOGGING,
+ CONFIG_IP_BASED_LOGIN_LOGGING,
BOOL_CONFIG_VALUE_COUNT
};
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt
index c1a9435de52..938520209a0 100644
--- a/src/server/scripts/CMakeLists.txt
+++ b/src/server/scripts/CMakeLists.txt
@@ -47,7 +47,9 @@ message("")
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast/Include
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/SFMT
${CMAKE_SOURCE_DIR}/dep/zlib
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 3c9714ca55a..1121e4d0a2f 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -377,6 +377,7 @@ public:
if (!AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), std::string(oldEmail)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL);
+ sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided email [%s] is not equal to registration email [%s].",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
@@ -388,6 +389,7 @@ public:
if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(password)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
+ sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
@@ -398,6 +400,7 @@ public:
if (strcmp(email, oldEmail) == 0)
{
handler->SendSysMessage(LANG_OLD_EMAIL_IS_NEW_EMAIL);
+ sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
}
@@ -405,6 +408,7 @@ public:
if (strcmp(email, emailConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_EMAILS_NOT_MATCH);
+ sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
@@ -418,6 +422,7 @@ public:
{
case AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
+ sScriptMgr->OnEmailChange(handler->GetSession()->GetAccountId());
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
@@ -425,6 +430,7 @@ public:
break;
case AOR_EMAIL_TOO_LONG:
handler->SendSysMessage(LANG_EMAIL_TOO_LONG);
+ sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
default:
@@ -469,6 +475,7 @@ public:
if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
+ sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the provided old password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
@@ -481,6 +488,7 @@ public:
&& !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), std::string(emailConfirmation))) // ... and returns false if the comparison fails.
{
handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL);
+ sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
@@ -493,6 +501,7 @@ public:
if (strcmp(newPassword, passwordConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
+ sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
}
@@ -503,12 +512,14 @@ public:
{
case AOR_OK:
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
+ sScriptMgr->OnPasswordChange(handler->GetSession()->GetAccountId());
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
break;
case AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
+ sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
default:
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..9cf8c041883 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -43,6 +43,7 @@ struct EnumName
#define CREATE_NAMED_ENUM(VALUE) { VALUE, STRINGIZE(VALUE) }
#define NPCFLAG_COUNT 24
+#define FLAGS_EXTRA_COUNT 16
EnumName<NPCFlags, int32> const npcFlagTexts[NPCFLAG_COUNT] =
{
@@ -144,6 +145,26 @@ EnumName<UnitFlags> const unitFlags[MAX_UNIT_FLAGS] =
CREATE_NAMED_ENUM(UNIT_FLAG_UNK_31)
};
+EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] =
+{
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_INSTANCE_BIND),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_CIVILIAN),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_PARRY),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_BLOCK),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_CRUSH),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_XP_AT_KILL),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_TRIGGER),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_TAUNT),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_WORLDEVENT),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_GUARD),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_CRIT),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_SKILLGAIN),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_TAUNT_DIMINISH),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_ALL_DIMINISH),
+ CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_DUNGEON_BOSS)
+};
+
class npc_commandscript : public CommandScript
{
public:
@@ -715,6 +736,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)
@@ -729,6 +751,10 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
handler->PSendSysMessage(LANG_NPCINFO_POSITION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
+ handler->PSendSysMessage(LANG_NPCINFO_FLAGS_EXTRA, cInfo->flags_extra);
+ for (uint8 i = 0; i < FLAGS_EXTRA_COUNT; ++i)
+ if (cInfo->flags_extra & flagsExtra[i].Value)
+ handler->PSendSysMessage("%s (0x%X)", flagsExtra[i].Name, flagsExtra[i].Value);
for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
if (npcflags & npcFlagTexts[i].Value)
diff --git a/src/server/scripts/Custom/CMakeLists.txt b/src/server/scripts/Custom/CMakeLists.txt
index 78db719ae6e..80ebe36b555 100644
--- a/src/server/scripts/Custom/CMakeLists.txt
+++ b/src/server/scripts/Custom/CMakeLists.txt
@@ -8,8 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# file(GLOB_RECURSE sources_Custom Custom/*.cpp Custom/*.h)
+
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
+# ${sources_Custom}
)
message(" -> Prepared: Custom")
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_golemagg.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
index 2a473754ce6..f9757997731 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
@@ -144,7 +144,7 @@ class npc_core_rager : public CreatureScript
if (HealthAbovePct(50) || !instance)
return;
- if (Creature* pGolemagg = instance->instance->GetCreature(instance->GetData64(BOSS_GOLEMAGG_THE_INCINERATOR)))
+ if (Creature* pGolemagg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_GOLEMAGG_THE_INCINERATOR)))
{
if (pGolemagg->IsAlive())
{
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 5562559786d..d300703152c 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -679,13 +679,16 @@ public:
if (!map->IsDungeon())
return;
- Map::PlayerList const &PlayerList = map->GetPlayers();
- for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ Map::PlayerList const &playerList = map->GetPlayers();
+ Position homePos = me->GetHomePosition();
+ for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
{
- if (i->GetSource()->GetPositionZ() <= DRAGON_REALM_Z-5)
+ Player* player = itr->GetSource();
+ if (player->IsInDist(&homePos, 50.0f) && player->GetPositionZ() <= DEMON_REALM_Z + 10.f)
{
- i->GetSource()->RemoveAura(AURA_SPECTRAL_REALM);
- i->GetSource()->TeleportTo(me->GetMap()->GetId(), i->GetSource()->GetPositionX(), i->GetSource()->GetPositionY(), DRAGON_REALM_Z+5, i->GetSource()->GetOrientation());
+ player->RemoveAura(AURA_SPECTRAL_REALM);
+ player->TeleportTo(me->GetMap()->GetId(), player->GetPositionX(),
+ player->GetPositionY(), DRAGON_REALM_Z + 5, player->GetOrientation());
}
}
}
@@ -763,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/CMakeLists.txt b/src/server/scripts/Events/CMakeLists.txt
index e45bc585007..3bdb6e6eac2 100644
--- a/src/server/scripts/Events/CMakeLists.txt
+++ b/src/server/scripts/Events/CMakeLists.txt
@@ -8,9 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+file(GLOB_RECURSE sources_Events Events/*.cpp Events/*.h)
+
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
- Events/childrens_week.cpp
+ ${sources_Events}
)
message(" -> Prepared: Events")
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/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index 4aa59e72556..bf7b4355ea6 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -141,9 +141,9 @@ class instance_ahnkahet : public InstanceMapScript
SwitchTrigger = data;
break;
case DATA_JEDOGA_RESET_INITIANDS:
- for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr)
+ for (uint64 guid : InitiandGUIDs)
{
- if (Creature* creature = instance->GetCreature(*itr))
+ if (Creature* creature = instance->GetCreature(guid))
{
creature->Respawn();
if (!creature->IsInEvadeMode())
@@ -164,9 +164,9 @@ class instance_ahnkahet : public InstanceMapScript
case DATA_SPHERE_2:
return SpheresState[type - DATA_SPHERE_1];
case DATA_ALL_INITIAND_DEAD:
- for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr)
+ for (uint64 guid : InitiandGUIDs)
{
- Creature* cr = instance->GetCreature(*itr);
+ Creature* cr = instance->GetCreature(guid);
if (!cr || cr->IsAlive())
return 0;
}
@@ -214,11 +214,11 @@ class instance_ahnkahet : public InstanceMapScript
{
std::vector<uint64> vInitiands;
vInitiands.clear();
- for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr)
+ for (uint64 guid : InitiandGUIDs)
{
- Creature* cr = instance->GetCreature(*itr);
+ Creature* cr = instance->GetCreature(guid);
if (cr && cr->IsAlive())
- vInitiands.push_back(*itr);
+ vInitiands.push_back(guid);
}
if (vInitiands.empty())
return 0;
@@ -245,9 +245,9 @@ class instance_ahnkahet : public InstanceMapScript
case DATA_JEDOGA_SHADOWSEEKER:
if (state == DONE)
{
- for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr)
+ for (uint64 guid : InitiandGUIDs)
{
- if (Creature* cr = instance->GetCreature(*itr))
+ if (Creature* cr = instance->GetCreature(guid))
cr->DespawnOrUnsummon();
}
}
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/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index aff3c0a9528..8401ea4b9a5 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -20,7 +20,6 @@ set(scripts_STAT_SRCS
Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
- Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
Northrend/Ulduar/Ulduar/boss_thorim.cpp
Northrend/Ulduar/Ulduar/boss_ignis.cpp
Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
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/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index f352b4faace..43c295d5f64 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -855,7 +855,6 @@ class npc_halion_controller : public CreatureScript
{
if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)))
{
- RemoveCorporeality(halion, itr == DATA_TWILIGHT_HALION);
halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), true);
if (itr == DATA_TWILIGHT_HALION)
@@ -866,19 +865,6 @@ class npc_halion_controller : public CreatureScript
}
}
- void RemoveCorporeality(Creature* who, bool isTwilight = false)
- {
- for (uint8 i = 0; i < MAX_CORPOREALITY_STATE; i++)
- {
- uint32 spellID = (isTwilight ? _corporealityReference[i].twilightRealmSpell : _corporealityReference[i].materialRealmSpell);
- if (who->HasAura(spellID))
- {
- who->RemoveAurasDueToSpell(spellID);
- break;
- }
- }
- }
-
uint32 GetSpell(uint8 pctValue, bool isTwilight = false) const
{
CorporealityEntry entry = _corporealityReference[pctValue];
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..4e9462a447f 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -208,7 +208,7 @@ public:
{
for (uint8 i = 0; i < 4; i++)
if (uint64 guid = instance->GetData64(summoners[i].data))
- if (Creature* crystalChannelTarget = instance->instance->GetCreature(guid))
+ if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid))
{
if (active)
crystalChannelTarget->AI()->SetData(summoners[i].spell, summoners[i].timer);
@@ -221,7 +221,7 @@ public:
{
for (uint8 i = 0; i < 4; i++)
if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
- if (GameObject* crystal = instance->instance->GetGameObject(guid))
+ if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid))
SetCrystalStatus(crystal, active);
}
@@ -241,7 +241,7 @@ public:
{
for (uint8 i = 0; i < 4; i++)
if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
- if (GameObject* crystal = instance->instance->GetGameObject(guid))
+ if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid))
if (crystal->GetGoState() == GO_STATE_ACTIVE)
{
SetCrystalStatus(crystal, false);
@@ -258,7 +258,7 @@ public:
events.ScheduleEvent(EVENT_SUMMON_MINIONS, 15000);
}
else if (uint64 guid = instance->GetData64(DATA_NOVOS_SUMMONER_4))
- if (Creature* crystalChannelTarget = instance->instance->GetCreature(guid))
+ if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid))
crystalChannelTarget->AI()->SetData(SPELL_SUMMON_CRYSTAL_HANDLER, 15000);
}
@@ -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_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 16d1531e890..e1658e564ec 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -1227,9 +1227,9 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
if (targets.empty())
return;
- // select one random target, with preference of ranged targets
+ // select one random target, preferring ranged targets
uint32 targetsAtRange = 0;
- uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4);
+ uint32 const minTargets = uint32(GetCaster()->GetMap()->Is25ManRaid() ? 10 : 4);
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
// get target count at range
@@ -1237,18 +1237,12 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
if ((*itr)->GetDistance(GetCaster()) < 12.0f)
break;
- // set the upper cap
+ // If not enough ranged targets are present just select anyone
if (targetsAtRange < minTargets)
- targetsAtRange = std::min<uint32>(targets.size() - 1, minTargets);
-
- if (!targetsAtRange)
- {
- targets.clear();
- return;
- }
+ targetsAtRange = uint32(targets.size());
std::list<WorldObject*>::const_iterator itr = targets.begin();
- std::advance(itr, urand(0, targetsAtRange));
+ std::advance(itr, urand(0, targetsAtRange - 1));
target = *itr;
targets.clear();
targets.push_back(target);
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/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
index 223f3731032..b72b953efb4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -559,6 +559,11 @@ class boss_the_lich_king : public CreatureScript
Trinity::GameObjectWorker<FrozenThroneResetWorker> worker(me, reset);
me->VisitNearbyGridObject(333.0f, worker);
+ // Restore Tirion's gossip only after The Lich King fully resets to prevent
+ // restarting the encounter while LK still runs back to spawn point
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ tirion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+
// Reset any light override
me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, 0, 5000);
}
@@ -1201,11 +1206,6 @@ class npc_tirion_fordring_tft : public CreatureScript
void JustReachedHome() override
{
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
-
- if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE)
- return;
-
- me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
void UpdateAI(uint32 diff) override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index d3b4a285af6..d4f00414b7d 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -120,7 +120,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
-
{
if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index 02bafa8d10d..3d42827c0a8 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -84,7 +84,6 @@ class boss_faerlina : public CreatureScript
}
void MoveInLineOfSight(Unit* who) override
-
{
if (!_introDone && who->GetTypeId() == TYPEID_PLAYER)
{
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_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index 3a0e3ce7c73..381be8d5cd1 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -70,7 +70,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
-
{
if (who->GetEntry() == NPC_ZOMBIE && me->IsWithinDistInMap(who, 7))
{
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/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index 1331c25de17..e8ed181da5a 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -368,9 +368,9 @@ class instance_naxxramas : public InstanceMapScript
if (i == section)
continue;
- for (std::set<uint64>::const_iterator itr = HeiganEruptionGUID[i].begin(); itr != HeiganEruptionGUID[i].end(); ++itr)
+ for (uint64 guid : HeiganEruptionGUID[i])
{
- if (GameObject* heiganEruption = instance->GetGameObject(*itr))
+ if (GameObject* heiganEruption = instance->GetGameObject(guid))
{
heiganEruption->SendCustomAnim(heiganEruption->GetGoAnimProgress());
heiganEruption->CastSpell(NULL, SPELL_ERUPTION);
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/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index bf84a267a27..2b15ddf32c4 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -281,8 +281,8 @@ class instance_oculus : public InstanceMapScript
void GreaterWhelps()
{
- for (std::list<uint64>::const_iterator itr = GreaterWhelpList.begin(); itr != GreaterWhelpList.end(); ++itr)
- if (Creature* gwhelp = instance->GetCreature(*itr))
+ for (uint64 guid : GreaterWhelpList)
+ if (Creature* gwhelp = instance->GetCreature(guid))
gwhelp->SetPhaseMask(1, true);
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 727060578c8..13ea815febc 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -164,11 +164,9 @@ 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();
- }
}
if (m_uiStance != STANCE_DEFENSIVE)
@@ -411,7 +409,7 @@ public:
void EnterCombat(Unit* who) override
{
- if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM)))
+ if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM)))
{
if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim())
pBjarngrim->AI()->AttackStart(who);
@@ -434,7 +432,7 @@ public:
if (m_uiRenewSteel_Timer <= uiDiff)
{
- if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM)))
+ if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM)))
{
if (pBjarngrim->IsAlive())
DoCast(pBjarngrim, SPELL_RENEW_STEEL_N);
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index aac315cda0d..83082b18d73 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -165,9 +165,9 @@ public:
Position pos = me->GetPosition();
- for (std::list<uint64>::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr)
+ for (uint64 guid : lSparkList)
{
- if (Creature* pSpark = ObjectAccessor::GetCreature(*me, *itr))
+ if (Creature* pSpark = ObjectAccessor::GetCreature(*me, guid))
{
if (pSpark->IsAlive())
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 880045b96ef..b424ce01b06 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -162,13 +162,11 @@ public:
if (m_lGolemGUIDList.empty())
return;
- for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
+ for (uint64 guid : m_lGolemGUIDList)
{
- if (Creature* temp = Unit::GetCreature(*me, *itr))
- {
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, guid))
if (temp->IsAlive())
temp->DespawnOrUnsummon();
- }
}
m_lGolemGUIDList.clear();
@@ -179,9 +177,9 @@ public:
if (m_lGolemGUIDList.empty())
return;
- for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
+ for (uint64 guid : m_lGolemGUIDList)
{
- if (Creature* temp = Unit::GetCreature(*me, *itr))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, guid))
{
// 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/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
index eec08c3c429..796299cc952 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
@@ -37,7 +37,7 @@ enum Spells
enum Events
{
- EVENT_PARTING_SORROW = 1,
+ EVENT_PARTING_SORROW = 1,
EVENT_STORM_OF_GRIEF,
EVENT_SHOCK_OF_SORROW,
EVENT_PILLAR_OF_WOE
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_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 67500382758..595dcecd554 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -334,7 +334,7 @@ class boss_algalon_the_observer : public CreatureScript
{
case ACTION_START_INTRO:
{
- me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20);
+ me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_INSTANTLY_APPEAR_MODEL);
me->SetDisableGravity(true);
DoCast(me, SPELL_ARRIVAL, true);
DoCast(me, SPELL_RIDE_THE_LIGHTNING, true);
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/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index d728bc2a898..6437a76ee95 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -18,9 +18,10 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "InstanceScript.h"
-#include "ulduar.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "SpellScript.h"
+#include "ulduar.h"
static DoorData const doorData[] =
{
@@ -1094,7 +1095,43 @@ class instance_ulduar : public InstanceMapScript
}
};
+class spell_ulduar_teleporter : public SpellScriptLoader
+{
+ public:
+ spell_ulduar_teleporter() : SpellScriptLoader("spell_ulduar_teleporter") { }
+
+ class spell_ulduar_teleporter_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_ulduar_teleporter_SpellScript);
+
+ SpellCastResult CheckRequirement()
+ {
+ if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
+ return SPELL_FAILED_DONT_REPORT;
+
+ if (GetExplTargetUnit()->IsInCombat())
+ {
+ Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_AFFECTING_COMBAT);
+ return SPELL_FAILED_AFFECTING_COMBAT;
+ }
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register() override
+ {
+ OnCheckCast += SpellCheckCastFn(spell_ulduar_teleporter_SpellScript::CheckRequirement);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_ulduar_teleporter_SpellScript();
+ }
+};
+
void AddSC_instance_ulduar()
{
new instance_ulduar();
+ new spell_ulduar_teleporter();
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
deleted file mode 100644
index 9fc0e4056fa..00000000000
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ScriptMgr.h"
-#include "ScriptedGossip.h"
-#include "InstanceScript.h"
-#include "Player.h"
-#include "ulduar.h"
-
-/*
-The teleporter appears to be active and stable.
-
-- Expedition Base Camp
-- Formation Grounds
-- Colossal Forge
-- Scrapyard
-- Antechamber of Ulduar
-- Shattered Walkway
-- Conservatory of Life
-*/
-
-enum UlduarTeleporter
-{
- BASE_CAMP = 200,
- GROUNDS = 201,
- FORGE = 202,
- SCRAPYARD = 203,
- ANTECHAMBER = 204,
- WALKWAY = 205,
- CONSERVATORY = 206,
-};
-
-class ulduar_teleporter : public GameObjectScript
-{
- public:
- ulduar_teleporter() : GameObjectScript("ulduar_teleporter") { }
-
- bool OnGossipSelect(Player* player, GameObject* /*gameObject*/, uint32 sender, uint32 action) override
- {
- player->PlayerTalkClass->ClearMenus();
- if (sender != GOSSIP_SENDER_MAIN)
- return false;
- if (!player->getAttackers().empty())
- return false;
-
- switch (action)
- {
- case BASE_CAMP:
- player->TeleportTo(603, -706.122f, -92.6024f, 429.876f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case GROUNDS:
- player->TeleportTo(603, 131.248f, -35.3802f, 409.804f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case FORGE:
- player->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case SCRAPYARD:
- player->TeleportTo(603, 926.292f, -11.4635f, 418.595f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case ANTECHAMBER:
- player->TeleportTo(603, 1498.09f, -24.246f, 420.967f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case WALKWAY:
- player->TeleportTo(603, 1859.45f, -24.1f, 448.9f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- case CONSERVATORY:
- player->TeleportTo(603, 2086.27f, -24.3134f, 421.239f, 0.0f);
- player->CLOSE_GOSSIP_MENU();
- break;
- }
-
- return true;
- }
-
- bool OnGossipHello(Player* player, GameObject* gameObject) override
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP);
- if (InstanceScript* instance = gameObject->GetInstanceScript())
- {
- if (instance->GetData(DATA_COLOSSUS) == 2) //count of 2 collossus death
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS);
- if (instance->GetBossState(BOSS_LEVIATHAN) == DONE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE);
- if (instance->GetBossState(BOSS_XT002) == DONE)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER);
- }
- if (instance->GetBossState(BOSS_KOLOGARN) == DONE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY);
- if (instance->GetBossState(BOSS_AURIAYA) == DONE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY);
- }
-
- player->SEND_GOSSIP_MENU(gameObject->GetGOInfo()->GetGossipMenuId(), gameObject->GetGUID());
- return true;
- }
-};
-
-void AddSC_ulduar_teleporter()
-{
- new ulduar_teleporter();
-}
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..7d680ecd071 100644
--- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
@@ -76,20 +76,18 @@ public:
GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f);
if (!orbList.empty())
{
- for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr)
+ for (Creature* orb : orbList)
{
- if (Creature* pOrb = *itr)
+ if (orb->GetPositionY() < 1000)
{
- if (pOrb->GetPositionY() < 1000)
- {
- targetGUID = pOrb->GetGUID();
- break;
- }
+ targetGUID = orb->GetGUID();
+ break;
}
}
}
}
- }else
+ }
+ else
{
if (!targetGUID)
if (Creature* pOrb = GetClosestCreatureWithEntry(me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f))
@@ -97,7 +95,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_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index 21fc93578ae..1e8da70bbbf 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -73,7 +73,6 @@ public:
void AttackStart(Unit* /*who*/) override { }
void MoveInLineOfSight(Unit* who) override
-
{
if (!who || !who->IsInWorld() || who->GetZoneId() != 4395)
return;
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index bda6d953d9f..59c9b21a220 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -246,13 +246,10 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
{
std::list<Creature*> creatureList;
GetCreatureListWithEntryInGrid(creatureList, me, AudienceMobs[ii], 15.0f);
- for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
+ for (Creature* creature : creatureList)
{
- if (Creature* creatureList = *itr)
- {
- audienceList[creaturecount] = creatureList->GetGUID();
- ++creaturecount;
- }
+ audienceList[creaturecount] = creature->GetGUID();
+ ++creaturecount;
}
}
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_gurtogg_bloodboil.cpp
index 1f8c090230b..f03caa37cb2 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
@@ -17,14 +17,14 @@
*/
/* ScriptData
-SDName: Boss_Bloodboil
-SD%Complete: 80
-SDComment: Bloodboil not working correctly, missing enrage
-SDCategory: Black Temple
+Name: Boss_Bloodboil
+Complete: 80
+Category: Black Temple
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "black_temple.h"
enum Bloodboil
@@ -54,9 +54,6 @@ enum Bloodboil
SPELL_BERSERK = 45078
};
-
-//This is used to sort the players by distance in preparation for the Bloodboil cast.
-
class boss_gurtogg_bloodboil : public CreatureScript
{
public:
@@ -137,54 +134,9 @@ public:
Talk(SAY_DEATH);
}
- // Note: This seems like a very complicated fix. The fix needs to be handled by the core, as implementation of limited-target AoE spells are still not limited.
- void CastBloodboil()
- {
- // Get the Threat List
- std::list<HostileReference*> m_threatlist = me->getThreatManager().getThreatList();
-
- if (m_threatlist.empty()) // He doesn't have anyone in his threatlist, useless to continue
- return;
-
- std::list<Unit*> targets;
- 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());
- //only on alive players
- if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
- targets.push_back(target);
- }
-
- //Sort the list of players
- targets.sort(Trinity::ObjectDistanceOrderPred(me, false));
- //Resize so we only get top 5
- targets.resize(5);
-
- //Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp
- /*SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODBOIL);
- if (spellInfo)
- {
- for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
- {
- Unit* target = *itr;
- if (!target) return;
- for (uint32 i = 0; i<3; ++i)
- {
- uint8 eff = spellInfo->Effect[i];
- if (eff >= TOTAL_SPELL_EFFECTS)
- continue;
-
- Aura* Aur = new Aura(spellInfo, i, target, target, target);
- target->AddAura(Aur);
- }
- }
- }*/
- }
-
void RevertThreatOnTarget(uint64 guid)
{
- if (Unit* unit = Unit::GetUnit(*me, guid))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, guid))
{
if (DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
@@ -247,8 +199,7 @@ public:
{
if (BloodboilCount < 5) // Only cast it five times.
{
- //CastBloodboil(); // Causes issues on windows, so is commented out.
- DoCastVictim(SPELL_BLOODBOIL);
+ DoCastAOE(SPELL_BLOODBOIL);
++BloodboilCount;
BloodboilTimer = 10000*BloodboilCount;
}
@@ -274,7 +225,7 @@ public:
{
if (Phase1)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
Phase1 = false;
@@ -327,7 +278,41 @@ public:
};
+// 42005 - Bloodboil
+class spell_gurtogg_bloodboil_bloodboil : public SpellScriptLoader
+{
+ public:
+ spell_gurtogg_bloodboil_bloodboil() : SpellScriptLoader("spell_gurtogg_bloodboil_bloodboil") { }
+
+ class spell_gurtogg_bloodboil_bloodboil_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gurtogg_bloodboil_bloodboil_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (targets.size() <= 5)
+ return;
+
+ // Sort the list of players
+ targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
+ // Resize so we only get top 5
+ targets.resize(5);
+ }
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gurtogg_bloodboil_bloodboil_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_gurtogg_bloodboil_bloodboil_SpellScript();
+ }
+};
+
void AddSC_boss_gurtogg_bloodboil()
{
new boss_gurtogg_bloodboil();
+ new spell_gurtogg_bloodboil_bloodboil();
}
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/CMakeLists.txt b/src/server/scripts/Outland/CMakeLists.txt
index 414a3bce14a..0c69a236ef8 100644
--- a/src/server/scripts/Outland/CMakeLists.txt
+++ b/src/server/scripts/Outland/CMakeLists.txt
@@ -112,7 +112,7 @@ set(scripts_STAT_SRCS
Outland/BlackTemple/instance_black_temple.cpp
Outland/BlackTemple/boss_reliquary_of_souls.cpp
Outland/BlackTemple/boss_warlord_najentus.cpp
- Outland/BlackTemple/boss_bloodboil.cpp
+ Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
Outland/BlackTemple/boss_illidan.cpp
Outland/zone_shadowmoon_valley.cpp
Outland/zone_blades_edge_mountains.cpp
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..245ec7e88cf 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -39,9 +39,11 @@ enum DeathKnightSpells
SPELL_DK_DEATH_COIL_DAMAGE = 47632,
SPELL_DK_DEATH_COIL_HEAL = 47633,
SPELL_DK_DEATH_STRIKE_HEAL = 45470,
+ SPELL_DK_FROST_FEVER = 55095,
SPELL_DK_FROST_PRESENCE = 48263,
SPELL_DK_FROST_PRESENCE_TRIGGERED = 61261,
SPELL_DK_GHOUL_EXPLODE = 47496,
+ SPELL_DK_GLYPH_OF_DISEASE = 63334,
SPELL_DK_GLYPH_OF_ICEBOUND_FORTITUDE = 58625,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1 = 50365,
SPELL_DK_IMPROVED_FROST_PRESENCE_R1 = 50384,
@@ -51,6 +53,7 @@ enum DeathKnightSpells
SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962,
SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736,
SPELL_DK_MASTER_OF_GHOULS = 52143,
+ SPELL_DK_BLOOD_PLAGUE = 55078,
SPELL_DK_RAISE_DEAD_USE_REAGENT = 48289,
SPELL_DK_RUNIC_POWER_ENERGIZE = 49088,
SPELL_DK_SCENT_OF_BLOOD = 50422,
@@ -322,13 +325,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 +343,7 @@ public:
private:
uint64 _casterGUID;
+ bool _allowGhoul;
};
// 49158 - Corpse Explosion (51325, 51326, 51327, 51328)
@@ -369,7 +374,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 +385,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);
@@ -931,6 +936,91 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
}
};
+// ID - 50842 Pestilence
+class spell_dk_pestilence : public SpellScriptLoader
+{
+ public:
+ spell_dk_pestilence() : SpellScriptLoader("spell_dk_pestilence") { }
+
+ class spell_dk_pestilence_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dk_pestilence_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_DISEASE)
+ || !sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PLAGUE)
+ || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_FEVER))
+ return false;
+ return true;
+ }
+
+ void OnHit(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ Unit* hitUnit = GetHitUnit();
+ Unit* victim = GetExplTargetUnit();
+
+ if (!victim)
+ return;
+
+ if (victim != hitUnit || caster->HasAura(SPELL_DK_GLYPH_OF_DISEASE))
+ {
+ if (Aura* aurOld = victim->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID())) // Check Blood Plague application on victim.
+ {
+ if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0))
+ {
+ float donePct = aurEffOld->GetDonePct();
+ float critChance = aurEffOld->GetCritChance();
+
+ caster->CastSpell(hitUnit, SPELL_DK_BLOOD_PLAGUE, true); // Spread the disease to hitUnit.
+
+ if (Aura* aurNew = hitUnit->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID())) // Check Blood Plague application on hitUnit.
+ {
+ if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0))
+ {
+ aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9.
+ aurEffNew->SetDonePct(donePct);
+ aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
+ }
+ }
+ }
+ }
+
+ if (Aura* aurOld = victim->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID())) // Check Frost Fever application on victim.
+ {
+ if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0))
+ {
+ float donePct = aurEffOld->GetDonePct();
+
+ caster->CastSpell(hitUnit, SPELL_DK_FROST_FEVER, true); // Spread the disease to hitUnit.
+
+ if (Aura* aurNew = hitUnit->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID())) // Check Frost Fever application on hitUnit.
+ {
+ if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0))
+ {
+ aurEffNew->SetDonePct(donePct);
+ aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_dk_pestilence_SpellScript::OnHit, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_dk_pestilence_SpellScript();
+ }
+};
+
+
// 48266 - Blood Presence
// 48263 - Frost Presence
// 48265 - Unholy Presence
@@ -1465,6 +1555,7 @@ void AddSC_deathknight_spell_scripts()
new spell_dk_improved_blood_presence();
new spell_dk_improved_frost_presence();
new spell_dk_improved_unholy_presence();
+ new spell_dk_pestilence();
new spell_dk_presence();
new spell_dk_raise_dead();
new spell_dk_rune_tap_party();
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/CMakeLists.txt b/src/server/scripts/World/CMakeLists.txt
index 7d1b46732cf..56a0a1eb4c7 100644
--- a/src/server/scripts/World/CMakeLists.txt
+++ b/src/server/scripts/World/CMakeLists.txt
@@ -8,20 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
+
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
- World/achievement_scripts.cpp
- World/areatrigger_scripts.cpp
- World/boss_emerald_dragons.cpp
- World/chat_log.cpp
- World/go_scripts.cpp
- World/guards.cpp
- World/item_scripts.cpp
- World/mob_generic_creature.cpp
- World/npc_innkeeper.cpp
- World/npc_professions.cpp
- World/npc_taxi.cpp
- World/npcs_special.cpp
+ ${sources_World}
)
message(" -> Prepared: World")
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
new file mode 100644
index 00000000000..d4f48ab19be
--- /dev/null
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -0,0 +1,315 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ScriptMgr.h"
+#include "Channel.h"
+#include "Guild.h"
+#include "Group.h"
+
+enum IPLoggingTypes
+{
+
+ // AccountActionIpLogger();
+ ACCOUNT_LOGIN = 0,
+ ACCOUNT_FAIL_LOGIN = 1,
+ ACCOUNT_CHANGE_PW = 2,
+ ACCOUNT_CHANGE_PW_FAIL = 3, // Only two types of account changes exist...
+ ACCOUNT_CHANGE_EMAIL = 4,
+ ACCOUNT_CHANGE_EMAIL_FAIL = 5, // ...so we log them individually
+ // OBSOLETE - ACCOUNT_LOGOUT = 6, /* Can not be logged. We still keep the type however */
+ // CharacterActionIpLogger();
+ CHARACTER_CREATE = 7,
+ CHARACTER_LOGIN = 8,
+ CHARACTER_LOGOUT = 9,
+ // CharacterDeleteActionIpLogger();
+ CHARACTER_DELETE = 10,
+ CHARACTER_FAILED_DELETE = 11,
+ // AccountActionIpLogger(), CharacterActionIpLogger(), CharacterActionIpLogger();
+ UNKNOWN_ACTION = 12
+};
+
+class AccountActionIpLogger : public AccountScript
+{
+ public:
+ AccountActionIpLogger() : AccountScript("AccountActionIpLogger") { }
+
+ // We log last_ip instead of last_attempt_ip, as login was successful
+ // ACCOUNT_LOGIN = 0
+ void OnAccountLogin(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_LOGIN);
+ }
+
+ // We log last_attempt_ip instead of last_ip, as failed login doesn't necessarily mean approperiate user
+ // ACCOUNT_FAIL_LOGIN = 1
+ void OnFailedAccountLogin(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_FAIL_LOGIN);
+ }
+
+ // ACCOUNT_CHANGE_PW = 2
+ void OnPasswordChange(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_CHANGE_PW);
+ }
+
+ // ACCOUNT_CHANGE_PW_FAIL = 3
+ void OnFailedPasswordChange(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_CHANGE_PW_FAIL);
+ }
+
+ // Registration Email can NOT be changed apart from GM level users. Thus, we do not require to log them...
+ // ACCOUNT_CHANGE_EMAIL = 4
+ void OnEmailChange(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_CHANGE_EMAIL); // ... they get logged by gm command logger anyway
+ }
+
+ // ACCOUNT_CHANGE_EMAIL_FAIL = 5
+ void OnFailedEmailChange(uint32 accountId)
+ {
+ AccountIPLogAction(accountId, ACCOUNT_CHANGE_EMAIL_FAIL);
+ }
+
+ /* It's impossible to log the account logout process out of character selection - shouldn't matter anyway,
+ * as ip doesn't change through playing (obviously).*/
+ // ACCOUNT_LOGOUT = 6
+ void AccountIPLogAction(uint32 accountId, IPLoggingTypes aType)
+ {
+ // Action IP Logger is only intialized if config is set up
+ // Else, this script isn't loaded in the first place: We require no config check.
+
+ // We declare all the required variables
+ uint32 playerGuid = accountId;
+ uint32 characterGuid = 0;
+ std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
+
+ // With this switch, we change systemNote so that we have a more accurate phrasing of what type it is.
+ // Avoids Magicnumbers in SQL table
+ switch (aType)
+ {
+ case ACCOUNT_LOGIN:
+ systemNote = "Logged on Successful AccountLogin";
+ break;
+ case ACCOUNT_FAIL_LOGIN:
+ systemNote = "Logged on Failed AccountLogin";
+ break;
+ case ACCOUNT_CHANGE_PW:
+ systemNote = "Logged on Successful Account Password Change";
+ break;
+ case ACCOUNT_CHANGE_PW_FAIL:
+ systemNote = "Logged on Failed Account Password Change";
+ break;
+ case ACCOUNT_CHANGE_EMAIL:
+ systemNote = "Logged on Successful Account Email Change";
+ break;
+ case ACCOUNT_CHANGE_EMAIL_FAIL:
+ systemNote = "Logged on Failed Account Email Change";
+ break;
+ /*case ACCOUNT_LOGOUT:
+ systemNote = "Logged on AccountLogout"; //Can not be logged
+ break;*/
+ // Neither should happen. Ever. Period. If it does, call Ghostbusters and all your local software defences to investigate.
+ case UNKNOWN_ACTION:
+ default:
+ systemNote = "ERROR! Unknown action!";
+ break;
+ }
+
+ // Once we have done everything, we can insert the new log.
+ // Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
+ // Rather, we let it be added with the SQL query.
+ if (aType != ACCOUNT_FAIL_LOGIN)
+ {
+ // As we can assume most account actions are NOT failed login, so this is the more accurate check.
+ // For those, we need last_ip...
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
+
+ stmt->setUInt32(0, playerGuid);
+ stmt->setUInt32(1, characterGuid);
+ stmt->setUInt8(2, aType);
+ stmt->setUInt32(3, playerGuid);
+ stmt->setString(4, systemNote.c_str());
+ LoginDatabase.Execute(stmt);
+ }
+ else // ... but for failed login, we query last_attempt_ip from account table. Which we do with an unique query
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING);
+
+ stmt->setUInt32(0, playerGuid);
+ stmt->setUInt32(1, characterGuid);
+ stmt->setUInt8(2, aType);
+ stmt->setUInt32(3, playerGuid);
+ stmt->setString(4, systemNote.c_str());
+ LoginDatabase.Execute(stmt);
+ }
+ return;
+ }
+};
+
+class CharacterActionIpLogger : public PlayerScript
+{
+ public:
+ CharacterActionIpLogger() : PlayerScript("CharacterActionIpLogger") { }
+
+ // CHARACTER_CREATE = 7
+ void OnCreate(Player* player)
+ {
+ CharacterIPLogAction(player, CHARACTER_CREATE);
+ }
+
+ // CHARACTER_LOGIN = 8
+ void OnLogin(Player* player)
+ {
+ CharacterIPLogAction(player, CHARACTER_LOGIN);
+ }
+
+ // CHARACTER_LOGOUT = 9
+ void OnLogout(Player* player)
+ {
+ CharacterIPLogAction(player, CHARACTER_LOGOUT);
+ }
+
+ // CHARACTER_DELETE = 10
+ // CHARACTER_FAILED_DELETE = 11
+ // We don't log either here - they require a guid
+
+ // UNKNOWN_ACTION = 12
+ // There is no real hook we could use for that.
+ // Shouldn't happen anyway, should it ? Nothing to see here.
+
+ /// Logs a number of actions done by players with an IP
+ void CharacterIPLogAction(Player* player, IPLoggingTypes aType)
+ {
+ // Action IP Logger is only intialized if config is set up
+ // Else, this script isn't loaded in the first place: We require no config check.
+
+ // We declare all the required variables
+ uint32 playerGuid = player->GetSession()->GetAccountId();
+ uint32 characterGuid = player->GetGUIDLow();
+ const std::string currentIp = player->GetSession()->GetRemoteAddress();
+ std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
+
+ // ... with this switch, so that we have a more accurate phrasing of what type it is
+ switch (aType)
+ {
+ case CHARACTER_CREATE:
+ systemNote = "Logged on CharacterCreate";
+ break;
+ case CHARACTER_LOGIN:
+ systemNote = "Logged on CharacterLogin";
+ break;
+ case CHARACTER_LOGOUT:
+ systemNote = "Logged on CharacterLogout";
+ break;
+ case CHARACTER_DELETE:
+ systemNote = "Logged on CharacterDelete";
+ break;
+ case CHARACTER_FAILED_DELETE:
+ systemNote = "Logged on Failed CharacterDelete";
+ break;
+ // Neither should happen. Ever. Period. If it does, call Mythbusters.
+ case UNKNOWN_ACTION:
+ default:
+ systemNote = "ERROR! Unknown action!";
+ break;
+ }
+
+ // Once we have done everything, we can insert the new log.
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING);
+
+ stmt->setUInt32(0, playerGuid);
+ stmt->setUInt32(1, characterGuid);
+ stmt->setUInt8(2, aType);
+ stmt->setString(3, currentIp.c_str()); // We query the ip here.
+ stmt->setString(4, systemNote.c_str());
+ // Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
+ // Rather, we let it be added with the SQL query.
+
+ LoginDatabase.Execute(stmt);
+ return;
+ }
+};
+
+class CharacterDeleteActionIpLogger : public PlayerScript
+{
+public:
+ CharacterDeleteActionIpLogger() : PlayerScript("CharacterDeleteActionIpLogger") { }
+
+ // CHARACTER_DELETE = 10
+ void OnDelete(uint64 guid, uint32 accountId)
+ {
+ DeleteIPLogAction(guid, accountId, CHARACTER_DELETE);
+ }
+
+ // CHARACTER_FAILED_DELETE = 11
+ void OnFailedDelete(uint64 guid, uint32 accountId)
+ {
+ DeleteIPLogAction(guid, accountId, CHARACTER_FAILED_DELETE);
+ }
+
+ void DeleteIPLogAction(uint64 guid, uint32 playerGuid, IPLoggingTypes aType)
+ {
+ // Action IP Logger is only intialized if config is set up
+ // Else, this script isn't loaded in the first place: We require no config check.
+
+ // We declare all the required variables
+ uint32 characterGuid = GUID_LOPART(guid); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way.
+ // Query playerGuid/accountId, as we only have characterGuid
+ std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
+
+ // With this switch, we change systemNote so that we have a more accurate phrasing of what type it is.
+ // Avoids Magicnumbers in SQL table
+ switch (aType)
+ {
+ case CHARACTER_DELETE:
+ systemNote = "Logged on CharacterDelete";
+ break;
+ case CHARACTER_FAILED_DELETE:
+ systemNote = "Logged on Failed CharacterDelete";
+ break;
+ // Neither should happen. Ever. Period. If it does, call to whatever god you have for mercy and guidance.
+ case UNKNOWN_ACTION:
+ default:
+ systemNote = "ERROR! Unknown action!";
+ break;
+ }
+
+ // Once we have done everything, we can insert the new log.
+ PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
+
+ stmt2->setUInt32(0, playerGuid);
+ stmt2->setUInt32(1, characterGuid);
+ stmt2->setUInt8(2, aType);
+ stmt2->setUInt32(3, playerGuid);
+ stmt2->setString(4, systemNote.c_str());
+ // Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
+ // Rather, we let it be added with the SQL query.
+
+ LoginDatabase.Execute(stmt2);
+ return;
+ }
+};
+
+
+void AddSC_action_ip_logger()
+{
+ new AccountActionIpLogger();
+ new CharacterActionIpLogger();
+ new CharacterDeleteActionIpLogger();
+}
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index 73093037689..4393f72eb1b 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -51,11 +51,7 @@ enum CoilfangGOs
class AreaTrigger_at_coilfang_waterfall : public AreaTriggerScript
{
public:
-
- AreaTrigger_at_coilfang_waterfall()
- : AreaTriggerScript("at_coilfang_waterfall")
- {
- }
+ AreaTrigger_at_coilfang_waterfall() : AreaTriggerScript("at_coilfang_waterfall") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) override
{
@@ -83,11 +79,7 @@ enum LegionTeleporter
class AreaTrigger_at_legion_teleporter : public AreaTriggerScript
{
public:
-
- AreaTrigger_at_legion_teleporter()
- : AreaTriggerScript("at_legion_teleporter")
- {
- }
+ AreaTrigger_at_legion_teleporter() : AreaTriggerScript("at_legion_teleporter") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) override
{
@@ -125,11 +117,7 @@ enum StormwrightShelf
class AreaTrigger_at_stormwright_shelf : public AreaTriggerScript
{
public:
-
- AreaTrigger_at_stormwright_shelf()
- : AreaTriggerScript("at_stormwright_shelf")
- {
- }
+ AreaTrigger_at_stormwright_shelf() : AreaTriggerScript("at_stormwright_shelf") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) override
{
@@ -153,11 +141,7 @@ enum ScentLarkorwi
class AreaTrigger_at_scent_larkorwi : public AreaTriggerScript
{
public:
-
- AreaTrigger_at_scent_larkorwi()
- : AreaTriggerScript("at_scent_larkorwi")
- {
- }
+ AreaTrigger_at_scent_larkorwi() : AreaTriggerScript("at_scent_larkorwi") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) override
{
@@ -184,11 +168,7 @@ enum AtLastRites
class AreaTrigger_at_last_rites : public AreaTriggerScript
{
public:
-
- AreaTrigger_at_last_rites()
- : AreaTriggerScript("at_last_rites")
- {
- }
+ AreaTrigger_at_last_rites() : AreaTriggerScript("at_last_rites") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
{
@@ -246,7 +226,6 @@ enum Waygate
class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
{
public:
-
AreaTrigger_at_sholazar_waygate() : AreaTriggerScript("at_sholazar_waygate") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
@@ -461,11 +440,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/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index ca00b0fc352..4bb88a560bb 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -118,7 +118,8 @@ public:
enum GildedBrazier
{
- NPC_STILLBLADE = 17716,
+ NPC_STILLBLADE = 17716,
+ QUEST_THE_FIRST_TRIAL = 9678
};
class go_gilded_brazier : public GameObjectScript
@@ -130,7 +131,7 @@ public:
{
if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER)
{
- if (player->GetQuestStatus(9678) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_THE_FIRST_TRIAL) == QUEST_STATUS_INCOMPLETE)
{
if (Creature* Stillblade = player->SummonCreature(NPC_STILLBLADE, 8106.11f, -7542.06f, 151.775f, 3.02598f, TEMPSUMMON_DEAD_DESPAWN, 60000))
Stillblade->AI()->AttackStart(player);
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index 416cab8efcd..a156a41fcef 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);
@@ -387,7 +387,7 @@ public:
void AddSC_guards()
{
- new guard_generic;
- new guard_shattrath_aldor;
- new guard_shattrath_scryer;
+ new guard_generic();
+ new guard_shattrath_aldor();
+ new guard_shattrath_scryer();
}
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 30666d5d2ea..2eb91b7b8fe 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -229,6 +229,6 @@ public:
void AddSC_generic_creature()
{
//new generic_creature;
- new trigger_periodic;
+ new trigger_periodic();
//new trigger_death;
}
diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp
index b647cccf8ea..be56e57cc9d 100644
--- a/src/server/scripts/World/npc_innkeeper.cpp
+++ b/src/server/scripts/World/npc_innkeeper.cpp
@@ -134,6 +134,6 @@ public:
void AddSC_npc_innkeeper()
{
- new npc_innkeeper;
+ new npc_innkeeper();
}
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 891ffd83628..e67823a2939 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;
@@ -184,7 +185,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
-
{
if (!SpawnAssoc)
return;
@@ -671,7 +671,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 +768,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 +814,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 +1064,7 @@ public:
{
if (RunAwayTimer <= diff)
{
- if (Unit* unit = Unit::GetUnit(*me, CasterGUID))
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, CasterGUID))
{
switch (me->GetEntry())
{
@@ -1519,7 +1519,10 @@ class npc_brewfest_reveler : public CreatureScript
enum TrainingDummy
{
NPC_ADVANCED_TARGET_DUMMY = 2674,
- NPC_TARGET_DUMMY = 2673
+ NPC_TARGET_DUMMY = 2673,
+
+ EVENT_TD_CHECK_COMBAT = 1,
+ EVENT_TD_DESPAWN = 2
};
class npc_training_dummy : public CreatureScript
@@ -1532,20 +1535,22 @@ public:
npc_training_dummyAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
- entry = creature->GetEntry();
}
- uint32 entry;
- uint32 resetTimer;
- uint32 despawnTimer;
+ EventMap _events;
+ std::unordered_map<uint64, time_t> _damageTimes;
void Reset() override
{
me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave
- resetTimer = 5000;
- despawnTimer = 15000;
+ _events.Reset();
+ _damageTimes.clear();
+ if (me->GetEntry() != NPC_ADVANCED_TARGET_DUMMY && me->GetEntry() != NPC_TARGET_DUMMY)
+ _events.ScheduleEvent(EVENT_TD_CHECK_COMBAT, 1000);
+ else
+ _events.ScheduleEvent(EVENT_TD_DESPAWN, 15000);
}
void EnterEvadeMode() override
@@ -1556,37 +1561,52 @@ public:
Reset();
}
- void DamageTaken(Unit* /*doneBy*/, uint32& damage) override
+ void DamageTaken(Unit* doneBy, uint32& damage) override
{
- resetTimer = 5000;
+ me->AddThreat(doneBy, float(damage)); // just to create threat reference
+ _damageTimes[doneBy->GetGUID()] = time(NULL);
damage = 0;
}
void UpdateAI(uint32 diff) override
{
- if (!UpdateVictim())
+ if (!me->IsInCombat())
return;
if (!me->HasUnitState(UNIT_STATE_STUNNED))
me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate
- if (entry != NPC_ADVANCED_TARGET_DUMMY && entry != NPC_TARGET_DUMMY)
+ _events.Update(diff);
+
+ if (uint32 eventId = _events.ExecuteEvent())
{
- if (resetTimer <= diff)
+ switch (eventId)
{
- EnterEvadeMode();
- resetTimer = 5000;
+ case EVENT_TD_CHECK_COMBAT:
+ {
+ time_t now = time(NULL);
+ for (std::unordered_map<uint64, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
+ {
+ // If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
+ if (itr->second < now - 5)
+ {
+ if (Unit* unit = ObjectAccessor::GetUnit(*me, itr->first))
+ unit->getHostileRefManager().deleteReference(me);
+
+ itr = _damageTimes.erase(itr);
+ }
+ else
+ ++itr;
+ }
+ _events.ScheduleEvent(EVENT_TD_CHECK_COMBAT, 1000);
+ break;
+ }
+ case EVENT_TD_DESPAWN:
+ me->DespawnOrUnsummon(1);
+ break;
+ default:
+ break;
}
- else
- resetTimer -= diff;
- return;
- }
- else
- {
- if (despawnTimer <= diff)
- me->DespawnOrUnsummon();
- else
- despawnTimer -= diff;
}
}
@@ -2319,7 +2339,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 +2373,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 +2449,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/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index de1e5b992e6..488ff18dca4 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -69,6 +69,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_LAST_IP, "UPDATE account SET last_ip = ? WHERE username = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_UPD_LAST_ATTEMPT_IP, "UPDATE account SET last_attempt_ip = ? WHERE username = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_ONLINE, "UPDATE account SET online = 1 WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_UPTIME_PLAYERS, "UPDATE uptime SET uptime = ?, maxplayers = ? WHERE realmid = ? AND starttime = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_OLD_LOGS, "DELETE FROM logs WHERE (time + ?) < ?", CONNECTION_ASYNC);
@@ -90,12 +91,21 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_ACCOUNT_RECRUITER, "SELECT 1 FROM account WHERE recruiter = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_BANS, "SELECT 1 FROM account_banned WHERE id = ? AND active = 1 UNION SELECT 1 FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_LAST_ATTEMPT_IP, "SELECT last_attempt_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_LAST_IP, "SELECT last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_GET_EMAIL_BY_ID, "SELECT email FROM account WHERE id = ?", CONNECTION_SYNCH);
-
+ // 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_AccountLoginDeLete_IP_Logging"
+ PrepareStatement(LOGIN_INS_ALDL_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
+ // 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_FailedAccountLogin_IP_Logging"
+ PrepareStatement(LOGIN_INS_FACL_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_attempt_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
+ // 0: uint32, 1: uint32, 2: uint8, 3: string, 4: string // Complete name: "Login_Insert_CharacterDelete_IP_Logging"
+ PrepareStatement(LOGIN_INS_CHAR_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
+ // 0: string, 1: string, 2: string // Complete name: "Login_Insert_Failed_Account_Login_due_password_IP_Logging"
+ PrepareStatement(LOGIN_INS_FALP_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES ((SELECT id FROM account WHERE username = ?), 0, 1, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_ACCESS_BY_ID, "SELECT gmlevel, RealmID FROM account_access WHERE id = ? and (RealmID = ? OR RealmID = -1) ORDER BY gmlevel desc", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS, "SELECT permissionId, granted FROM rbac_account_permissions WHERE accountId = ? AND (realmId = ? OR realmId = -1) ORDER BY permissionId, realmId", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 01f9fd973b6..604e9d39551 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -89,6 +89,7 @@ enum LoginDatabaseStatements
LOGIN_UPD_MUTE_TIME,
LOGIN_UPD_MUTE_TIME_LOGIN,
LOGIN_UPD_LAST_IP,
+ LOGIN_UPD_LAST_ATTEMPT_IP,
LOGIN_UPD_ACCOUNT_ONLINE,
LOGIN_UPD_UPTIME_PLAYERS,
LOGIN_DEL_OLD_LOGS,
@@ -114,7 +115,13 @@ enum LoginDatabaseStatements
LOGIN_DEL_ACCOUNT,
LOGIN_SEL_IP2NATION_COUNTRY,
LOGIN_SEL_AUTOBROADCAST,
+ LOGIN_SEL_LAST_ATTEMPT_IP,
+ LOGIN_SEL_LAST_IP,
LOGIN_GET_EMAIL_BY_ID,
+ LOGIN_INS_ALDL_IP_LOGGING,
+ LOGIN_INS_FACL_IP_LOGGING,
+ LOGIN_INS_CHAR_IP_LOGGING,
+ LOGIN_INS_FALP_IP_LOGGING,
LOGIN_SEL_ACCOUNT_ACCESS_BY_ID,
LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS,
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index 3b6bd3d2cc8..d5ad7f15a04 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 =============================
@@ -60,6 +60,7 @@ HANDLE WheatyExceptionReport::m_hReportFile;
HANDLE WheatyExceptionReport::m_hDumpFile;
HANDLE WheatyExceptionReport::m_hProcess;
SymbolPairs WheatyExceptionReport::symbols;
+std::stack<SymbolDetail> WheatyExceptionReport::symbolDetails;
// Declare global instance of class
WheatyExceptionReport g_WheatyExceptionReport;
@@ -767,18 +768,21 @@ ULONG /*SymbolSize*/,
PVOID UserContext)
{
- char szBuffer[1024 * 64];
+ char szBuffer[WER_LARGE_BUFFER_SIZE];
+ memset(szBuffer, 0, sizeof(szBuffer));
__try
{
ClearSymbols();
if (FormatSymbolValue(pSymInfo, (STACKFRAME64*)UserContext,
szBuffer, sizeof(szBuffer)))
- _tprintf(_T("\t%s\r\n"), szBuffer);
+ _tprintf(_T("%s"), szBuffer);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
- _tprintf(_T("punting on symbol %s\r\n"), pSymInfo->Name);
+ _tprintf(_T("punting on symbol %s, partial output:\r\n"), pSymInfo->Name);
+ if (szBuffer[0] != '\0')
+ _tprintf(_T("%s"), szBuffer);
}
return TRUE;
@@ -797,12 +801,6 @@ unsigned /*cbBuffer*/)
{
char * pszCurrBuffer = pszBuffer;
- // Indicate if the variable is a local or parameter
- if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER)
- pszCurrBuffer += sprintf(pszCurrBuffer, "Parameter ");
- else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_LOCAL)
- pszCurrBuffer += sprintf(pszCurrBuffer, "Local ");
-
// If it's a function, don't do anything.
if (pSym->Tag == SymTagFunction) // SymTagFunction from CVCONST.H from the DIA SDK
return false;
@@ -824,19 +822,25 @@ unsigned /*cbBuffer*/)
// return false;
}
else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGISTER)
- {
return false; // Don't try to report register variable
- }
else
{
pVariable = (DWORD_PTR)pSym->Address; // It must be a global variable
}
+ pszCurrBuffer = PushSymbolDetail(pszCurrBuffer);
+
+ // Indicate if the variable is a local or parameter
+ if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER)
+ symbolDetails.top().Prefix = "Parameter ";
+ else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_LOCAL)
+ symbolDetails.top().Prefix = "Local ";
+
// Determine if the variable is a user defined type (UDT). IF so, bHandled
// will return true.
bool bHandled;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, pSym->ModBase, pSym->TypeIndex,
- 0, pVariable, bHandled, pSym->Name, "");
+ 0, pVariable, bHandled, pSym->Name, "", false, true);
if (!bHandled)
{
@@ -844,15 +848,19 @@ unsigned /*cbBuffer*/)
// variable. Based on the size, we're assuming it's a char, WORD, or
// DWORD.
BasicType basicType = GetBasicType(pSym->TypeIndex, pSym->ModBase);
- pszCurrBuffer += sprintf(pszCurrBuffer, rgBaseType[basicType]);
+ if (symbolDetails.top().Type.empty())
+ symbolDetails.top().Type = rgBaseType[basicType];
// Emit the variable name
- pszCurrBuffer += sprintf(pszCurrBuffer, "\'%s\'", pSym->Name);
+ if (pSym->Name[0] != '\0')
+ symbolDetails.top().Name = pSym->Name;
- pszCurrBuffer = FormatOutputValue(pszCurrBuffer, basicType, pSym->Size,
- (PVOID)pVariable);
+ char buffer[50];
+ FormatOutputValue(buffer, basicType, pSym->Size, (PVOID)pVariable, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
}
+ pszCurrBuffer = PopSymbolDetail(pszCurrBuffer);
return true;
}
@@ -868,13 +876,15 @@ DWORD dwTypeIndex,
unsigned nestingLevel,
DWORD_PTR offset,
bool & bHandled,
-char* Name,
-char* suffix)
+const char* Name,
+char* suffix,
+bool newSymbol,
+bool logChildren)
{
bHandled = false;
- if (!StoreSymbol(dwTypeIndex, offset))
- return pszCurrBuffer;
+ if (newSymbol)
+ pszCurrBuffer = PushSymbolDetail(pszCurrBuffer);
DWORD typeTag;
if (!SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_SYMTAG, &typeTag))
@@ -890,19 +900,39 @@ char* suffix)
if (wcscmp(pwszTypeName, L"std::basic_string<char,std::char_traits<char>,std::allocator<char> >") == 0)
{
LocalFree(pwszTypeName);
- pszCurrBuffer += sprintf(pszCurrBuffer, " %s", "std::string");
- pszCurrBuffer = FormatOutputValue(pszCurrBuffer, btStdString, 0, (PVOID)offset);
- pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n");
+ symbolDetails.top().Type = "std::string";
+ char buffer[50];
+ FormatOutputValue(buffer, btStdString, 0, (PVOID)offset, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
+ if (Name != NULL && Name[0] != '\0')
+ symbolDetails.top().Name = Name;
bHandled = true;
return pszCurrBuffer;
}
- pszCurrBuffer += sprintf(pszCurrBuffer, " %ls", pwszTypeName);
+ char buffer[200];
+ wcstombs(buffer, pwszTypeName, sizeof(buffer));
+ buffer[199] = '\0';
+ if (Name != NULL && Name[0] != '\0')
+ {
+ symbolDetails.top().Type = buffer;
+ symbolDetails.top().Name = Name;
+ }
+ else if (buffer[0] != '\0')
+ symbolDetails.top().Name = buffer;
+
LocalFree(pwszTypeName);
}
+ else if (Name != NULL && Name[0] != '\0')
+ symbolDetails.top().Name = Name;
- if (strlen(suffix) > 0)
- pszCurrBuffer += sprintf(pszCurrBuffer, "%s", suffix);
+ if (!StoreSymbol(dwTypeIndex, offset))
+ {
+ // Skip printing address and base class if it has been printed already
+ if (typeTag == SymTagBaseClass)
+ bHandled = true;
+ return pszCurrBuffer;
+ }
DWORD innerTypeID;
switch (typeTag)
@@ -910,11 +940,9 @@ char* suffix)
case SymTagPointerType:
if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_TYPEID, &innerTypeID))
{
-#define MAX_NESTING_LEVEL 5
- if (nestingLevel >= MAX_NESTING_LEVEL)
- break;
+ if (Name != NULL && Name[0] != '\0')
+ symbolDetails.top().Name = Name;
- pszCurrBuffer += sprintf(pszCurrBuffer, " %s", Name);
BOOL isReference;
SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_IS_REFERENCE, &isReference);
@@ -922,44 +950,56 @@ char* suffix)
memset(addressStr, 0, sizeof(addressStr));
if (isReference)
- addressStr[0] = '&';
+ symbolDetails.top().Suffix += "&";
else
- addressStr[0] = '*';
+ symbolDetails.top().Suffix += "*";
- DWORD_PTR address = *(PDWORD_PTR)offset;
- if (address == NULL)
- {
- pwszTypeName;
- if (SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_SYMNAME,
- &pwszTypeName))
- {
- pszCurrBuffer += sprintf(pszCurrBuffer, " %ls", pwszTypeName);
- LocalFree(pwszTypeName);
- }
+ // Try to dereference the pointer in a try/except block since it might be invalid
+ DWORD_PTR address = DereferenceUnsafePointer(offset);
- pszCurrBuffer += sprintf(pszCurrBuffer, "%s = NULL\r\n", addressStr);
+ char buffer[50];
+ FormatOutputValue(buffer, btVoid, sizeof(PVOID), (PVOID)offset, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
- bHandled = true;
- return pszCurrBuffer;
- }
- else
- {
- FormatOutputValue(&addressStr[1], btVoid, sizeof(PVOID), (PVOID)offset);
- pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
- address, bHandled, "", addressStr);
+ if (nestingLevel >= WER_MAX_NESTING_LEVEL)
+ logChildren = false;
+
+ // no need to log any children since the address is invalid anyway
+ if (address == NULL || address == DWORD_PTR(-1))
+ logChildren = false;
- if (!bHandled)
+ pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
+ address, bHandled, Name, addressStr, false, logChildren);
+
+ if (!bHandled)
+ {
+ BasicType basicType = GetBasicType(dwTypeIndex, modBase);
+ if (symbolDetails.top().Type.empty())
+ symbolDetails.top().Type = rgBaseType[basicType];
+
+ if (address == NULL)
+ symbolDetails.top().Value = "NULL";
+ else if (address == DWORD_PTR(-1))
+ symbolDetails.top().Value = "<Unable to read memory>";
+ else
{
- BasicType basicType = GetBasicType(dwTypeIndex, modBase);
- pszCurrBuffer += sprintf(pszCurrBuffer, rgBaseType[basicType]);
// Get the size of the child member
ULONG64 length;
SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_LENGTH, &length);
- pszCurrBuffer = FormatOutputValue(pszCurrBuffer, basicType, length, (PVOID)address);
- pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n");
- bHandled = true;
- return pszCurrBuffer;
+ char buffer[50];
+ FormatOutputValue(buffer, basicType, length, (PVOID)address, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
}
+ bHandled = true;
+ return pszCurrBuffer;
+ }
+ else if (address == NULL)
+ symbolDetails.top().Value = "NULL";
+ else if (address == DWORD_PTR(-1))
+ {
+ symbolDetails.top().Value = "<Unable to read memory>";
+ bHandled = true;
+ return pszCurrBuffer;
}
}
break;
@@ -970,13 +1010,80 @@ char* suffix)
if (!SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_SYMTAG, &innerTypeTag))
break;
- if (innerTypeTag == SymTagPointerType)
+ switch (innerTypeTag)
{
- pszCurrBuffer += sprintf(pszCurrBuffer, " %s", Name);
+ case SymTagUDT:
+ if (nestingLevel >= WER_MAX_NESTING_LEVEL)
+ logChildren = false;
+ pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
+ offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
+ break;
+ case SymTagPointerType:
+ if (Name != NULL && Name[0] != '\0')
+ symbolDetails.top().Name = Name;
+ pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
+ offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
+ break;
+ case SymTagArrayType:
+ pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
+ offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case SymTagArrayType:
+ if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_TYPEID, &innerTypeID))
+ {
+ symbolDetails.top().HasChildren = true;
+
+ BasicType basicType = btNoType;
+ pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
+ offset, bHandled, Name, "", false, false);
+
+ // Set Value back to an empty string since the Array object itself has no value, only its elements have
+ symbolDetails.top().Value = "";
+
+ DWORD elementsCount;
+ if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_COUNT, &elementsCount))
+ symbolDetails.top().Suffix += "[" + std::to_string(elementsCount) + "]";
+ else
+ symbolDetails.top().Suffix += "[<unknown count>]";
- pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
- offset, bHandled, "", "");
+ if (!bHandled)
+ {
+ basicType = GetBasicType(dwTypeIndex, modBase);
+ if (symbolDetails.top().Type.empty())
+ symbolDetails.top().Type = rgBaseType[basicType];
+ bHandled = true;
}
+
+ // Get the size of the child member
+ ULONG64 length;
+ SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_LENGTH, &length);
+
+ char buffer[50];
+ switch (basicType)
+ {
+ case btChar:
+ case btStdString:
+ FormatOutputValue(buffer, basicType, length, (PVOID)offset, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
+ break;
+ default:
+ for (DWORD index = 0; index < elementsCount && index < WER_MAX_ARRAY_ELEMENTS_COUNT; index++)
+ {
+ pszCurrBuffer = PushSymbolDetail(pszCurrBuffer);
+ symbolDetails.top().Suffix += "[" + std::to_string(index) + "]";
+ FormatOutputValue(buffer, basicType, length, (PVOID)(offset + length * index), sizeof(buffer));
+ symbolDetails.top().Value = buffer;
+ pszCurrBuffer = PopSymbolDetail(pszCurrBuffer);
+ }
+ break;
+ }
+
+ return pszCurrBuffer;
}
break;
case SymTagBaseType:
@@ -1013,26 +1120,37 @@ char* suffix)
return pszCurrBuffer;
}
- // Append a line feed
- pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n");
-
// Iterate through each of the children
for (unsigned i = 0; i < dwChildrenCount; i++)
{
DWORD symTag;
SymGetTypeInfo(m_hProcess, modBase, children.ChildId[i], TI_GET_SYMTAG, &symTag);
- if (symTag == SymTagFunction || symTag == SymTagTypedef)
+ if (symTag == SymTagFunction ||
+ symTag == SymTagEnum ||
+ symTag == SymTagTypedef ||
+ symTag == SymTagVTable)
continue;
- // Add appropriate indentation level (since this routine is recursive)
- for (unsigned j = 0; j <= nestingLevel+1; j++)
- pszCurrBuffer += sprintf(pszCurrBuffer, "\t");
+ // Ignore static fields
+ DWORD dataKind;
+ SymGetTypeInfo(m_hProcess, modBase, children.ChildId[i], TI_GET_DATAKIND, &dataKind);
+ if (dataKind == DataIsStaticLocal ||
+ dataKind == DataIsGlobal ||
+ dataKind == DataIsStaticMember)
+ continue;
+
+
+ symbolDetails.top().HasChildren = true;
+ if (!logChildren)
+ {
+ bHandled = false;
+ return pszCurrBuffer;
+ }
// Recurse for each of the child types
bool bHandled2;
BasicType basicType = GetBasicType(children.ChildId[i], modBase);
- pszCurrBuffer += sprintf(pszCurrBuffer, rgBaseType[basicType]);
// Get the offset of the child member, relative to its parent
DWORD dwMemberOffset;
@@ -1044,11 +1162,14 @@ char* suffix)
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase,
children.ChildId[i], nestingLevel+1,
- dwFinalOffset, bHandled2, ""/*Name */, "");
+ dwFinalOffset, bHandled2, ""/*Name */, "", true, true);
// If the child wasn't a UDT, format it appropriately
if (!bHandled2)
{
+ if (symbolDetails.top().Type.empty())
+ symbolDetails.top().Type = rgBaseType[basicType];
+
// Get the real "TypeId" of the child. We need this for the
// SymGetTypeInfo(TI_GET_TYPEID) call below.
DWORD typeId;
@@ -1059,75 +1180,75 @@ char* suffix)
ULONG64 length;
SymGetTypeInfo(m_hProcess, modBase, typeId, TI_GET_LENGTH, &length);
- pszCurrBuffer = FormatOutputValue(pszCurrBuffer, basicType,
- length, (PVOID)dwFinalOffset);
-
- pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n");
+ char buffer[50];
+ FormatOutputValue(buffer, basicType, length, (PVOID)dwFinalOffset, sizeof(buffer));
+ symbolDetails.top().Value = buffer;
}
+
+ pszCurrBuffer = PopSymbolDetail(pszCurrBuffer);
}
bHandled = true;
return pszCurrBuffer;
}
-char * WheatyExceptionReport::FormatOutputValue(char * pszCurrBuffer,
+void WheatyExceptionReport::FormatOutputValue(char * pszCurrBuffer,
BasicType basicType,
DWORD64 length,
-PVOID pAddress)
+PVOID pAddress,
+size_t bufferSize)
{
__try
{
switch (basicType)
{
case btChar:
- pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%s\"", pAddress);
+ {
+ if (strlen((char*)pAddress) > bufferSize - 6)
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, (char*)pAddress);
+ else
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%s\"", (char*)pAddress);
break;
+ }
case btStdString:
- pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%s\"", static_cast<std::string*>(pAddress)->c_str());
+ {
+ std::string* value = static_cast<std::string*>(pAddress);
+ if (value->length() > bufferSize - 6)
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, value->c_str());
+ else
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%s\"", value->c_str());
break;
+ }
default:
// Format appropriately (assuming it's a 1, 2, or 4 bytes (!!!)
if (length == 1)
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PBYTE)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", *(PBYTE)pAddress);
else if (length == 2)
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", *(PWORD)pAddress);
else if (length == 4)
{
if (basicType == btFloat)
- {
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %f", *(PFLOAT)pAddress);
- }
- else if (basicType == btChar)
- {
- if (!IsBadStringPtr(*(PSTR*)pAddress, 32))
- {
- pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%.31s\"",
- *(PSTR*)pAddress);
- }
- else
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %X",
- *(PDWORD)pAddress);
- }
+ pszCurrBuffer += sprintf(pszCurrBuffer, "%f", *(PFLOAT)pAddress);
else
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PDWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", *(PDWORD)pAddress);
}
else if (length == 8)
{
if (basicType == btFloat)
{
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %lf",
+ pszCurrBuffer += sprintf(pszCurrBuffer, "%lf",
*(double *)pAddress);
}
else
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %I64X",
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X",
*(DWORD64*)pAddress);
}
else
{
#if _WIN64
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %I64X", (DWORD64*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X", (DWORD64*)pAddress);
#else
- pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", (PDWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", (PDWORD)pAddress);
#endif
}
break;
@@ -1136,13 +1257,11 @@ PVOID pAddress)
__except (EXCEPTION_EXECUTE_HANDLER)
{
#if _WIN64
- pszCurrBuffer += sprintf(pszCurrBuffer, " <Unable to read memory> = %I64X", (DWORD64*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X <Unable to read memory>", (DWORD64*)pAddress);
#else
- pszCurrBuffer += sprintf(pszCurrBuffer, " <Unable to read memory> = %X", (PDWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X <Unable to read memory>", (PDWORD)pAddress);
#endif
}
-
- return pszCurrBuffer;
}
BasicType
@@ -1170,13 +1289,25 @@ WheatyExceptionReport::GetBasicType(DWORD typeIndex, DWORD64 modBase)
return btNoType;
}
+DWORD_PTR WheatyExceptionReport::DereferenceUnsafePointer(DWORD_PTR address)
+{
+ __try
+ {
+ return *(PDWORD_PTR)address;
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER)
+ {
+ return DWORD_PTR(-1);
+ }
+}
+
//============================================================================
// Helper function that writes to the report file, and allows the user to use
// printf style formating
//============================================================================
int __cdecl WheatyExceptionReport::_tprintf(const TCHAR * format, ...)
{
- TCHAR szBuff[1024 * 64];
+ TCHAR szBuff[WER_LARGE_BUFFER_SIZE];
int retValue;
DWORD cbWritten;
va_list argptr;
@@ -1198,6 +1329,41 @@ bool WheatyExceptionReport::StoreSymbol(DWORD type, DWORD_PTR offset)
void WheatyExceptionReport::ClearSymbols()
{
symbols.clear();
+ while (!symbolDetails.empty())
+ symbolDetails.pop();
+}
+
+char* WheatyExceptionReport::PushSymbolDetail(char* pszCurrBuffer)
+{
+ // Log current symbol and then add another to the stack to keep the hierarchy format
+ pszCurrBuffer = PrintSymbolDetail(pszCurrBuffer);
+ symbolDetails.emplace();
+ return pszCurrBuffer;
+}
+
+char* WheatyExceptionReport::PopSymbolDetail(char* pszCurrBuffer)
+{
+ pszCurrBuffer = PrintSymbolDetail(pszCurrBuffer);
+ symbolDetails.pop();
+ return pszCurrBuffer;
+}
+
+char* WheatyExceptionReport::PrintSymbolDetail(char* pszCurrBuffer)
+{
+ if (symbolDetails.empty())
+ return pszCurrBuffer;
+
+ // Don't log anything if has been logged already or if it's empty
+ if (symbolDetails.top().Logged || symbolDetails.top().empty())
+ return pszCurrBuffer;
+
+ // Add appropriate indentation level (since this routine is recursive)
+ for (size_t i = 0; i < symbolDetails.size(); i++)
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\t");
+
+ pszCurrBuffer += sprintf(pszCurrBuffer, "%s\r\n", symbolDetails.top().ToString().c_str());
+
+ return pszCurrBuffer;
}
#endif // _WIN32
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h
index f6d6b7f4b9e..9137b91aac9 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.h
+++ b/src/server/shared/Debugging/WheatyExceptionReport.h
@@ -5,12 +5,13 @@
#include <dbghelp.h>
#include <set>
-#if _MSC_VER < 1400
-# define countof(array) (sizeof(array) / sizeof(array[0]))
-#else
-# include <stdlib.h>
-# define countof _countof
-#endif // _MSC_VER < 1400
+#include <stdlib.h>
+#include <stack>
+#define countof _countof
+
+#define WER_MAX_ARRAY_ELEMENTS_COUNT 10
+#define WER_MAX_NESTING_LEVEL 5
+#define WER_LARGE_BUFFER_SIZE 1024 * 128
enum BasicType // Stolen from CVCONST.H in the DIA 2.0 SDK
{
@@ -37,40 +38,54 @@ enum BasicType // Stolen from CVCON
btStdString = 101
};
+enum DataKind // Stolen from CVCONST.H in the DIA 2.0 SDK
+{
+ DataIsUnknown,
+ DataIsLocal,
+ DataIsStaticLocal,
+ DataIsParam,
+ DataIsObjectPtr,
+ DataIsFileStatic,
+ DataIsGlobal,
+ DataIsMember,
+ DataIsStaticMember,
+ DataIsConstant
+};
+
const char* const rgBaseType[] =
{
- " <user defined> ", // btNoType = 0,
- " void ", // btVoid = 1,
- " char* ", // btChar = 2,
- " wchar_t* ", // btWChar = 3,
- " signed char ",
- " unsigned char ",
- " int ", // btInt = 6,
- " unsigned int ", // btUInt = 7,
- " float ", // btFloat = 8,
- " <BCD> ", // btBCD = 9,
- " bool ", // btBool = 10,
- " short ",
- " unsigned short ",
- " long ", // btLong = 13,
- " unsigned long ", // btULong = 14,
- " __int8 ",
- " __int16 ",
- " __int32 ",
- " __int64 ",
- " __int128 ",
- " unsigned __int8 ",
- " unsigned __int16 ",
- " unsigned __int32 ",
- " unsigned __int64 ",
- " unsigned __int128 ",
- " <currency> ", // btCurrency = 25,
- " <date> ", // btDate = 26,
- " VARIANT ", // btVariant = 27,
- " <complex> ", // btComplex = 28,
- " <bit> ", // btBit = 29,
- " BSTR ", // btBSTR = 30,
- " HRESULT " // btHresult = 31
+ "<user defined>", // btNoType = 0,
+ "void", // btVoid = 1,
+ "char",//char* // btChar = 2,
+ "wchar_t*", // btWChar = 3,
+ "signed char",
+ "unsigned char",
+ "int", // btInt = 6,
+ "unsigned int", // btUInt = 7,
+ "float", // btFloat = 8,
+ "<BCD>", // btBCD = 9,
+ "bool", // btBool = 10,
+ "short",
+ "unsigned short",
+ "long", // btLong = 13,
+ "unsigned long", // btULong = 14,
+ "int8",
+ "int16",
+ "int32",
+ "int64",
+ "int128",
+ "uint8",
+ "uint16",
+ "uint32",
+ "uint64",
+ "uint128",
+ "<currency>", // btCurrency = 25,
+ "<date>", // btDate = 26,
+ "VARIANT", // btVariant = 27,
+ "<complex>", // btComplex = 28,
+ "<bit>", // btBit = 29,
+ "BSTR", // btBSTR = 30,
+ "HRESULT" // btHresult = 31
};
struct SymbolPair
@@ -83,7 +98,7 @@ struct SymbolPair
bool operator<(const SymbolPair& other) const
{
- return _offset < other._offset ||
+ return _offset < other._offset ||
(_offset == other._offset && _type < other._type);
}
@@ -92,6 +107,39 @@ struct SymbolPair
};
typedef std::set<SymbolPair> SymbolPairs;
+struct SymbolDetail
+{
+ SymbolDetail() : Prefix(), Type(), Suffix(), Name(), Value(), Logged(false), HasChildren(false) {}
+
+ std::string ToString()
+ {
+ Logged = true;
+ std::string formatted = Prefix + Type + Suffix;
+ if (!Name.empty())
+ {
+ if (!formatted.empty())
+ formatted += " ";
+ formatted += Name;
+ }
+ if (!Value.empty())
+ formatted += " = " + Value;
+ return formatted;
+ }
+
+ bool empty() const
+ {
+ return Value.empty() && !HasChildren;
+ }
+
+ std::string Prefix;
+ std::string Type;
+ std::string Suffix;
+ std::string Name;
+ std::string Value;
+ bool Logged;
+ bool HasChildren;
+};
+
class WheatyExceptionReport
{
public:
@@ -122,11 +170,12 @@ class WheatyExceptionReport
static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME64 *, char * pszBuffer, unsigned cbBuffer);
- static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, char*, char*);
+ static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, const char*, char*, bool, bool);
- static char * FormatOutputValue(char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress);
+ static void FormatOutputValue(char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize);
static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase);
+ static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address);
static int __cdecl _tprintf(const TCHAR * format, ...);
@@ -141,6 +190,12 @@ class WheatyExceptionReport
static HANDLE m_hDumpFile;
static HANDLE m_hProcess;
static SymbolPairs symbols;
+ static std::stack<SymbolDetail> symbolDetails;
+
+ static char* PushSymbolDetail(char* pszCurrBuffer);
+ static char* PopSymbolDetail(char* pszCurrBuffer);
+ static char* PrintSymbolDetail(char* pszCurrBuffer);
+
};
extern WheatyExceptionReport g_WheatyExceptionReport; // global instance of class
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 5f1c284d80d..fd7aa84c0e9 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");
@@ -378,7 +378,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 5f404fcfe70..c3a47d14e9e 100644
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -32,7 +32,6 @@
class Log
{
typedef std::unordered_map<std::string, Logger> LoggerMap;
- typedef std::unordered_map<std::string, Logger const*> CachedLoggerContainer;
private:
Log();
@@ -47,7 +46,7 @@ class Log
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);
@@ -60,9 +59,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);
@@ -72,7 +71,6 @@ class Log
AppenderMap appenders;
LoggerMap loggers;
- CachedLoggerContainer cachedLoggers;
uint8 AppenderId;
std::string m_logsDir;
@@ -81,37 +79,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);
+ LoggerMap::const_iterator it = loggers.find(type);
+ if (it != loggers.end())
+ return &(it->second);
+
+ if (type == LOGGER_ROOT)
+ return NULL;
- cachedLoggers[originalType] = logger;
- return logger;
+ 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 450c9a4fa6c..0a911492f85 100644
--- a/src/server/shared/Packets/ByteBuffer.cpp
+++ b/src/server/shared/Packets/ByteBuffer.cpp
@@ -29,7 +29,7 @@ ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos,
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
- << ")\n\n";
+ << ")";
message().assign(ss.str());
}
@@ -41,7 +41,7 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size,
ss << "Attempted to put a "
<< (valueSize > 0 ? "NULL-pointer" : "zero-sized value")
- << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n";
+ << " 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 c375a3ffa75..81c6bcd977c 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.cpp b/src/server/shared/Utilities/Util.cpp
index 4489367a7ea..a65f54f87fc 100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -552,3 +552,12 @@ std::string ByteArrayToHexStr(uint8 const* bytes, uint32 arrayLen, bool reverse
return ss.str();
}
+
+uint32 EventMap::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();
+}
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index 34d76bbc71b..c384a6eeaed 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>
// Searcher for map of structs
template<typename T, class S> struct Finder
@@ -560,4 +561,346 @@ 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;
+
+ 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/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index f6123292343..c006e6c925c 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -45,6 +45,7 @@ include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/dep/gsoap
${CMAKE_SOURCE_DIR}/dep/sockets/include
${CMAKE_SOURCE_DIR}/dep/SFMT
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 765ab0f09a6..2a8fcdd431a 100644
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -187,24 +187,24 @@ int Master::Run()
// std::thread rarThread(RemoteAccessThread);
#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))
@@ -213,7 +213,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))
@@ -221,9 +221,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;
@@ -250,7 +250,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/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index f71ef5d064b..f71b7bb8150 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -2735,6 +2735,13 @@ Logger.sql.sql=5,Console DBErrors
Log.Async.Enable = 0
#
+# Allow.IP.Based.Action.Logging
+# Description: Logs actions, e.g. account login and logout to name a few, based on IP of current session.
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+Allow.IP.Based.Action.Logging = 0
+#
###################################################################################################
###################################################################################################
diff --git a/src/tools/mmaps_generator/CMakeLists.txt b/src/tools/mmaps_generator/CMakeLists.txt
index 591e0cc8e98..c0268680657 100644
--- a/src/tools/mmaps_generator/CMakeLists.txt
+++ b/src/tools/mmaps_generator/CMakeLists.txt
@@ -18,7 +18,9 @@ set(mmap_gen_Includes
${CMAKE_SOURCE_DIR}/dep/bzip2
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast/Include
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/collision
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;